aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid E. Box <david.e.box@linux.intel.com>2014-05-09 16:44:05 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2014-05-09 17:56:15 -0400
commit6b8f0c8780c71d78624f736d7849645b64cc88b7 (patch)
tree4a53848d9cad11b67ddb91addc5cccd8b4ae616a
parentd6d211db37e75de2ddc3a4f979038c40df7cc79c (diff)
x86, iosf: Make IOSF driver modular and usable by more drivers
Currently drivers that run on non-IOSF systems (Core/Xeon) can't use the IOSF driver on SOC's without selecting it which forces an unnecessary and limiting dependency. Provides dummy functions to allow these modules to conditionally use the driver on IOSF equipped platforms without impacting their ability to compile and load on non-IOSF platforms. Build default m to ensure availability on x86 SOC's. Signed-off-by: David E. Box <david.e.box@linux.intel.com> Link: http://lkml.kernel.org/r/1399668248-24199-2-git-send-email-david.e.box@linux.intel.com Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--arch/x86/Kconfig7
-rw-r--r--arch/x86/include/asm/iosf_mbi.h33
-rw-r--r--arch/x86/kernel/iosf_mbi.c7
3 files changed, 42 insertions, 5 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 25d2c6f7325e..f1304d38aa21 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2375,12 +2375,9 @@ config X86_DMA_REMAP
2375 depends on STA2X11 2375 depends on STA2X11
2376 2376
2377config IOSF_MBI 2377config IOSF_MBI
2378 bool 2378 tristate
2379 default m
2379 depends on PCI 2380 depends on PCI
2380 ---help---
2381 To be selected by modules requiring access to the Intel OnChip System
2382 Fabric (IOSF) Sideband MailBox Interface (MBI). For MBI platforms
2383 enumerable by PCI.
2384 2381
2385source "net/Kconfig" 2382source "net/Kconfig"
2386 2383
diff --git a/arch/x86/include/asm/iosf_mbi.h b/arch/x86/include/asm/iosf_mbi.h
index 8e71c7941767..1a91a3698b1e 100644
--- a/arch/x86/include/asm/iosf_mbi.h
+++ b/arch/x86/include/asm/iosf_mbi.h
@@ -50,6 +50,10 @@
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#if IS_ENABLED(CONFIG_IOSF_MBI)
54
55bool iosf_mbi_available(void);
56
53/** 57/**
54 * iosf_mbi_read() - MailBox Interface read command 58 * iosf_mbi_read() - MailBox Interface read command
55 * @port: port indicating subunit being accessed 59 * @port: port indicating subunit being accessed
@@ -87,4 +91,33 @@ int iosf_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr);
87 */ 91 */
88int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask); 92int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask);
89 93
94#else /* CONFIG_IOSF_MBI is not enabled */
95static inline
96bool iosf_mbi_available(void)
97{
98 return false;
99}
100
101static inline
102int iosf_mbi_read(u8 port, u8 opcode, u32 offset, u32 *mdr)
103{
104 WARN(1, "IOSF_MBI driver not available");
105 return -EPERM;
106}
107
108static inline
109int iosf_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr)
110{
111 WARN(1, "IOSF_MBI driver not available");
112 return -EPERM;
113}
114
115static inline
116int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask)
117{
118 WARN(1, "IOSF_MBI driver not available");
119 return -EPERM;
120}
121#endif /* CONFIG_IOSF_MBI */
122
90#endif /* IOSF_MBI_SYMS_H */ 123#endif /* IOSF_MBI_SYMS_H */
diff --git a/arch/x86/kernel/iosf_mbi.c b/arch/x86/kernel/iosf_mbi.c
index c3aae6672843..f4ff9786a620 100644
--- a/arch/x86/kernel/iosf_mbi.c
+++ b/arch/x86/kernel/iosf_mbi.c
@@ -177,6 +177,13 @@ int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask)
177} 177}
178EXPORT_SYMBOL(iosf_mbi_modify); 178EXPORT_SYMBOL(iosf_mbi_modify);
179 179
180bool iosf_mbi_available(void)
181{
182 /* Mbi isn't hot-pluggable. No remove routine is provided */
183 return mbi_pdev;
184}
185EXPORT_SYMBOL(iosf_mbi_available);
186
180static int iosf_mbi_probe(struct pci_dev *pdev, 187static int iosf_mbi_probe(struct pci_dev *pdev,
181 const struct pci_device_id *unused) 188 const struct pci_device_id *unused)
182{ 189{