command.c (75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37) | command.c (b7df87cfe3d13596820afdda73338d44172a643e) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2 3/* 4 * IBM ASM Service Processor Device Driver 5 * 6 * Copyright (C) IBM Corporation, 2004 7 * 8 * Author: Max Asböck <amax@us.ibm.com> --- 80 unchanged lines hidden (view full) --- 89 if (ibmasm_send_i2o_message(sp)) { 90 sp->current_command->status = IBMASM_CMD_FAILED; 91 wake_up(&sp->current_command->wait); 92 command_put(sp->current_command); 93 exec_next_command(sp); 94 } 95} 96 | 1// SPDX-License-Identifier: GPL-2.0-or-later 2 3/* 4 * IBM ASM Service Processor Device Driver 5 * 6 * Copyright (C) IBM Corporation, 2004 7 * 8 * Author: Max Asböck <amax@us.ibm.com> --- 80 unchanged lines hidden (view full) --- 89 if (ibmasm_send_i2o_message(sp)) { 90 sp->current_command->status = IBMASM_CMD_FAILED; 91 wake_up(&sp->current_command->wait); 92 command_put(sp->current_command); 93 exec_next_command(sp); 94 } 95} 96 |
97/** | 97/* |
98 * exec_command 99 * send a command to a service processor 100 * Commands are executed sequentially. One command (sp->current_command) 101 * is sent to the service processor. Once the interrupt handler gets a 102 * message of type command_response, the message is copied into 103 * the current commands buffer, 104 */ 105void ibmasm_exec_command(struct service_processor *sp, struct command *cmd) --- 29 unchanged lines hidden (view full) --- 135 command_get(sp->current_command); 136 spin_unlock_irqrestore(&sp->lock, flags); 137 do_exec_command(sp); 138 } else { 139 spin_unlock_irqrestore(&sp->lock, flags); 140 } 141} 142 | 98 * exec_command 99 * send a command to a service processor 100 * Commands are executed sequentially. One command (sp->current_command) 101 * is sent to the service processor. Once the interrupt handler gets a 102 * message of type command_response, the message is copied into 103 * the current commands buffer, 104 */ 105void ibmasm_exec_command(struct service_processor *sp, struct command *cmd) --- 29 unchanged lines hidden (view full) --- 135 command_get(sp->current_command); 136 spin_unlock_irqrestore(&sp->lock, flags); 137 do_exec_command(sp); 138 } else { 139 spin_unlock_irqrestore(&sp->lock, flags); 140 } 141} 142 |
143/** | 143/* |
144 * Sleep until a command has failed or a response has been received 145 * and the command status been updated by the interrupt handler. 146 * (see receive_response). 147 */ 148void ibmasm_wait_for_response(struct command *cmd, int timeout) 149{ 150 wait_event_interruptible_timeout(cmd->wait, 151 cmd->status == IBMASM_CMD_COMPLETE || 152 cmd->status == IBMASM_CMD_FAILED, 153 timeout * HZ); 154} 155 | 144 * Sleep until a command has failed or a response has been received 145 * and the command status been updated by the interrupt handler. 146 * (see receive_response). 147 */ 148void ibmasm_wait_for_response(struct command *cmd, int timeout) 149{ 150 wait_event_interruptible_timeout(cmd->wait, 151 cmd->status == IBMASM_CMD_COMPLETE || 152 cmd->status == IBMASM_CMD_FAILED, 153 timeout * HZ); 154} 155 |
156/** | 156/* |
157 * receive_command_response 158 * called by the interrupt handler when a dot command of type command_response 159 * was received. 160 */ 161void ibmasm_receive_command_response(struct service_processor *sp, void *response, size_t size) 162{ 163 struct command *cmd = sp->current_command; 164 165 if (!sp->current_command) 166 return; 167 168 memcpy_fromio(cmd->buffer, response, min(size, cmd->buffer_size)); 169 cmd->status = IBMASM_CMD_COMPLETE; 170 wake_up(&sp->current_command->wait); 171 command_put(sp->current_command); 172 exec_next_command(sp); 173} | 157 * receive_command_response 158 * called by the interrupt handler when a dot command of type command_response 159 * was received. 160 */ 161void ibmasm_receive_command_response(struct service_processor *sp, void *response, size_t size) 162{ 163 struct command *cmd = sp->current_command; 164 165 if (!sp->current_command) 166 return; 167 168 memcpy_fromio(cmd->buffer, response, min(size, cmd->buffer_size)); 169 cmd->status = IBMASM_CMD_COMPLETE; 170 wake_up(&sp->current_command->wait); 171 command_put(sp->current_command); 172 exec_next_command(sp); 173} |