1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * IBM ASM Service Processor Device Driver
5 * Copyright (C) IBM Corporation, 2004
7 * Author: Max Asböck <amax@us.ibm.com>
10 #ifndef __DOT_COMMAND_H__
11 #define __DOT_COMMAND_H__
14 * dot commands are the protocol used to communicate with the service
16 * They consist of header, a command of variable length and data of
20 /* dot command types */
22 #define sp_write_next 1
24 #define sp_read_next 3
25 #define sp_command_response 4
27 #define sp_heartbeat 6
30 struct dot_command_header
{
39 static inline size_t get_dot_command_size(void *buffer
)
41 struct dot_command_header
*cmd
= (struct dot_command_header
*)buffer
;
42 return sizeof(struct dot_command_header
) + cmd
->command_size
+ cmd
->data_size
;
45 static inline unsigned int get_dot_command_timeout(void *buffer
)
47 struct dot_command_header
*header
= (struct dot_command_header
*)buffer
;
48 unsigned char *cmd
= buffer
+ sizeof(struct dot_command_header
);
50 /* dot commands 6.3.1, 7.1 and 8.x need a longer timeout */
52 if (header
->command_size
== 3) {
53 if ((cmd
[0] == 6) && (cmd
[1] == 3) && (cmd
[2] == 1))
54 return IBMASM_CMD_TIMEOUT_EXTRA
;
55 } else if (header
->command_size
== 2) {
56 if ((cmd
[0] == 7) && (cmd
[1] == 1))
57 return IBMASM_CMD_TIMEOUT_EXTRA
;
59 return IBMASM_CMD_TIMEOUT_EXTRA
;
61 return IBMASM_CMD_TIMEOUT_NORMAL
;
64 #endif /* __DOT_COMMAND_H__ */