1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include "ibmasm.h"
25#include "lowlevel.h"
26#include "i2o.h"
27#include "dot_command.h"
28#include "remote.h"
29
30static struct i2o_header header = I2O_HEADER_TEMPLATE;
31
32
33int ibmasm_send_i2o_message(struct service_processor *sp)
34{
35 u32 mfa;
36 unsigned int command_size;
37 struct i2o_message *message;
38 struct command *command = sp->current_command;
39
40 mfa = get_mfa_inbound(sp->base_address);
41 if (!mfa)
42 return 1;
43
44 command_size = get_dot_command_size(command->buffer);
45 header.message_size = outgoing_message_size(command_size);
46
47 message = get_i2o_message(sp->base_address, mfa);
48
49 memcpy_toio(&message->header, &header, sizeof(struct i2o_header));
50 memcpy_toio(&message->data, command->buffer, command_size);
51
52 set_mfa_inbound(sp->base_address, mfa);
53
54 return 0;
55}
56
57irqreturn_t ibmasm_interrupt_handler(int irq, void * dev_id)
58{
59 u32 mfa;
60 struct service_processor *sp = (struct service_processor *)dev_id;
61 void __iomem *base_address = sp->base_address;
62 char tsbuf[32];
63
64 if (!sp_interrupt_pending(base_address))
65 return IRQ_NONE;
66
67 dbg("respond to interrupt at %s\n", get_timestamp(tsbuf));
68
69 if (mouse_interrupt_pending(sp)) {
70 ibmasm_handle_mouse_interrupt(sp);
71 clear_mouse_interrupt(sp);
72 }
73
74 mfa = get_mfa_outbound(base_address);
75 if (valid_mfa(mfa)) {
76 struct i2o_message *msg = get_i2o_message(base_address, mfa);
77 ibmasm_receive_message(sp, &msg->data, incoming_data_size(msg));
78 } else
79 dbg("didn't get a valid MFA\n");
80
81 set_mfa_outbound(base_address, mfa);
82 dbg("finished interrupt at %s\n", get_timestamp(tsbuf));
83
84 return IRQ_HANDLED;
85}
86