1
2
3
4
5#ifndef IOSF_MBI_SYMS_H
6#define IOSF_MBI_SYMS_H
7
8#include <linux/notifier.h>
9
10#define MBI_MCR_OFFSET 0xD0
11#define MBI_MDR_OFFSET 0xD4
12#define MBI_MCRX_OFFSET 0xD8
13
14#define MBI_RD_MASK 0xFEFFFFFF
15#define MBI_WR_MASK 0X01000000
16
17#define MBI_MASK_HI 0xFFFFFF00
18#define MBI_MASK_LO 0x000000FF
19#define MBI_ENABLE 0xF0
20
21
22#define MBI_MMIO_READ 0x00
23#define MBI_MMIO_WRITE 0x01
24#define MBI_CFG_READ 0x04
25#define MBI_CFG_WRITE 0x05
26#define MBI_CR_READ 0x06
27#define MBI_CR_WRITE 0x07
28#define MBI_REG_READ 0x10
29#define MBI_REG_WRITE 0x11
30#define MBI_ESRAM_READ 0x12
31#define MBI_ESRAM_WRITE 0x13
32
33
34#define BT_MBI_UNIT_AUNIT 0x00
35#define BT_MBI_UNIT_SMC 0x01
36#define BT_MBI_UNIT_CPU 0x02
37#define BT_MBI_UNIT_BUNIT 0x03
38#define BT_MBI_UNIT_PMC 0x04
39#define BT_MBI_UNIT_GFX 0x06
40#define BT_MBI_UNIT_SMI 0x0C
41#define BT_MBI_UNIT_USB 0x43
42#define BT_MBI_UNIT_SATA 0xA3
43#define BT_MBI_UNIT_PCIE 0xA6
44
45
46#define QRK_MBI_UNIT_HBA 0x00
47#define QRK_MBI_UNIT_HB 0x03
48#define QRK_MBI_UNIT_RMU 0x04
49#define QRK_MBI_UNIT_MM 0x05
50#define QRK_MBI_UNIT_SOC 0x31
51
52
53#define MBI_PMIC_BUS_ACCESS_BEGIN 1
54#define MBI_PMIC_BUS_ACCESS_END 2
55
56#if IS_ENABLED(CONFIG_IOSF_MBI)
57
58bool iosf_mbi_available(void);
59
60
61
62
63
64
65
66
67
68
69
70int iosf_mbi_read(u8 port, u8 opcode, u32 offset, u32 *mdr);
71
72
73
74
75
76
77
78
79
80
81
82int iosf_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr);
83
84
85
86
87
88
89
90
91
92
93
94
95int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask);
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117void iosf_mbi_punit_acquire(void);
118
119
120
121
122void iosf_mbi_punit_release(void);
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139int iosf_mbi_register_pmic_bus_access_notifier(struct notifier_block *nb);
140
141
142
143
144
145
146int iosf_mbi_unregister_pmic_bus_access_notifier(struct notifier_block *nb);
147
148
149
150
151
152
153
154int iosf_mbi_call_pmic_bus_access_notifier_chain(unsigned long val, void *v);
155
156#else
157static inline
158bool iosf_mbi_available(void)
159{
160 return false;
161}
162
163static inline
164int iosf_mbi_read(u8 port, u8 opcode, u32 offset, u32 *mdr)
165{
166 WARN(1, "IOSF_MBI driver not available");
167 return -EPERM;
168}
169
170static inline
171int iosf_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr)
172{
173 WARN(1, "IOSF_MBI driver not available");
174 return -EPERM;
175}
176
177static inline
178int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask)
179{
180 WARN(1, "IOSF_MBI driver not available");
181 return -EPERM;
182}
183
184static inline void iosf_mbi_punit_acquire(void) {}
185static inline void iosf_mbi_punit_release(void) {}
186
187static inline
188int iosf_mbi_register_pmic_bus_access_notifier(struct notifier_block *nb)
189{
190 return 0;
191}
192
193static inline
194int iosf_mbi_unregister_pmic_bus_access_notifier(struct notifier_block *nb)
195{
196 return 0;
197}
198
199static inline
200int iosf_mbi_call_pmic_bus_access_notifier_chain(unsigned long val, void *v)
201{
202 return 0;
203}
204
205#endif
206
207#endif
208