blob: 478f0a2fe7f4f188554fe7707a8af4a09396ecc4 [file] [log] [blame]
Thomas Gleixnerde6cc652019-05-27 08:55:02 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Christian Krafft0e826642007-02-14 14:09:45 +01002#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>
Christian Krafft0e826642007-02-14 14:09:45 +010015 */
16
17#ifdef __KERNEL__
18
Christian Krafft0e826642007-02-14 14:09:45 +010019#define PMI_TYPE_FREQ_CHANGE 0x01
Christian Krafft4795b782008-07-16 05:51:45 +100020#define PMI_TYPE_POWER_BUTTON 0x02
Christian Krafft0e826642007-02-14 14:09:45 +010021#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
34typedef struct {
35 u8 type;
36 u8 data0;
37 u8 data1;
38 u8 data2;
39} pmi_message_t;
40
41struct pmi_handler {
42 struct list_head node;
43 u8 type;
Christian Krafft813f9072007-07-20 21:39:18 +020044 void (*handle_pmi_message) (pmi_message_t);
Christian Krafft0e826642007-02-14 14:09:45 +010045};
46
Christian Krafft813f9072007-07-20 21:39:18 +020047int pmi_register_handler(struct pmi_handler *);
48void pmi_unregister_handler(struct pmi_handler *);
Christian Krafft0e826642007-02-14 14:09:45 +010049
Christian Krafft813f9072007-07-20 21:39:18 +020050int pmi_send_message(pmi_message_t);
Christian Krafft0e826642007-02-14 14:09:45 +010051
52#endif /* __KERNEL__ */
53#endif /* _POWERPC_PMI_H */