x86: fix fault_msg nul termination
[linux/fpc-iii.git] / drivers / misc / ibmasm / dot_command.h
blob6cbba1afef35d7541bb70a122457670740b9367c
1 /*
2 * IBM ASM Service Processor Device Driver
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 * Copyright (C) IBM Corporation, 2004
20 * Author: Max Asböck <amax@us.ibm.com>
24 #ifndef __DOT_COMMAND_H__
25 #define __DOT_COMMAND_H__
28 * dot commands are the protocol used to communicate with the service
29 * processor.
30 * They consist of header, a command of variable length and data of
31 * variable length.
34 /* dot command types */
35 #define sp_write 0
36 #define sp_write_next 1
37 #define sp_read 2
38 #define sp_read_next 3
39 #define sp_command_response 4
40 #define sp_event 5
41 #define sp_heartbeat 6
43 #pragma pack(1)
44 struct dot_command_header {
45 u8 type;
46 u8 command_size;
47 u16 data_size;
48 u8 status;
49 u8 reserved;
51 #pragma pack()
53 static inline size_t get_dot_command_size(void *buffer)
55 struct dot_command_header *cmd = (struct dot_command_header *)buffer;
56 return sizeof(struct dot_command_header) + cmd->command_size + cmd->data_size;
59 static inline unsigned int get_dot_command_timeout(void *buffer)
61 struct dot_command_header *header = (struct dot_command_header *)buffer;
62 unsigned char *cmd = buffer + sizeof(struct dot_command_header);
64 /* dot commands 6.3.1, 7.1 and 8.x need a longer timeout */
66 if (header->command_size == 3) {
67 if ((cmd[0] == 6) && (cmd[1] == 3) && (cmd[2] == 1))
68 return IBMASM_CMD_TIMEOUT_EXTRA;
69 } else if (header->command_size == 2) {
70 if ((cmd[0] == 7) && (cmd[1] == 1))
71 return IBMASM_CMD_TIMEOUT_EXTRA;
72 if (cmd[0] == 8)
73 return IBMASM_CMD_TIMEOUT_EXTRA;
75 return IBMASM_CMD_TIMEOUT_NORMAL;
78 #endif /* __DOT_COMMAND_H__ */