Path: blob/master/drivers/misc/ibmasm/dot_command.h
17308 views
/*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#ifndef __DOT_COMMAND_H__24#define __DOT_COMMAND_H__2526/*27* dot commands are the protocol used to communicate with the service28* processor.29* They consist of header, a command of variable length and data of30* variable length.31*/3233/* dot command types */34#define sp_write 035#define sp_write_next 136#define sp_read 237#define sp_read_next 338#define sp_command_response 439#define sp_event 540#define sp_heartbeat 64142#pragma pack(1)43struct dot_command_header {44u8 type;45u8 command_size;46u16 data_size;47u8 status;48u8 reserved;49};50#pragma pack()5152static inline size_t get_dot_command_size(void *buffer)53{54struct dot_command_header *cmd = (struct dot_command_header *)buffer;55return sizeof(struct dot_command_header) + cmd->command_size + cmd->data_size;56}5758static inline unsigned int get_dot_command_timeout(void *buffer)59{60struct dot_command_header *header = (struct dot_command_header *)buffer;61unsigned char *cmd = buffer + sizeof(struct dot_command_header);6263/* dot commands 6.3.1, 7.1 and 8.x need a longer timeout */6465if (header->command_size == 3) {66if ((cmd[0] == 6) && (cmd[1] == 3) && (cmd[2] == 1))67return IBMASM_CMD_TIMEOUT_EXTRA;68} else if (header->command_size == 2) {69if ((cmd[0] == 7) && (cmd[1] == 1))70return IBMASM_CMD_TIMEOUT_EXTRA;71if (cmd[0] == 8)72return IBMASM_CMD_TIMEOUT_EXTRA;73}74return IBMASM_CMD_TIMEOUT_NORMAL;75}7677#endif /* __DOT_COMMAND_H__ */787980