1 /* SPDX-License-Identifier: MIT */
3 #ifndef _INTEL_SIDEBAND_H_
4 #define _INTEL_SIDEBAND_H_
6 #include <linux/bitops.h>
7 #include <linux/types.h>
9 struct drm_i915_private
;
12 enum intel_sbi_destination
{
28 void vlv_iosf_sb_get(struct drm_i915_private
*i915
, unsigned long ports
);
29 u32
vlv_iosf_sb_read(struct drm_i915_private
*i915
, u8 port
, u32 reg
);
30 void vlv_iosf_sb_write(struct drm_i915_private
*i915
,
31 u8 port
, u32 reg
, u32 val
);
32 void vlv_iosf_sb_put(struct drm_i915_private
*i915
, unsigned long ports
);
34 static inline void vlv_bunit_get(struct drm_i915_private
*i915
)
36 vlv_iosf_sb_get(i915
, BIT(VLV_IOSF_SB_BUNIT
));
39 u32
vlv_bunit_read(struct drm_i915_private
*i915
, u32 reg
);
40 void vlv_bunit_write(struct drm_i915_private
*i915
, u32 reg
, u32 val
);
42 static inline void vlv_bunit_put(struct drm_i915_private
*i915
)
44 vlv_iosf_sb_put(i915
, BIT(VLV_IOSF_SB_BUNIT
));
47 static inline void vlv_cck_get(struct drm_i915_private
*i915
)
49 vlv_iosf_sb_get(i915
, BIT(VLV_IOSF_SB_CCK
));
52 u32
vlv_cck_read(struct drm_i915_private
*i915
, u32 reg
);
53 void vlv_cck_write(struct drm_i915_private
*i915
, u32 reg
, u32 val
);
55 static inline void vlv_cck_put(struct drm_i915_private
*i915
)
57 vlv_iosf_sb_put(i915
, BIT(VLV_IOSF_SB_CCK
));
60 static inline void vlv_ccu_get(struct drm_i915_private
*i915
)
62 vlv_iosf_sb_get(i915
, BIT(VLV_IOSF_SB_CCU
));
65 u32
vlv_ccu_read(struct drm_i915_private
*i915
, u32 reg
);
66 void vlv_ccu_write(struct drm_i915_private
*i915
, u32 reg
, u32 val
);
68 static inline void vlv_ccu_put(struct drm_i915_private
*i915
)
70 vlv_iosf_sb_put(i915
, BIT(VLV_IOSF_SB_CCU
));
73 static inline void vlv_dpio_get(struct drm_i915_private
*i915
)
75 vlv_iosf_sb_get(i915
, BIT(VLV_IOSF_SB_DPIO
));
78 u32
vlv_dpio_read(struct drm_i915_private
*i915
, enum pipe pipe
, int reg
);
79 void vlv_dpio_write(struct drm_i915_private
*i915
,
80 enum pipe pipe
, int reg
, u32 val
);
82 static inline void vlv_dpio_put(struct drm_i915_private
*i915
)
84 vlv_iosf_sb_put(i915
, BIT(VLV_IOSF_SB_DPIO
));
87 static inline void vlv_flisdsi_get(struct drm_i915_private
*i915
)
89 vlv_iosf_sb_get(i915
, BIT(VLV_IOSF_SB_FLISDSI
));
92 u32
vlv_flisdsi_read(struct drm_i915_private
*i915
, u32 reg
);
93 void vlv_flisdsi_write(struct drm_i915_private
*i915
, u32 reg
, u32 val
);
95 static inline void vlv_flisdsi_put(struct drm_i915_private
*i915
)
97 vlv_iosf_sb_put(i915
, BIT(VLV_IOSF_SB_FLISDSI
));
100 static inline void vlv_nc_get(struct drm_i915_private
*i915
)
102 vlv_iosf_sb_get(i915
, BIT(VLV_IOSF_SB_NC
));
105 u32
vlv_nc_read(struct drm_i915_private
*i915
, u8 addr
);
107 static inline void vlv_nc_put(struct drm_i915_private
*i915
)
109 vlv_iosf_sb_put(i915
, BIT(VLV_IOSF_SB_NC
));
112 static inline void vlv_punit_get(struct drm_i915_private
*i915
)
114 vlv_iosf_sb_get(i915
, BIT(VLV_IOSF_SB_PUNIT
));
117 u32
vlv_punit_read(struct drm_i915_private
*i915
, u32 addr
);
118 int vlv_punit_write(struct drm_i915_private
*i915
, u32 addr
, u32 val
);
120 static inline void vlv_punit_put(struct drm_i915_private
*i915
)
122 vlv_iosf_sb_put(i915
, BIT(VLV_IOSF_SB_PUNIT
));
125 u32
intel_sbi_read(struct drm_i915_private
*i915
, u16 reg
,
126 enum intel_sbi_destination destination
);
127 void intel_sbi_write(struct drm_i915_private
*i915
, u16 reg
, u32 value
,
128 enum intel_sbi_destination destination
);
130 int sandybridge_pcode_read(struct drm_i915_private
*i915
, u32 mbox
,
131 u32
*val
, u32
*val1
);
132 int sandybridge_pcode_write_timeout(struct drm_i915_private
*i915
, u32 mbox
,
133 u32 val
, int fast_timeout_us
,
134 int slow_timeout_ms
);
135 #define sandybridge_pcode_write(i915, mbox, val) \
136 sandybridge_pcode_write_timeout(i915, mbox, val, 500, 0)
138 int skl_pcode_request(struct drm_i915_private
*i915
, u32 mbox
, u32 request
,
139 u32 reply_mask
, u32 reply
, int timeout_base_ms
);
141 void intel_pcode_init(struct drm_i915_private
*i915
);
143 #endif /* _INTEL_SIDEBAND_H */