aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/ibmasm/i2o.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/i2o.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/i2o.h')
-rw-r--r--drivers/misc/ibmasm/i2o.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/drivers/misc/ibmasm/i2o.h b/drivers/misc/ibmasm/i2o.h
new file mode 100644
index 000000000000..958c957a5e75
--- /dev/null
+++ b/drivers/misc/ibmasm/i2o.h
@@ -0,0 +1,77 @@
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#pragma pack(1)
25struct i2o_header {
26 u8 version;
27 u8 message_flags;
28 u16 message_size;
29 u8 target;
30 u8 initiator_and_target;
31 u8 initiator;
32 u8 function;
33 u32 initiator_context;
34};
35#pragma pack()
36
37#define I2O_HEADER_TEMPLATE \
38 { .version = 0x01, \
39 .message_flags = 0x00, \
40 .function = 0xFF, \
41 .initiator = 0x00, \
42 .initiator_and_target = 0x40, \
43 .target = 0x00, \
44 .initiator_context = 0x0 }
45
46#define I2O_MESSAGE_SIZE 0x1000
47#define I2O_COMMAND_SIZE (I2O_MESSAGE_SIZE - sizeof(struct i2o_header))
48
49#pragma pack(1)
50struct i2o_message {
51 struct i2o_header header;
52 void *data;
53};
54#pragma pack()
55
56static inline unsigned short outgoing_message_size(unsigned int data_size)
57{
58 unsigned int size;
59 unsigned short i2o_size;
60
61 if (data_size > I2O_COMMAND_SIZE)
62 data_size = I2O_COMMAND_SIZE;
63
64 size = sizeof(struct i2o_header) + data_size;
65
66 i2o_size = size / sizeof(u32);
67
68 if (size % sizeof(u32))
69 i2o_size++;
70
71 return i2o_size;
72}
73
74static inline u32 incoming_data_size(struct i2o_message *i2o_message)
75{
76 return (sizeof(u32) * i2o_message->header.message_size);
77}