]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/misc/ibmasm/ibmasm.h
[SERIAL] Update ibmasm driver for death of register_serial&co
[linux-2.6-omap-h63xx.git] / drivers / misc / ibmasm / ibmasm.h
index 35c4def5af184271be8a75225daee59bc0115389..ecce4ffd3e23f21877df72759efba566c30e1bfe 100644 (file)
 #include <linux/version.h>
 #include <linux/interrupt.h>
 #include <linux/device.h>
+#include <linux/input.h>
 
 /* Driver identification */
 #define DRIVER_NAME    "ibmasm"
-#define DRIVER_VERSION  "0.4"
-#define DRIVER_AUTHOR   "Max Asbock"
+#define DRIVER_VERSION  "1.0"
+#define DRIVER_AUTHOR   "Max Asbock <masbock@us.ibm.com>, Vernon Mauery <vernux@us.ibm.com>"
 #define DRIVER_DESC     "IBM ASM Service Processor Driver"
 
 #define err(msg) printk(KERN_ERR "%s: " msg "\n", DRIVER_NAME)
 #define info(msg) printk(KERN_INFO "%s: " msg "\n", DRIVER_NAME)
 
+extern int ibmasm_debug;
+#define dbg(STR, ARGS...)                                      \
+       do {                                                    \
+               if (ibmasm_debug)                               \
+                       printk(KERN_DEBUG STR , ##ARGS);        \
+       } while (0)
+
+static inline char *get_timestamp(char *buf)
+{
+       struct timeval now;
+       do_gettimeofday(&now);
+       sprintf(buf, "%lu.%lu", now.tv_sec, now.tv_usec);
+       return buf;
+}
 
 #define IBMASM_CMD_PENDING     0       
 #define IBMASM_CMD_COMPLETE    1       
@@ -80,12 +95,17 @@ struct command {
        size_t                  buffer_size;
        int                     status;
        struct kobject          kobj;
+       spinlock_t              *lock;
 };
 #define to_command(c) container_of(c, struct command, kobj)
 
 static inline void command_put(struct command *cmd)
 {
+       unsigned long flags;
+
+       spin_lock_irqsave(cmd->lock, flags);
         kobject_put(&cmd->kobj);
+       spin_unlock_irqrestore(cmd->lock, flags);
 }
 
 static inline void command_get(struct command *cmd)
@@ -121,41 +141,11 @@ struct reverse_heartbeat {
        unsigned int            stopped;
 };
 
-
-/* remote console events */
-struct mouse_event {
-       long            x;
-       long            y;
-       unsigned char   buttons;
-       unsigned char   transitions;
-};
-
-struct keyboard_event {
-       unsigned long   key_code;
-       unsigned char   key_down;
+struct ibmasm_remote {
+       struct input_dev keybd_dev;
+       struct input_dev mouse_dev;
 };
 
-struct remote_event {
-       unsigned long   type;
-       union {
-               struct mouse_event      mouse;
-               struct keyboard_event   keyboard;
-       } data;
-};
-
-#define DRIVER_REMOTE_QUEUE_SIZE 240
-
-struct remote_queue {
-       struct remote_event     *start;
-       struct remote_event     *end;
-       struct remote_event     *reader;
-       struct remote_event     *writer;
-       unsigned int            size;
-       int                     open;
-       wait_queue_head_t       wait;
-};
-
-
 struct service_processor {
        struct list_head        node;
        spinlock_t              lock;
@@ -168,13 +158,13 @@ struct service_processor {
        char                    dirname[IBMASM_NAME_SIZE];
        char                    devname[IBMASM_NAME_SIZE];
        unsigned int            number;
-       struct remote_queue     remote_queue;
+       struct ibmasm_remote    *remote;
        int                     serial_line;
        struct device           *dev;
 };
 
 /* command processing */
-extern struct command *ibmasm_new_command(size_t buffer_size);
+extern struct command *ibmasm_new_command(struct service_processor *sp, size_t buffer_size);
 extern void ibmasm_exec_command(struct service_processor *sp, struct command *cmd);
 extern void ibmasm_wait_for_response(struct command *cmd, int timeout);
 extern void ibmasm_receive_command_response(struct service_processor *sp, void *response,  size_t size);
@@ -210,11 +200,9 @@ extern int ibmasm_send_i2o_message(struct service_processor *sp);
 extern irqreturn_t ibmasm_interrupt_handler(int irq, void * dev_id, struct pt_regs *regs);
 
 /* remote console */
-extern void ibmasm_handle_mouse_interrupt(struct service_processor *sp);
-extern int ibmasm_init_remote_queue(struct service_processor *sp);
-extern void ibmasm_free_remote_queue(struct service_processor *sp);
-extern void ibmasm_advance_reader(struct remote_queue *q, unsigned int n);
-extern size_t ibmasm_events_available(struct remote_queue *q);
+extern void ibmasm_handle_mouse_interrupt(struct service_processor *sp, struct pt_regs *regs);
+extern int ibmasm_init_remote_input_dev(struct service_processor *sp);
+extern void ibmasm_free_remote_input_dev(struct service_processor *sp);
 
 /* file system */
 extern int ibmasmfs_register(void);