/*1* IBM ASM Service Processor Device Driver2*3* This program is free software; you can redistribute it and/or modify4* it under the terms of the GNU General Public License as published by5* the Free Software Foundation; either version 2 of the License, or6* (at your option) any later version.7*8* This program is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11* GNU General Public License for more details.12*13* You should have received a copy of the GNU General Public License14* along with this program; if not, write to the Free Software15* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.16*17* Copyright (C) IBM Corporation, 200418*19* Author: Max Asb�ck <[email protected]>20*21*/2223#pragma pack(1)24struct i2o_header {25u8 version;26u8 message_flags;27u16 message_size;28u8 target;29u8 initiator_and_target;30u8 initiator;31u8 function;32u32 initiator_context;33};34#pragma pack()3536#define I2O_HEADER_TEMPLATE \37{ .version = 0x01, \38.message_flags = 0x00, \39.function = 0xFF, \40.initiator = 0x00, \41.initiator_and_target = 0x40, \42.target = 0x00, \43.initiator_context = 0x0 }4445#define I2O_MESSAGE_SIZE 0x100046#define I2O_COMMAND_SIZE (I2O_MESSAGE_SIZE - sizeof(struct i2o_header))4748#pragma pack(1)49struct i2o_message {50struct i2o_header header;51void *data;52};53#pragma pack()5455static inline unsigned short outgoing_message_size(unsigned int data_size)56{57unsigned int size;58unsigned short i2o_size;5960if (data_size > I2O_COMMAND_SIZE)61data_size = I2O_COMMAND_SIZE;6263size = sizeof(struct i2o_header) + data_size;6465i2o_size = size / sizeof(u32);6667if (size % sizeof(u32))68i2o_size++;6970return i2o_size;71}7273static inline u32 incoming_data_size(struct i2o_message *i2o_message)74{75return (sizeof(u32) * i2o_message->header.message_size);76}777879