1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * IBM ASM Service Processor Device Driver
5 * Copyright (C) IBM Corporation, 2004
7 * Author: Max Asböck <amax@us.ibm.com>
13 #include "dot_command.h"
16 static struct i2o_header header
= I2O_HEADER_TEMPLATE
;
19 int ibmasm_send_i2o_message(struct service_processor
*sp
)
22 unsigned int command_size
;
23 struct i2o_message
*message
;
24 struct command
*command
= sp
->current_command
;
26 mfa
= get_mfa_inbound(sp
->base_address
);
30 command_size
= get_dot_command_size(command
->buffer
);
31 header
.message_size
= outgoing_message_size(command_size
);
33 message
= get_i2o_message(sp
->base_address
, mfa
);
35 memcpy_toio(&message
->header
, &header
, sizeof(struct i2o_header
));
36 memcpy_toio(&message
->data
, command
->buffer
, command_size
);
38 set_mfa_inbound(sp
->base_address
, mfa
);
43 irqreturn_t
ibmasm_interrupt_handler(int irq
, void * dev_id
)
46 struct service_processor
*sp
= (struct service_processor
*)dev_id
;
47 void __iomem
*base_address
= sp
->base_address
;
50 if (!sp_interrupt_pending(base_address
))
53 dbg("respond to interrupt at %s\n", get_timestamp(tsbuf
));
55 if (mouse_interrupt_pending(sp
)) {
56 ibmasm_handle_mouse_interrupt(sp
);
57 clear_mouse_interrupt(sp
);
60 mfa
= get_mfa_outbound(base_address
);
62 struct i2o_message
*msg
= get_i2o_message(base_address
, mfa
);
63 ibmasm_receive_message(sp
, &msg
->data
, incoming_data_size(msg
));
65 dbg("didn't get a valid MFA\n");
67 set_mfa_outbound(base_address
, mfa
);
68 dbg("finished interrupt at %s\n", get_timestamp(tsbuf
));