aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/Kconfig7
-rw-r--r--arch/x86/include/asm/iosf_mbi.h55
-rw-r--r--arch/x86/kernel/iosf_mbi.c13
3 files changed, 69 insertions, 6 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 650433ab184f..7d5feb5908dd 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2377,12 +2377,9 @@ config X86_DMA_REMAP
2377 depends on STA2X11 2377 depends on STA2X11
2378 2378
2379config IOSF_MBI 2379config IOSF_MBI
2380 bool 2380 tristate
2381 default m
2381 depends on PCI 2382 depends on PCI
2382 ---help---
2383 To be selected by modules requiring access to the Intel OnChip System
2384 Fabric (IOSF) Sideband MailBox Interface (MBI). For MBI platforms
2385 enumerable by PCI.
2386 2383
2387source "net/Kconfig" 2384source "net/Kconfig"
2388 2385
diff --git a/arch/x86/include/asm/iosf_mbi.h b/arch/x86/include/asm/iosf_mbi.h
index 8e71c7941767..57995f0596a6 100644
--- a/arch/x86/include/asm/iosf_mbi.h
+++ b/arch/x86/include/asm/iosf_mbi.h
@@ -50,6 +50,32 @@
50#define BT_MBI_PCIE_READ 0x00 50#define BT_MBI_PCIE_READ 0x00
51#define BT_MBI_PCIE_WRITE 0x01 51#define BT_MBI_PCIE_WRITE 0x01
52 52
53/* Quark available units */
54#define QRK_MBI_UNIT_HBA 0x00
55#define QRK_MBI_UNIT_HB 0x03
56#define QRK_MBI_UNIT_RMU 0x04
57#define QRK_MBI_UNIT_MM 0x05
58#define QRK_MBI_UNIT_MMESRAM 0x05
59#define QRK_MBI_UNIT_SOC 0x31
60
61/* Quark read/write opcodes */
62#define QRK_MBI_HBA_READ 0x10
63#define QRK_MBI_HBA_WRITE 0x11
64#define QRK_MBI_HB_READ 0x10
65#define QRK_MBI_HB_WRITE 0x11
66#define QRK_MBI_RMU_READ 0x10
67#define QRK_MBI_RMU_WRITE 0x11
68#define QRK_MBI_MM_READ 0x10
69#define QRK_MBI_MM_WRITE 0x11
70#define QRK_MBI_MMESRAM_READ 0x12
71#define QRK_MBI_MMESRAM_WRITE 0x13
72#define QRK_MBI_SOC_READ 0x06
73#define QRK_MBI_SOC_WRITE 0x07
74
75#if IS_ENABLED(CONFIG_IOSF_MBI)
76
77bool iosf_mbi_available(void);
78
53/** 79/**
54 * iosf_mbi_read() - MailBox Interface read command 80 * iosf_mbi_read() - MailBox Interface read command
55 * @port: port indicating subunit being accessed 81 * @port: port indicating subunit being accessed
@@ -87,4 +113,33 @@ int iosf_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr);
87 */ 113 */
88int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask); 114int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask);
89 115
116#else /* CONFIG_IOSF_MBI is not enabled */
117static inline
118bool iosf_mbi_available(void)
119{
120 return false;
121}
122
123static inline
124int iosf_mbi_read(u8 port, u8 opcode, u32 offset, u32 *mdr)
125{
126 WARN(1, "IOSF_MBI driver not available");
127 return -EPERM;
128}
129
130static inline
131int iosf_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr)
132{
133 WARN(1, "IOSF_MBI driver not available");
134 return -EPERM;
135}
136
137static inline
138int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask)
139{
140 WARN(1, "IOSF_MBI driver not available");
141 return -EPERM;
142}
143#endif /* CONFIG_IOSF_MBI */
144
90#endif /* IOSF_MBI_SYMS_H */ 145#endif /* IOSF_MBI_SYMS_H */
diff --git a/arch/x86/kernel/iosf_mbi.c b/arch/x86/kernel/iosf_mbi.c
index c3aae6672843..d30acdc1229d 100644
--- a/arch/x86/kernel/iosf_mbi.c
+++ b/arch/x86/kernel/iosf_mbi.c
@@ -25,6 +25,9 @@
25 25
26#include <asm/iosf_mbi.h> 26#include <asm/iosf_mbi.h>
27 27
28#define PCI_DEVICE_ID_BAYTRAIL 0x0F00
29#define PCI_DEVICE_ID_QUARK_X1000 0x0958
30
28static DEFINE_SPINLOCK(iosf_mbi_lock); 31static DEFINE_SPINLOCK(iosf_mbi_lock);
29 32
30static inline u32 iosf_mbi_form_mcr(u8 op, u8 port, u8 offset) 33static inline u32 iosf_mbi_form_mcr(u8 op, u8 port, u8 offset)
@@ -177,6 +180,13 @@ int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask)
177} 180}
178EXPORT_SYMBOL(iosf_mbi_modify); 181EXPORT_SYMBOL(iosf_mbi_modify);
179 182
183bool iosf_mbi_available(void)
184{
185 /* Mbi isn't hot-pluggable. No remove routine is provided */
186 return mbi_pdev;
187}
188EXPORT_SYMBOL(iosf_mbi_available);
189
180static int iosf_mbi_probe(struct pci_dev *pdev, 190static int iosf_mbi_probe(struct pci_dev *pdev,
181 const struct pci_device_id *unused) 191 const struct pci_device_id *unused)
182{ 192{
@@ -193,7 +203,8 @@ static int iosf_mbi_probe(struct pci_dev *pdev,
193} 203}
194 204
195static DEFINE_PCI_DEVICE_TABLE(iosf_mbi_pci_ids) = { 205static DEFINE_PCI_DEVICE_TABLE(iosf_mbi_pci_ids) = {
196 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0F00) }, 206 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_BAYTRAIL) },
207 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_QUARK_X1000) },
197 { 0, }, 208 { 0, },
198}; 209};
199MODULE_DEVICE_TABLE(pci, iosf_mbi_pci_ids); 210MODULE_DEVICE_TABLE(pci, iosf_mbi_pci_ids);