Go to the documentation of this file.
32 #ifndef _SB1250_DEFS_H
33 #define _SB1250_DEFS_H
39 #if !defined(__STDC__) && !defined(_MSC_VER)
40 #error SiByte headers require ANSI C89 support
98 #define SIBYTE_HDR_FMASK_1250_ALL 0x000000ff
99 #define SIBYTE_HDR_FMASK_1250_PASS1 0x00000001
100 #define SIBYTE_HDR_FMASK_1250_PASS2 0x00000002
101 #define SIBYTE_HDR_FMASK_1250_PASS3 0x00000004
103 #define SIBYTE_HDR_FMASK_112x_ALL 0x00000f00
104 #define SIBYTE_HDR_FMASK_112x_PASS1 0x00000100
106 #define SIBYTE_HDR_FMASK_1480_ALL 0x0000f000
107 #define SIBYTE_HDR_FMASK_1480_PASS1 0x00001000
108 #define SIBYTE_HDR_FMASK_1480_PASS2 0x00002000
111 #define SIBYTE_HDR_FMASK(chip, pass) \
112 (SIBYTE_HDR_FMASK_ ## chip ## _ ## pass)
113 #define SIBYTE_HDR_FMASK_ALLREVS(chip) \
114 (SIBYTE_HDR_FMASK_ ## chip ## _ALL)
117 #define SIBYTE_HDR_FMASK_ALL \
118 (SIBYTE_HDR_FMASK_1250_ALL | SIBYTE_HDR_FMASK_112x_ALL \
119 | SIBYTE_HDR_FMASK_1480_ALL)
124 #define SIBYTE_HDR_FMASK_1250_112x_ALL \
125 (SIBYTE_HDR_FMASK_1250_ALL | SIBYTE_HDR_FMASK_112x_ALL)
126 #define SIBYTE_HDR_FMASK_1250_112x SIBYTE_HDR_FMASK_1250_112x_ALL
128 #ifndef SIBYTE_HDR_FEATURES
129 #define SIBYTE_HDR_FEATURES SIBYTE_HDR_FMASK_ALL
134 #define SIBYTE_HDR_FMASK_BEFORE(chip, pass) \
135 ((SIBYTE_HDR_FMASK(chip, pass) - 1) & SIBYTE_HDR_FMASK_ALLREVS(chip))
138 #define SIBYTE_HDR_FMASK_AFTER(chip, pass) \
139 (~(SIBYTE_HDR_FMASK(chip, pass) \
140 | (SIBYTE_HDR_FMASK(chip, pass) - 1)) & SIBYTE_HDR_FMASK_ALLREVS(chip))
144 #define SIBYTE_HDR_FEATURE_CHIP(chip) \
145 (!! (SIBYTE_HDR_FMASK_ALLREVS(chip) & SIBYTE_HDR_FEATURES))
149 #define SIBYTE_HDR_FEATURE_1250_112x \
150 (SIBYTE_HDR_FEATURE_CHIP(1250) || SIBYTE_HDR_FEATURE_CHIP(112x))
154 #define SIBYTE_HDR_FEATURE(chip, pass) \
155 (!! ((SIBYTE_HDR_FMASK(chip, pass) \
156 | SIBYTE_HDR_FMASK_AFTER(chip, pass)) & SIBYTE_HDR_FEATURES))
159 #define SIBYTE_HDR_FEATURE_EXACT(chip, pass) \
160 (!! (SIBYTE_HDR_FMASK(chip, pass) & SIBYTE_HDR_FEATURES))
163 #define SIBYTE_HDR_FEATURE_UP_TO(chip, pass) \
164 (!! ((SIBYTE_HDR_FMASK(chip, pass) \
165 | SIBYTE_HDR_FMASK_BEFORE(chip, pass)) & SIBYTE_HDR_FEATURES))
215 #if !defined(__ASSEMBLY__)
216 #define _SB_MAKE64(x) ((uint64_t)(x))
217 #define _SB_MAKE32(x) ((uint32_t)(x))
219 #define _SB_MAKE64(x) (x)
220 #define _SB_MAKE32(x) (x)
228 #define _SB_MAKEMASK1(n) (_SB_MAKE64(1) << _SB_MAKE64(n))
229 #define _SB_MAKEMASK1_32(n) (_SB_MAKE32(1) << _SB_MAKE32(n))
235 #define _SB_MAKEMASK(v, n) (_SB_MAKE64((_SB_MAKE64(1)<<(v))-1) << _SB_MAKE64(n))
236 #define _SB_MAKEMASK_32(v, n) (_SB_MAKE32((_SB_MAKE32(1)<<(v))-1) << _SB_MAKE32(n))
242 #define _SB_MAKEVALUE(v, n) (_SB_MAKE64(v) << _SB_MAKE64(n))
243 #define _SB_MAKEVALUE_32(v, n) (_SB_MAKE32(v) << _SB_MAKE32(n))
245 #define _SB_GETVALUE(v, n, m) ((_SB_MAKE64(v) & _SB_MAKE64(m)) >> _SB_MAKE64(n))
246 #define _SB_GETVALUE_32(v, n, m) ((_SB_MAKE32(v) & _SB_MAKE32(m)) >> _SB_MAKE32(n))
254 #if defined(__mips64) && !defined(__ASSEMBLY__)
255 #define SBWRITECSR(csr, val) *((volatile uint64_t *) PHYS_TO_K1(csr)) = (val)
256 #define SBREADCSR(csr) (*((volatile uint64_t *) PHYS_TO_K1(csr)))