···11+/* SPDX-License-Identifier: GPL-2.0-only */22+/*33+ * Copyright (c) 2018 NVIDIA Corporation.44+ */55+66+ /*77+ * Function naming determines intended use:88+ *99+ * <x>_r(void) : Returns the offset for register <x>.1010+ *1111+ * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.1212+ *1313+ * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.1414+ *1515+ * <x>_<y>_f(u32 v) : Returns a value based on 'v' which has been shifted1616+ * and masked to place it at field <y> of register <x>. This value1717+ * can be |'d with others to produce a full register value for1818+ * register <x>.1919+ *2020+ * <x>_<y>_m(void) : Returns a mask for field <y> of register <x>. This2121+ * value can be ~'d and then &'d to clear the value of field <y> for2222+ * register <x>.2323+ *2424+ * <x>_<y>_<z>_f(void) : Returns the constant value <z> after being shifted2525+ * to place it at field <y> of register <x>. This value can be |'d2626+ * with others to produce a full register value for <x>.2727+ *2828+ * <x>_<y>_v(u32 r) : Returns the value of field <y> from a full register2929+ * <x> value 'r' after being shifted to place its LSB at bit 0.3030+ * This value is suitable for direct comparison with other unshifted3131+ * values appropriate for use in field <y> of register <x>.3232+ *3333+ * <x>_<y>_<z>_v(void) : Returns the constant value for <z> defined for3434+ * field <y> of register <x>. This value is suitable for direct3535+ * comparison with unshifted values appropriate for use in field <y>3636+ * of register <x>.3737+ */3838+3939+#ifndef HOST1X_HW_HOST1X08_UCLASS_H4040+#define HOST1X_HW_HOST1X08_UCLASS_H4141+4242+static inline u32 host1x_uclass_incr_syncpt_r(void)4343+{4444+ return 0x0;4545+}4646+#define HOST1X_UCLASS_INCR_SYNCPT \4747+ host1x_uclass_incr_syncpt_r()4848+static inline u32 host1x_uclass_incr_syncpt_cond_f(u32 v)4949+{5050+ return (v & 0xff) << 10;5151+}5252+#define HOST1X_UCLASS_INCR_SYNCPT_COND_F(v) \5353+ host1x_uclass_incr_syncpt_cond_f(v)5454+static inline u32 host1x_uclass_incr_syncpt_indx_f(u32 v)5555+{5656+ return (v & 0xff) << 0;5757+}5858+#define HOST1X_UCLASS_INCR_SYNCPT_INDX_F(v) \5959+ host1x_uclass_incr_syncpt_indx_f(v)6060+static inline u32 host1x_uclass_wait_syncpt_r(void)6161+{6262+ return 0x8;6363+}6464+#define HOST1X_UCLASS_WAIT_SYNCPT \6565+ host1x_uclass_wait_syncpt_r()6666+static inline u32 host1x_uclass_wait_syncpt_indx_f(u32 v)6767+{6868+ return (v & 0xff) << 24;6969+}7070+#define HOST1X_UCLASS_WAIT_SYNCPT_INDX_F(v) \7171+ host1x_uclass_wait_syncpt_indx_f(v)7272+static inline u32 host1x_uclass_wait_syncpt_thresh_f(u32 v)7373+{7474+ return (v & 0xffffff) << 0;7575+}7676+#define HOST1X_UCLASS_WAIT_SYNCPT_THRESH_F(v) \7777+ host1x_uclass_wait_syncpt_thresh_f(v)7878+static inline u32 host1x_uclass_wait_syncpt_base_r(void)7979+{8080+ return 0x9;8181+}8282+#define HOST1X_UCLASS_WAIT_SYNCPT_BASE \8383+ host1x_uclass_wait_syncpt_base_r()8484+static inline u32 host1x_uclass_wait_syncpt_base_indx_f(u32 v)8585+{8686+ return (v & 0xff) << 24;8787+}8888+#define HOST1X_UCLASS_WAIT_SYNCPT_BASE_INDX_F(v) \8989+ host1x_uclass_wait_syncpt_base_indx_f(v)9090+static inline u32 host1x_uclass_wait_syncpt_base_base_indx_f(u32 v)9191+{9292+ return (v & 0xff) << 16;9393+}9494+#define HOST1X_UCLASS_WAIT_SYNCPT_BASE_BASE_INDX_F(v) \9595+ host1x_uclass_wait_syncpt_base_base_indx_f(v)9696+static inline u32 host1x_uclass_wait_syncpt_base_offset_f(u32 v)9797+{9898+ return (v & 0xffff) << 0;9999+}100100+#define HOST1X_UCLASS_WAIT_SYNCPT_BASE_OFFSET_F(v) \101101+ host1x_uclass_wait_syncpt_base_offset_f(v)102102+static inline u32 host1x_uclass_load_syncpt_base_r(void)103103+{104104+ return 0xb;105105+}106106+#define HOST1X_UCLASS_LOAD_SYNCPT_BASE \107107+ host1x_uclass_load_syncpt_base_r()108108+static inline u32 host1x_uclass_load_syncpt_base_base_indx_f(u32 v)109109+{110110+ return (v & 0xff) << 24;111111+}112112+#define HOST1X_UCLASS_LOAD_SYNCPT_BASE_BASE_INDX_F(v) \113113+ host1x_uclass_load_syncpt_base_base_indx_f(v)114114+static inline u32 host1x_uclass_load_syncpt_base_value_f(u32 v)115115+{116116+ return (v & 0xffffff) << 0;117117+}118118+#define HOST1X_UCLASS_LOAD_SYNCPT_BASE_VALUE_F(v) \119119+ host1x_uclass_load_syncpt_base_value_f(v)120120+static inline u32 host1x_uclass_incr_syncpt_base_base_indx_f(u32 v)121121+{122122+ return (v & 0xff) << 24;123123+}124124+#define HOST1X_UCLASS_INCR_SYNCPT_BASE_BASE_INDX_F(v) \125125+ host1x_uclass_incr_syncpt_base_base_indx_f(v)126126+static inline u32 host1x_uclass_incr_syncpt_base_offset_f(u32 v)127127+{128128+ return (v & 0xffffff) << 0;129129+}130130+#define HOST1X_UCLASS_INCR_SYNCPT_BASE_OFFSET_F(v) \131131+ host1x_uclass_incr_syncpt_base_offset_f(v)132132+static inline u32 host1x_uclass_indoff_r(void)133133+{134134+ return 0x2d;135135+}136136+#define HOST1X_UCLASS_INDOFF \137137+ host1x_uclass_indoff_r()138138+static inline u32 host1x_uclass_indoff_indbe_f(u32 v)139139+{140140+ return (v & 0xf) << 28;141141+}142142+#define HOST1X_UCLASS_INDOFF_INDBE_F(v) \143143+ host1x_uclass_indoff_indbe_f(v)144144+static inline u32 host1x_uclass_indoff_autoinc_f(u32 v)145145+{146146+ return (v & 0x1) << 27;147147+}148148+#define HOST1X_UCLASS_INDOFF_AUTOINC_F(v) \149149+ host1x_uclass_indoff_autoinc_f(v)150150+static inline u32 host1x_uclass_indoff_indmodid_f(u32 v)151151+{152152+ return (v & 0xff) << 18;153153+}154154+#define HOST1X_UCLASS_INDOFF_INDMODID_F(v) \155155+ host1x_uclass_indoff_indmodid_f(v)156156+static inline u32 host1x_uclass_indoff_indroffset_f(u32 v)157157+{158158+ return (v & 0xffff) << 2;159159+}160160+#define HOST1X_UCLASS_INDOFF_INDROFFSET_F(v) \161161+ host1x_uclass_indoff_indroffset_f(v)162162+static inline u32 host1x_uclass_indoff_rwn_read_v(void)163163+{164164+ return 1;165165+}166166+#define HOST1X_UCLASS_INDOFF_INDROFFSET_F(v) \167167+ host1x_uclass_indoff_indroffset_f(v)168168+static inline u32 host1x_uclass_load_syncpt_payload_32_r(void)169169+{170170+ return 0x4e;171171+}172172+#define HOST1X_UCLASS_LOAD_SYNCPT_PAYLOAD_32 \173173+ host1x_uclass_load_syncpt_payload_32_r()174174+static inline u32 host1x_uclass_wait_syncpt_32_r(void)175175+{176176+ return 0x50;177177+}178178+#define HOST1X_UCLASS_WAIT_SYNCPT_32 \179179+ host1x_uclass_wait_syncpt_32_r()180180+181181+#endif