2 * Intel OnChip System Fabric MailBox access support
5 #ifndef IOSF_MBI_SYMS_H
6 #define IOSF_MBI_SYMS_H
8 #define MBI_MCR_OFFSET 0xD0
9 #define MBI_MDR_OFFSET 0xD4
10 #define MBI_MCRX_OFFSET 0xD8
12 #define MBI_RD_MASK 0xFEFFFFFF
13 #define MBI_WR_MASK 0X01000000
15 #define MBI_MASK_HI 0xFFFFFF00
16 #define MBI_MASK_LO 0x000000FF
17 #define MBI_ENABLE 0xF0
19 /* IOSF SB read/write opcodes */
20 #define MBI_MMIO_READ 0x00
21 #define MBI_MMIO_WRITE 0x01
22 #define MBI_CFG_READ 0x04
23 #define MBI_CFG_WRITE 0x05
24 #define MBI_CR_READ 0x06
25 #define MBI_CR_WRITE 0x07
26 #define MBI_REG_READ 0x10
27 #define MBI_REG_WRITE 0x11
28 #define MBI_ESRAM_READ 0x12
29 #define MBI_ESRAM_WRITE 0x13
31 /* Baytrail available units */
32 #define BT_MBI_UNIT_AUNIT 0x00
33 #define BT_MBI_UNIT_SMC 0x01
34 #define BT_MBI_UNIT_CPU 0x02
35 #define BT_MBI_UNIT_BUNIT 0x03
36 #define BT_MBI_UNIT_PMC 0x04
37 #define BT_MBI_UNIT_GFX 0x06
38 #define BT_MBI_UNIT_SMI 0x0C
39 #define BT_MBI_UNIT_USB 0x43
40 #define BT_MBI_UNIT_SATA 0xA3
41 #define BT_MBI_UNIT_PCIE 0xA6
43 /* Quark available units */
44 #define QRK_MBI_UNIT_HBA 0x00
45 #define QRK_MBI_UNIT_HB 0x03
46 #define QRK_MBI_UNIT_RMU 0x04
47 #define QRK_MBI_UNIT_MM 0x05
48 #define QRK_MBI_UNIT_SOC 0x31
50 #if IS_ENABLED(CONFIG_IOSF_MBI)
52 bool iosf_mbi_available(void);
55 * iosf_mbi_read() - MailBox Interface read command
56 * @port: port indicating subunit being accessed
57 * @opcode: port specific read or write opcode
58 * @offset: register address offset
59 * @mdr: register data to be read
61 * Locking is handled by spinlock - cannot sleep.
62 * Return: Nonzero on error
64 int iosf_mbi_read(u8 port
, u8 opcode
, u32 offset
, u32
*mdr
);
67 * iosf_mbi_write() - MailBox unmasked write command
68 * @port: port indicating subunit being accessed
69 * @opcode: port specific read or write opcode
70 * @offset: register address offset
71 * @mdr: register data to be written
73 * Locking is handled by spinlock - cannot sleep.
74 * Return: Nonzero on error
76 int iosf_mbi_write(u8 port
, u8 opcode
, u32 offset
, u32 mdr
);
79 * iosf_mbi_modify() - MailBox masked write command
80 * @port: port indicating subunit being accessed
81 * @opcode: port specific read or write opcode
82 * @offset: register address offset
83 * @mdr: register data being modified
84 * @mask: mask indicating bits in mdr to be modified
86 * Locking is handled by spinlock - cannot sleep.
87 * Return: Nonzero on error
89 int iosf_mbi_modify(u8 port
, u8 opcode
, u32 offset
, u32 mdr
, u32 mask
);
91 #else /* CONFIG_IOSF_MBI is not enabled */
93 bool iosf_mbi_available(void)
99 int iosf_mbi_read(u8 port
, u8 opcode
, u32 offset
, u32
*mdr
)
101 WARN(1, "IOSF_MBI driver not available");
106 int iosf_mbi_write(u8 port
, u8 opcode
, u32 offset
, u32 mdr
)
108 WARN(1, "IOSF_MBI driver not available");
113 int iosf_mbi_modify(u8 port
, u8 opcode
, u32 offset
, u32 mdr
, u32 mask
)
115 WARN(1, "IOSF_MBI driver not available");
118 #endif /* CONFIG_IOSF_MBI */
120 #endif /* IOSF_MBI_SYMS_H */