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
30 * They consist of header, a command of variable length and data of
34 /* dot command types */
36 #define sp_write_next 1
38 #define sp_read_next 3
39 #define sp_command_response 4
41 #define sp_heartbeat 6
44 struct dot_command_header
{
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
;
73 return IBMASM_CMD_TIMEOUT_EXTRA
;
75 return IBMASM_CMD_TIMEOUT_NORMAL
;
78 #endif /* __DOT_COMMAND_H__ */