diff options
Diffstat (limited to 'drivers/misc/ibmasm/ibmasm.h')
-rw-r--r-- | drivers/misc/ibmasm/ibmasm.h | 76 |
1 files changed, 33 insertions, 43 deletions
diff --git a/drivers/misc/ibmasm/ibmasm.h b/drivers/misc/ibmasm/ibmasm.h index 6fec7fd8cd1a..ecce4ffd3e23 100644 --- a/drivers/misc/ibmasm/ibmasm.h +++ b/drivers/misc/ibmasm/ibmasm.h | |||
@@ -34,16 +34,31 @@ | |||
34 | #include <linux/version.h> | 34 | #include <linux/version.h> |
35 | #include <linux/interrupt.h> | 35 | #include <linux/interrupt.h> |
36 | #include <linux/device.h> | 36 | #include <linux/device.h> |
37 | #include <linux/input.h> | ||
37 | 38 | ||
38 | /* Driver identification */ | 39 | /* Driver identification */ |
39 | #define DRIVER_NAME "ibmasm" | 40 | #define DRIVER_NAME "ibmasm" |
40 | #define DRIVER_VERSION "0.4" | 41 | #define DRIVER_VERSION "1.0" |
41 | #define DRIVER_AUTHOR "Max Asbock" | 42 | #define DRIVER_AUTHOR "Max Asbock <masbock@us.ibm.com>, Vernon Mauery <vernux@us.ibm.com>" |
42 | #define DRIVER_DESC "IBM ASM Service Processor Driver" | 43 | #define DRIVER_DESC "IBM ASM Service Processor Driver" |
43 | 44 | ||
44 | #define err(msg) printk(KERN_ERR "%s: " msg "\n", DRIVER_NAME) | 45 | #define err(msg) printk(KERN_ERR "%s: " msg "\n", DRIVER_NAME) |
45 | #define info(msg) printk(KERN_INFO "%s: " msg "\n", DRIVER_NAME) | 46 | #define info(msg) printk(KERN_INFO "%s: " msg "\n", DRIVER_NAME) |
46 | 47 | ||
48 | extern int ibmasm_debug; | ||
49 | #define dbg(STR, ARGS...) \ | ||
50 | do { \ | ||
51 | if (ibmasm_debug) \ | ||
52 | printk(KERN_DEBUG STR , ##ARGS); \ | ||
53 | } while (0) | ||
54 | |||
55 | static inline char *get_timestamp(char *buf) | ||
56 | { | ||
57 | struct timeval now; | ||
58 | do_gettimeofday(&now); | ||
59 | sprintf(buf, "%lu.%lu", now.tv_sec, now.tv_usec); | ||
60 | return buf; | ||
61 | } | ||
47 | 62 | ||
48 | #define IBMASM_CMD_PENDING 0 | 63 | #define IBMASM_CMD_PENDING 0 |
49 | #define IBMASM_CMD_COMPLETE 1 | 64 | #define IBMASM_CMD_COMPLETE 1 |
@@ -52,7 +67,7 @@ | |||
52 | #define IBMASM_CMD_TIMEOUT_NORMAL 45 | 67 | #define IBMASM_CMD_TIMEOUT_NORMAL 45 |
53 | #define IBMASM_CMD_TIMEOUT_EXTRA 240 | 68 | #define IBMASM_CMD_TIMEOUT_EXTRA 240 |
54 | 69 | ||
55 | #define IBMASM_CMD_MAX_BUFFER_SIZE 0x4000 | 70 | #define IBMASM_CMD_MAX_BUFFER_SIZE 0x8000 |
56 | 71 | ||
57 | #define REVERSE_HEARTBEAT_TIMEOUT 120 | 72 | #define REVERSE_HEARTBEAT_TIMEOUT 120 |
58 | 73 | ||
@@ -80,12 +95,17 @@ struct command { | |||
80 | size_t buffer_size; | 95 | size_t buffer_size; |
81 | int status; | 96 | int status; |
82 | struct kobject kobj; | 97 | struct kobject kobj; |
98 | spinlock_t *lock; | ||
83 | }; | 99 | }; |
84 | #define to_command(c) container_of(c, struct command, kobj) | 100 | #define to_command(c) container_of(c, struct command, kobj) |
85 | 101 | ||
86 | static inline void command_put(struct command *cmd) | 102 | static inline void command_put(struct command *cmd) |
87 | { | 103 | { |
104 | unsigned long flags; | ||
105 | |||
106 | spin_lock_irqsave(cmd->lock, flags); | ||
88 | kobject_put(&cmd->kobj); | 107 | kobject_put(&cmd->kobj); |
108 | spin_unlock_irqrestore(cmd->lock, flags); | ||
89 | } | 109 | } |
90 | 110 | ||
91 | static inline void command_get(struct command *cmd) | 111 | static inline void command_get(struct command *cmd) |
@@ -108,6 +128,7 @@ struct event_buffer { | |||
108 | }; | 128 | }; |
109 | 129 | ||
110 | struct event_reader { | 130 | struct event_reader { |
131 | int cancelled; | ||
111 | unsigned int next_serial_number; | 132 | unsigned int next_serial_number; |
112 | wait_queue_head_t wait; | 133 | wait_queue_head_t wait; |
113 | struct list_head node; | 134 | struct list_head node; |
@@ -120,41 +141,11 @@ struct reverse_heartbeat { | |||
120 | unsigned int stopped; | 141 | unsigned int stopped; |
121 | }; | 142 | }; |
122 | 143 | ||
123 | 144 | struct ibmasm_remote { | |
124 | /* remote console events */ | 145 | struct input_dev keybd_dev; |
125 | struct mouse_event { | 146 | struct input_dev mouse_dev; |
126 | long x; | ||
127 | long y; | ||
128 | unsigned char buttons; | ||
129 | unsigned char transitions; | ||
130 | }; | ||
131 | |||
132 | struct keyboard_event { | ||
133 | unsigned long key_code; | ||
134 | unsigned char key_down; | ||
135 | }; | 147 | }; |
136 | 148 | ||
137 | struct remote_event { | ||
138 | unsigned long type; | ||
139 | union { | ||
140 | struct mouse_event mouse; | ||
141 | struct keyboard_event keyboard; | ||
142 | } data; | ||
143 | }; | ||
144 | |||
145 | #define DRIVER_REMOTE_QUEUE_SIZE 240 | ||
146 | |||
147 | struct remote_queue { | ||
148 | struct remote_event *start; | ||
149 | struct remote_event *end; | ||
150 | struct remote_event *reader; | ||
151 | struct remote_event *writer; | ||
152 | unsigned int size; | ||
153 | int open; | ||
154 | wait_queue_head_t wait; | ||
155 | }; | ||
156 | |||
157 | |||
158 | struct service_processor { | 149 | struct service_processor { |
159 | struct list_head node; | 150 | struct list_head node; |
160 | spinlock_t lock; | 151 | spinlock_t lock; |
@@ -167,13 +158,13 @@ struct service_processor { | |||
167 | char dirname[IBMASM_NAME_SIZE]; | 158 | char dirname[IBMASM_NAME_SIZE]; |
168 | char devname[IBMASM_NAME_SIZE]; | 159 | char devname[IBMASM_NAME_SIZE]; |
169 | unsigned int number; | 160 | unsigned int number; |
170 | struct remote_queue remote_queue; | 161 | struct ibmasm_remote *remote; |
171 | int serial_line; | 162 | int serial_line; |
172 | struct device *dev; | 163 | struct device *dev; |
173 | }; | 164 | }; |
174 | 165 | ||
175 | /* command processing */ | 166 | /* command processing */ |
176 | extern struct command *ibmasm_new_command(size_t buffer_size); | 167 | extern struct command *ibmasm_new_command(struct service_processor *sp, size_t buffer_size); |
177 | extern void ibmasm_exec_command(struct service_processor *sp, struct command *cmd); | 168 | extern void ibmasm_exec_command(struct service_processor *sp, struct command *cmd); |
178 | extern void ibmasm_wait_for_response(struct command *cmd, int timeout); | 169 | extern void ibmasm_wait_for_response(struct command *cmd, int timeout); |
179 | extern void ibmasm_receive_command_response(struct service_processor *sp, void *response, size_t size); | 170 | extern void ibmasm_receive_command_response(struct service_processor *sp, void *response, size_t size); |
@@ -185,6 +176,7 @@ extern void ibmasm_receive_event(struct service_processor *sp, void *data, unsi | |||
185 | extern void ibmasm_event_reader_register(struct service_processor *sp, struct event_reader *reader); | 176 | extern void ibmasm_event_reader_register(struct service_processor *sp, struct event_reader *reader); |
186 | extern void ibmasm_event_reader_unregister(struct service_processor *sp, struct event_reader *reader); | 177 | extern void ibmasm_event_reader_unregister(struct service_processor *sp, struct event_reader *reader); |
187 | extern int ibmasm_get_next_event(struct service_processor *sp, struct event_reader *reader); | 178 | extern int ibmasm_get_next_event(struct service_processor *sp, struct event_reader *reader); |
179 | extern void ibmasm_cancel_next_event(struct event_reader *reader); | ||
188 | 180 | ||
189 | /* heartbeat - from SP to OS */ | 181 | /* heartbeat - from SP to OS */ |
190 | extern void ibmasm_register_panic_notifier(void); | 182 | extern void ibmasm_register_panic_notifier(void); |
@@ -208,11 +200,9 @@ extern int ibmasm_send_i2o_message(struct service_processor *sp); | |||
208 | extern irqreturn_t ibmasm_interrupt_handler(int irq, void * dev_id, struct pt_regs *regs); | 200 | extern irqreturn_t ibmasm_interrupt_handler(int irq, void * dev_id, struct pt_regs *regs); |
209 | 201 | ||
210 | /* remote console */ | 202 | /* remote console */ |
211 | extern void ibmasm_handle_mouse_interrupt(struct service_processor *sp); | 203 | extern void ibmasm_handle_mouse_interrupt(struct service_processor *sp, struct pt_regs *regs); |
212 | extern int ibmasm_init_remote_queue(struct service_processor *sp); | 204 | extern int ibmasm_init_remote_input_dev(struct service_processor *sp); |
213 | extern void ibmasm_free_remote_queue(struct service_processor *sp); | 205 | extern void ibmasm_free_remote_input_dev(struct service_processor *sp); |
214 | extern void ibmasm_advance_reader(struct remote_queue *q, unsigned int n); | ||
215 | extern size_t ibmasm_events_available(struct remote_queue *q); | ||
216 | 206 | ||
217 | /* file system */ | 207 | /* file system */ |
218 | extern int ibmasmfs_register(void); | 208 | extern int ibmasmfs_register(void); |