xref: /openbmc/linux/arch/powerpc/include/asm/pmi.h (revision 3381df09)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #ifndef _POWERPC_PMI_H
3 #define _POWERPC_PMI_H
4 
5 /*
6  * Definitions for talking with PMI device on PowerPC
7  *
8  * PMI (Platform Management Interrupt) is a way to communicate
9  * with the BMC (Baseboard Management Controller) via interrupts.
10  * Unlike IPMI it is bidirectional and has a low latency.
11  *
12  * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
13  *
14  * Author: Christian Krafft <krafft@de.ibm.com>
15  */
16 
17 #ifdef __KERNEL__
18 
19 #define PMI_TYPE_FREQ_CHANGE	0x01
20 #define PMI_TYPE_POWER_BUTTON	0x02
21 #define PMI_READ_TYPE		0
22 #define PMI_READ_DATA0		1
23 #define PMI_READ_DATA1		2
24 #define PMI_READ_DATA2		3
25 #define PMI_WRITE_TYPE		4
26 #define PMI_WRITE_DATA0		5
27 #define PMI_WRITE_DATA1		6
28 #define PMI_WRITE_DATA2		7
29 
30 #define PMI_ACK			0x80
31 
32 #define PMI_TIMEOUT		100
33 
34 typedef struct {
35 	u8	type;
36 	u8	data0;
37 	u8	data1;
38 	u8	data2;
39 } pmi_message_t;
40 
41 struct pmi_handler {
42 	struct list_head node;
43 	u8 type;
44 	void (*handle_pmi_message) (pmi_message_t);
45 };
46 
47 int pmi_register_handler(struct pmi_handler *);
48 void pmi_unregister_handler(struct pmi_handler *);
49 
50 int pmi_send_message(pmi_message_t);
51 
52 #endif /* __KERNEL__ */
53 #endif /* _POWERPC_PMI_H */
54