Skip to contentSkip to conversation

platform:x86: add Intel Broxton PMC IPC driver

PATCH Superseded qipeng.zha 2 participants 4 messages May 18, 2015 – May 20, 2015

Subsystems (2)

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

qipeng.zha

author
#0 lore raw

PATCH v2 1/1 platform:x86: add Intel Broxton PMC IPC driver

From: "qipeng.zha" <[email protected]>

This driver provides support for PMC control on Broxton platforms, PMC is ARC processor which defined some IPC commands for communication with other entities running in IA

---
 arch/x86/include/asm/intel_pmc_ipc.h |  82 ++++
 drivers/platform/x86/Kconfig         |   7 +
 drivers/platform/x86/Makefile        |   1 +
 drivers/platform/x86/intel_pmc_ipc.c | 766 +++++++++++++++++++++++++++++++++++
 4 files changed, 856 insertions(+)
 create mode 100644 arch/x86/include/asm/intel_pmc_ipc.h
 create mode 100644 drivers/platform/x86/intel_pmc_ipc.c
arch/x86/include/asm/intel_pmc_ipc.h new file +82 -0
new file mode 100644
index 0000000..a78f7cf
@@ -0,0 +1,82 @@
+#ifndef _ASM_X86_INTEL_PMC_IPC_H_
+#define  _ASM_X86_INTEL_PMC_IPC_H_
+
+/* Commands */
+#define PMC_IPC_PMIC_ACCESS		0xFF
+#define		PMC_IPC_PMIC_ACCESS_READ	0x0
+#define		PMC_IPC_PMIC_ACCESS_WRITE	0x1
+#define PMC_IPC_USB_PWR_CTRL		0xF0
+#define PMC_IPC_PMIC_BLACKLIST_SEL	0xEF
+#define PMC_IPC_PHY_CONFIG		0xEE
+#define PMC_IPC_NORTHPEAK_CTRL		0xED
+#define PMC_IPC_PM_DEBUG		0xEC
+#define PMC_IPC_PMC_TELEMTRY		0xEB
+#define PMC_IPC_PMC_FW_MSG_CTRL		0xEA
+
+/* IPC return code */
+#define IPC_ERR_NONE			0
+#define IPC_ERR_CMD_NOT_SUPPORTED	1
+#define IPC_ERR_CMD_NOT_SERVICED	2
+#define IPC_ERR_UNABLE_TO_SERVICE	3
+#define IPC_ERR_CMD_INVALID		4
+#define IPC_ERR_CMD_FAILED		5
+#define IPC_ERR_EMSECURITY		6
+#define IPC_ERR_UNSIGNEDKERNEL		7
+
+#ifdef CONFIG_INTEL_PMC_IPC
+
+/*
+ * intel_pmc_ipc_simple_command
+ * @cmd: command
+ * @sub: sub type
+ */
+int intel_pmc_ipc_simple_command(int cmd, int sub);
+
+/*
+ * intel_pmc_ipc_raw_cmd
+ * @cmd: command
+ * @sub: sub type
+ * @in: input data
+ * @inlen: input length in bytes
+ * @out: output data
+ * @outlen: output length in dwords
+ * @sptr: data writing to SPTR register
+ * @dptr: data writing to DPTR register
+ */
+int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen,
+		u32 *out, u32 outlen, u32 dptr, u32 sptr);
+
+/*
+ * intel_pmc_ipc_command
+ * @cmd: command
+ * @sub: sub type
+ * @in: input data
+ * @inlen: input length in bytes
+ * @out: output data
+ * @outlen: output length in dwords
+ */
+int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen,
+		u32 *out, u32 outlen);
+
+#else
+
+static inline int intel_pmc_ipc_simple_command(int cmd, int sub)
+{
+	return -EINVAL;
+}
+
+static inline int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen,
+		u32 *out, u32 outlen, u32 dptr, u32 sptr)
+{
+	return -EINVAL;
+}
+
+static inline int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen,
+		u32 *out, u32 outlen)
+{
+	return -EINVAL;
+}
+
+#endif /*CONFIG_INTEL_PMC_IPC*/
+
+#endif
drivers/platform/x86/Kconfig +7 -0
index 9752761..4eb15eb 100644
@@ -884,4 +884,11 @@ config PVPANIC
 	  a paravirtualized device provided by QEMU; it lets a virtual machine
 	  (guest) communicate panic events to the host.
 
+config INTEL_PMC_IPC
+	tristate "Intel PMC IPC Driver"
+	---help---
+	This driver provides support for PMC control on some Intel platforms,
+	PMC is ARC processor which defined some IPC commands for communication
+	with other entities which running in IA.
+
 endif # X86_PLATFORM_DEVICES
drivers/platform/x86/Makefile +1 -0
index f82232b..1051372 100644
@@ -58,3 +58,4 @@ obj-$(CONFIG_INTEL_SMARTCONNECT)	+= intel-smartconnect.o
 
 obj-$(CONFIG_PVPANIC)           += pvpanic.o
 obj-$(CONFIG_ALIENWARE_WMI)	+= alienware-wmi.o
+obj-$(CONFIG_INTEL_PMC_IPC)	+= intel_pmc_ipc.o
drivers/platform/x86/intel_pmc_ipc.c new file +766 -0

766 lines not on this page · raw message

Signature · 1 line
1.8.3.2
#1 lore raw
Quoted 7 lines · qipeng.zha

From: "qipeng.zha" <[email protected]>

This driver provides support for PMC control on Broxton platforms, PMC is ARC processor which defined some IPC commands for communication with other entities running in IA

Please run through checkpatch.pl and correct errors.

Compilation fails:

CC [M] drivers/platform/x86/intel_pmc_ipc.o
drivers/platform/x86/intel_pmc_ipc.c:214:5: error: redefinition of ‘intel_pmc_ipc_simple_command’
int intel_pmc_ipc_simple_command(int cmd, int sub)

     ^
In file included from drivers/platform/x86/intel_pmc_ipc.c:32:0:
./arch/x86/include/asm/intel_pmc_ipc.h:63:19: note: previous definition of ‘intel_pmc_ipc_simple_command’ was here
 static inline int intel_pmc_ipc_simple_command(int cmd, int sub)
                   ^
drivers/platform/x86/intel_pmc_ipc.c:242:5: error: redefinition of ‘intel_pmc_ipc_raw_cmd’
 int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen, u32 *out,
     ^
In file included from drivers/platform/x86/intel_pmc_ipc.c:32:0:
./arch/x86/include/asm/intel_pmc_ipc.h:68:19: note: previous definition of ‘intel_pmc_ipc_raw_cmd’ was here
 static inline int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen,
                   ^
drivers/platform/x86/intel_pmc_ipc.c:286:5: error: redefinition of ‘intel_pmc_ipc_command’
 int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen,
     ^
In file included from drivers/platform/x86/intel_pmc_ipc.c:32:0:
./arch/x86/include/asm/intel_pmc_ipc.h:74:19: note: previous definition of ‘intel_pmc_ipc_command’ was here
 static inline int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen,
                   ^

scripts/Makefile.build:264: recipe for target 'drivers/platform/x86/intel_pmc_ipc.o' failed make[1]: *** [drivers/platform/x86/intel_pmc_ipc.o] Error 1
Makefile:1552: recipe for target 'drivers/platform/x86/intel_pmc_ipc.ko' failed
make: *** [drivers/platform/x86/intel_pmc_ipc.ko] Error 2

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
#2 lore raw

Hi Darren Hart

I double checked no compile fail on my side.
And could you check if enable config option " CONFIG_INTEL_PMC_IPC", Seems the error is due to this, please check intel_pmc_ipc.h for detail Thanks

And by using checkpatch.pl, found there is really warning as below I will sent update one
Great thanks:)

qzha $ scripts/checkpatch.pl 0001-platform-x86-add-Intel-Broxton-PMC-IPC-driver.patch
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #21:
new file mode 100644

WARNING: 'resoures' may be misspelled - perhaps 'resources'? #207: FILE: drivers/platform/x86/intel_pmc_ipc.c:69:
+ * but export multi resoures on one ACPI device(IPC) for

total: 0 errors, 2 warnings, 863 lines checked

0001-platform-x86-add-Intel-Broxton-PMC-IPC-driver.patch has style problems, please review.

Best wishes
Qipeng

-----Original Message-----
From: Darren Hart [mailto:[email protected]]
Sent: Wednesday, May 20, 2015 5:29 PM
To: Zha, Qipeng
Cc: [email protected]; Yang, Fei; Zhong, Huiquan; Chen, Jason CJ; Zheng, Qi
Subject: Re: [PATCH v2] platform:x86: add Intel Broxton PMC IPC driver

Quoted 7 lines · qipeng.zha

From: "qipeng.zha" <[email protected]>

This driver provides support for PMC control on Broxton platforms, PMC is ARC processor which defined some IPC commands for communication with other entities running in IA

Please run through checkpatch.pl and correct errors.

Compilation fails:

CC [M] drivers/platform/x86/intel_pmc_ipc.o
drivers/platform/x86/intel_pmc_ipc.c:214:5: error: redefinition of ‘intel_pmc_ipc_simple_command’
int intel_pmc_ipc_simple_command(int cmd, int sub)

     ^
In file included from drivers/platform/x86/intel_pmc_ipc.c:32:0:
./arch/x86/include/asm/intel_pmc_ipc.h:63:19: note: previous definition of ‘intel_pmc_ipc_simple_command’ was here  static inline int intel_pmc_ipc_simple_command(int cmd, int sub)
                   ^
drivers/platform/x86/intel_pmc_ipc.c:242:5: error: redefinition of ‘intel_pmc_ipc_raw_cmd’
 int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen, u32 *out,
     ^
In file included from drivers/platform/x86/intel_pmc_ipc.c:32:0:
./arch/x86/include/asm/intel_pmc_ipc.h:68:19: note: previous definition of ‘intel_pmc_ipc_raw_cmd’ was here  static inline int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen,
                   ^
drivers/platform/x86/intel_pmc_ipc.c:286:5: error: redefinition of ‘intel_pmc_ipc_command’
 int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen,
     ^
In file included from drivers/platform/x86/intel_pmc_ipc.c:32:0:
./arch/x86/include/asm/intel_pmc_ipc.h:74:19: note: previous definition of ‘intel_pmc_ipc_command’ was here  static inline int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen,
                   ^

scripts/Makefile.build:264: recipe for target 'drivers/platform/x86/intel_pmc_ipc.o' failed make[1]: *** [drivers/platform/x86/intel_pmc_ipc.o] Error 1
Makefile:1552: recipe for target 'drivers/platform/x86/intel_pmc_ipc.ko' failed
make: *** [drivers/platform/x86/intel_pmc_ipc.ko] Error 2

--
Darren Hart
Intel Open Source Technology Center

#3 lore raw
Quoted 5 lines · Qipeng

Hi Darren Hart

I double checked no compile fail on my side.
And could you check if enable config option " CONFIG_INTEL_PMC_IPC", Seems the error is due to this, please check intel_pmc_ipc.h for detail

Of course :-)

If set to =m it fails as described. If set to =y it compiles without error.

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center