blob: b4e91fbf5081ab79533856a12f3370d42218499a [file] [log] [blame]
Christian Krafft0e826642007-02-14 14:09:45 +01001#ifndef _POWERPC_PMI_H
2#define _POWERPC_PMI_H
3
4/*
5 * Definitions for talking with PMI device on PowerPC
6 *
7 * PMI (Platform Management Interrupt) is a way to communicate
8 * with the BMC (Baseboard Management Controller) via interrupts.
9 * Unlike IPMI it is bidirectional and has a low latency.
10 *
11 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
12 *
13 * Author: Christian Krafft <krafft@de.ibm.com>
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2, or (at your option)
18 * any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29
30#ifdef __KERNEL__
31
Christian Krafft0e826642007-02-14 14:09:45 +010032#define PMI_TYPE_FREQ_CHANGE 0x01
Christian Krafft4795b782008-07-16 05:51:45 +100033#define PMI_TYPE_POWER_BUTTON 0x02
Christian Krafft0e826642007-02-14 14:09:45 +010034#define PMI_READ_TYPE 0
35#define PMI_READ_DATA0 1
36#define PMI_READ_DATA1 2
37#define PMI_READ_DATA2 3
38#define PMI_WRITE_TYPE 4
39#define PMI_WRITE_DATA0 5
40#define PMI_WRITE_DATA1 6
41#define PMI_WRITE_DATA2 7
42
43#define PMI_ACK 0x80
44
45#define PMI_TIMEOUT 100
46
47typedef struct {
48 u8 type;
49 u8 data0;
50 u8 data1;
51 u8 data2;
52} pmi_message_t;
53
54struct pmi_handler {
55 struct list_head node;
56 u8 type;
Christian Krafft813f9072007-07-20 21:39:18 +020057 void (*handle_pmi_message) (pmi_message_t);
Christian Krafft0e826642007-02-14 14:09:45 +010058};
59
Christian Krafft813f9072007-07-20 21:39:18 +020060int pmi_register_handler(struct pmi_handler *);
61void pmi_unregister_handler(struct pmi_handler *);
Christian Krafft0e826642007-02-14 14:09:45 +010062
Christian Krafft813f9072007-07-20 21:39:18 +020063int pmi_send_message(pmi_message_t);
Christian Krafft0e826642007-02-14 14:09:45 +010064
65#endif /* __KERNEL__ */
66#endif /* _POWERPC_PMI_H */