ibmasm.h (b8acb808468a88a188d7c5aba3681c583a5785f9) ibmasm.h (278d72ae8803ffcd16070c95fe1d53f4466dc741)
1
2/*
3 * IBM ASM Service Processor Device Driver
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

--- 20 unchanged lines hidden (view full) ---

29#include <linux/wait.h>
30#include <linux/spinlock.h>
31#include <linux/slab.h>
32#include <linux/config.h>
33#include <linux/module.h>
34#include <linux/version.h>
35#include <linux/interrupt.h>
36#include <linux/device.h>
1
2/*
3 * IBM ASM Service Processor Device Driver
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

--- 20 unchanged lines hidden (view full) ---

29#include <linux/wait.h>
30#include <linux/spinlock.h>
31#include <linux/slab.h>
32#include <linux/config.h>
33#include <linux/module.h>
34#include <linux/version.h>
35#include <linux/interrupt.h>
36#include <linux/device.h>
37#include <linux/input.h>
37
38/* Driver identification */
39#define DRIVER_NAME "ibmasm"
38
39/* Driver identification */
40#define DRIVER_NAME "ibmasm"
40#define DRIVER_VERSION "0.4"
41#define DRIVER_AUTHOR "Max Asbock"
41#define DRIVER_VERSION "1.0"
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
44#define err(msg) printk(KERN_ERR "%s: " msg "\n", DRIVER_NAME)
45#define info(msg) printk(KERN_INFO "%s: " msg "\n", DRIVER_NAME)
46
43#define DRIVER_DESC "IBM ASM Service Processor Driver"
44
45#define err(msg) printk(KERN_ERR "%s: " msg "\n", DRIVER_NAME)
46#define info(msg) printk(KERN_INFO "%s: " msg "\n", DRIVER_NAME)
47
48extern int ibmasm_debug;
49#define dbg(STR, ARGS...) \
50 do { \
51 if (ibmasm_debug) \
52 printk(KERN_DEBUG STR , ##ARGS); \
53 } while (0)
47
54
55static 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}
62
48#define IBMASM_CMD_PENDING 0
49#define IBMASM_CMD_COMPLETE 1
50#define IBMASM_CMD_FAILED 2
51
52#define IBMASM_CMD_TIMEOUT_NORMAL 45
53#define IBMASM_CMD_TIMEOUT_EXTRA 240
54
55#define IBMASM_CMD_MAX_BUFFER_SIZE 0x8000

--- 60 unchanged lines hidden (view full) ---

116 unsigned char data[IBMASM_EVENT_MAX_SIZE];
117};
118
119struct reverse_heartbeat {
120 wait_queue_head_t wait;
121 unsigned int stopped;
122};
123
63#define IBMASM_CMD_PENDING 0
64#define IBMASM_CMD_COMPLETE 1
65#define IBMASM_CMD_FAILED 2
66
67#define IBMASM_CMD_TIMEOUT_NORMAL 45
68#define IBMASM_CMD_TIMEOUT_EXTRA 240
69
70#define IBMASM_CMD_MAX_BUFFER_SIZE 0x8000

--- 60 unchanged lines hidden (view full) ---

131 unsigned char data[IBMASM_EVENT_MAX_SIZE];
132};
133
134struct reverse_heartbeat {
135 wait_queue_head_t wait;
136 unsigned int stopped;
137};
138
124
125/* remote console events */
126struct mouse_event {
127 long x;
128 long y;
129 unsigned char buttons;
130 unsigned char transitions;
139struct ibmasm_remote {
140 struct input_dev keybd_dev;
141 struct input_dev mouse_dev;
131};
132
142};
143
133struct keyboard_event {
134 unsigned long key_code;
135 unsigned char key_down;
136};
137
138struct remote_event {
139 unsigned long type;
140 union {
141 struct mouse_event mouse;
142 struct keyboard_event keyboard;
143 } data;
144};
145
146#define DRIVER_REMOTE_QUEUE_SIZE 240
147
148struct remote_queue {
149 struct remote_event *start;
150 struct remote_event *end;
151 struct remote_event *reader;
152 struct remote_event *writer;
153 unsigned int size;
154 int open;
155 wait_queue_head_t wait;
156};
157
158
159struct service_processor {
160 struct list_head node;
161 spinlock_t lock;
162 void __iomem *base_address;
163 unsigned int irq;
164 struct command *current_command;
165 struct command *heartbeat;
166 struct list_head command_queue;
167 struct event_buffer *event_buffer;
168 char dirname[IBMASM_NAME_SIZE];
169 char devname[IBMASM_NAME_SIZE];
170 unsigned int number;
144struct service_processor {
145 struct list_head node;
146 spinlock_t lock;
147 void __iomem *base_address;
148 unsigned int irq;
149 struct command *current_command;
150 struct command *heartbeat;
151 struct list_head command_queue;
152 struct event_buffer *event_buffer;
153 char dirname[IBMASM_NAME_SIZE];
154 char devname[IBMASM_NAME_SIZE];
155 unsigned int number;
171 struct remote_queue remote_queue;
156 struct ibmasm_remote *remote;
172 int serial_line;
173 struct device *dev;
174};
175
176/* command processing */
177extern struct command *ibmasm_new_command(size_t buffer_size);
178extern void ibmasm_exec_command(struct service_processor *sp, struct command *cmd);
179extern void ibmasm_wait_for_response(struct command *cmd, int timeout);

--- 25 unchanged lines hidden (view full) ---

205extern int ibmasm_send_driver_vpd(struct service_processor *sp);
206extern int ibmasm_send_os_state(struct service_processor *sp, int os_state);
207
208/* low level message processing */
209extern int ibmasm_send_i2o_message(struct service_processor *sp);
210extern irqreturn_t ibmasm_interrupt_handler(int irq, void * dev_id, struct pt_regs *regs);
211
212/* remote console */
157 int serial_line;
158 struct device *dev;
159};
160
161/* command processing */
162extern struct command *ibmasm_new_command(size_t buffer_size);
163extern void ibmasm_exec_command(struct service_processor *sp, struct command *cmd);
164extern void ibmasm_wait_for_response(struct command *cmd, int timeout);

--- 25 unchanged lines hidden (view full) ---

190extern int ibmasm_send_driver_vpd(struct service_processor *sp);
191extern int ibmasm_send_os_state(struct service_processor *sp, int os_state);
192
193/* low level message processing */
194extern int ibmasm_send_i2o_message(struct service_processor *sp);
195extern irqreturn_t ibmasm_interrupt_handler(int irq, void * dev_id, struct pt_regs *regs);
196
197/* remote console */
213extern void ibmasm_handle_mouse_interrupt(struct service_processor *sp);
214extern int ibmasm_init_remote_queue(struct service_processor *sp);
215extern void ibmasm_free_remote_queue(struct service_processor *sp);
216extern void ibmasm_advance_reader(struct remote_queue *q, unsigned int n);
217extern size_t ibmasm_events_available(struct remote_queue *q);
198extern void ibmasm_handle_mouse_interrupt(struct service_processor *sp, struct pt_regs *regs);
199extern int ibmasm_init_remote_input_dev(struct service_processor *sp);
200extern void ibmasm_free_remote_input_dev(struct service_processor *sp);
218
219/* file system */
220extern int ibmasmfs_register(void);
221extern void ibmasmfs_unregister(void);
222extern void ibmasmfs_add_sp(struct service_processor *sp);
223
224/* uart */
225#ifdef CONFIG_SERIAL_8250
226extern void ibmasm_register_uart(struct service_processor *sp);
227extern void ibmasm_unregister_uart(struct service_processor *sp);
228#else
229#define ibmasm_register_uart(sp) do { } while(0)
230#define ibmasm_unregister_uart(sp) do { } while(0)
231#endif
201
202/* file system */
203extern int ibmasmfs_register(void);
204extern void ibmasmfs_unregister(void);
205extern void ibmasmfs_add_sp(struct service_processor *sp);
206
207/* uart */
208#ifdef CONFIG_SERIAL_8250
209extern void ibmasm_register_uart(struct service_processor *sp);
210extern void ibmasm_unregister_uart(struct service_processor *sp);
211#else
212#define ibmasm_register_uart(sp) do { } while(0)
213#define ibmasm_unregister_uart(sp) do { } while(0)
214#endif