1
linux/drivers/misc/ibmasm/i2o.h
Thomas Gleixner 1a59d1b8e0 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156
Based on 1 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license as published by
  the free software foundation either version 2 of the license or at
  your option any later version this program is distributed in the
  hope that it will be useful but without any warranty without even
  the implied warranty of merchantability or fitness for a particular
  purpose see the gnu general public license for more details you
  should have received a copy of the gnu general public license along
  with this program if not write to the free software foundation inc
  59 temple place suite 330 boston ma 02111 1307 usa

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 1334 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-30 11:26:35 -07:00

64 lines
1.3 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* IBM ASM Service Processor Device Driver
*
* Copyright (C) IBM Corporation, 2004
*
* Author: Max Asböck <amax@us.ibm.com>
*/
#pragma pack(1)
struct i2o_header {
u8 version;
u8 message_flags;
u16 message_size;
u8 target;
u8 initiator_and_target;
u8 initiator;
u8 function;
u32 initiator_context;
};
#pragma pack()
#define I2O_HEADER_TEMPLATE \
{ .version = 0x01, \
.message_flags = 0x00, \
.function = 0xFF, \
.initiator = 0x00, \
.initiator_and_target = 0x40, \
.target = 0x00, \
.initiator_context = 0x0 }
#define I2O_MESSAGE_SIZE 0x1000
#define I2O_COMMAND_SIZE (I2O_MESSAGE_SIZE - sizeof(struct i2o_header))
#pragma pack(1)
struct i2o_message {
struct i2o_header header;
void *data;
};
#pragma pack()
static inline unsigned short outgoing_message_size(unsigned int data_size)
{
unsigned int size;
unsigned short i2o_size;
if (data_size > I2O_COMMAND_SIZE)
data_size = I2O_COMMAND_SIZE;
size = sizeof(struct i2o_header) + data_size;
i2o_size = size / sizeof(u32);
if (size % sizeof(u32))
i2o_size++;
return i2o_size;
}
static inline u32 incoming_data_size(struct i2o_message *i2o_message)
{
return (sizeof(u32) * i2o_message->header.message_size);
}