aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/ibmasm/dot_command.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/misc/ibmasm/dot_command.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/misc/ibmasm/dot_command.h')
-rw-r--r--drivers/misc/ibmasm/dot_command.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/drivers/misc/ibmasm/dot_command.h b/drivers/misc/ibmasm/dot_command.h
new file mode 100644
index 000000000000..2d21c2741b6a
--- /dev/null
+++ b/drivers/misc/ibmasm/dot_command.h
@@ -0,0 +1,78 @@
1/*
2 * IBM ASM Service Processor Device Driver
3 *
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.
8 *
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.
13 *
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.
17 *
18 * Copyright (C) IBM Corporation, 2004
19 *
20 * Author: Max Asböck <amax@us.ibm.com>
21 *
22 */
23
24#ifndef __DOT_COMMAND_H__
25#define __DOT_COMMAND_H__
26
27/*
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.
32 */
33
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
42
43#pragma pack(1)
44struct dot_command_header {
45 u8 type;
46 u8 command_size;
47 u16 data_size;
48 u8 status;
49 u8 reserved;
50};
51#pragma pack()
52
53static inline size_t get_dot_command_size(void *buffer)
54{
55 struct dot_command_header *cmd = (struct dot_command_header *)buffer;
56 return sizeof(struct dot_command_header) + cmd->command_size + cmd->data_size;
57}
58
59static inline unsigned int get_dot_command_timeout(void *buffer)
60{
61 struct dot_command_header *header = (struct dot_command_header *)buffer;
62 unsigned char *cmd = buffer + sizeof(struct dot_command_header);
63
64 /* dot commands 6.3.1, 7.1 and 8.x need a longer timeout */
65
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;
74 }
75 return IBMASM_CMD_TIMEOUT_NORMAL;
76}
77
78#endif /* __DOT_COMMAND_H__ */