Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
ibmasm.h File Reference
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/list.h>
#include <linux/wait.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/kref.h>
#include <linux/device.h>
#include <linux/input.h>

Go to the source code of this file.

Data Structures

struct  command
 
struct  ibmasm_event
 
struct  event_buffer
 
struct  event_reader
 
struct  reverse_heartbeat
 
struct  ibmasm_remote
 
struct  service_processor
 

Macros

#define DRIVER_NAME   "ibmasm"
 
#define DRIVER_VERSION   "1.0"
 
#define DRIVER_AUTHOR   "Max Asbock <[email protected]>, Vernon Mauery <[email protected]>"
 
#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)
 
#define dbg(STR, ARGS...)
 
#define IBMASM_CMD_PENDING   0
 
#define IBMASM_CMD_COMPLETE   1
 
#define IBMASM_CMD_FAILED   2
 
#define IBMASM_CMD_TIMEOUT_NORMAL   45
 
#define IBMASM_CMD_TIMEOUT_EXTRA   240
 
#define IBMASM_CMD_MAX_BUFFER_SIZE   0x8000
 
#define REVERSE_HEARTBEAT_TIMEOUT   120
 
#define HEARTBEAT_BUFFER_SIZE   0x400
 
#define IBMASM_DRIVER_VPD   "Lin32 6.08 "
 
#define SYSTEM_STATE_OS_UP   5
 
#define SYSTEM_STATE_OS_DOWN   4
 
#define IBMASM_NAME_SIZE   16
 
#define IBMASM_NUM_EVENTS   10
 
#define IBMASM_EVENT_MAX_SIZE   2048u
 
#define to_command(c)   container_of(c, struct command, kref)
 
#define ibmasm_register_uart(sp)   do { } while(0)
 
#define ibmasm_unregister_uart(sp)   do { } while(0)
 

Functions

void ibmasm_free_command (struct kref *kref)
 
struct commandibmasm_new_command (struct service_processor *sp, size_t buffer_size)
 
void ibmasm_exec_command (struct service_processor *sp, struct command *cmd)
 
void ibmasm_wait_for_response (struct command *cmd, int timeout)
 
void ibmasm_receive_command_response (struct service_processor *sp, void *response, size_t size)
 
int ibmasm_event_buffer_init (struct service_processor *sp)
 
void ibmasm_event_buffer_exit (struct service_processor *sp)
 
void ibmasm_receive_event (struct service_processor *sp, void *data, unsigned int data_size)
 
void ibmasm_event_reader_register (struct service_processor *sp, struct event_reader *reader)
 
void ibmasm_event_reader_unregister (struct service_processor *sp, struct event_reader *reader)
 
int ibmasm_get_next_event (struct service_processor *sp, struct event_reader *reader)
 
void ibmasm_cancel_next_event (struct event_reader *reader)
 
void ibmasm_register_panic_notifier (void)
 
void ibmasm_unregister_panic_notifier (void)
 
int ibmasm_heartbeat_init (struct service_processor *sp)
 
void ibmasm_heartbeat_exit (struct service_processor *sp)
 
void ibmasm_receive_heartbeat (struct service_processor *sp, void *message, size_t size)
 
void ibmasm_init_reverse_heartbeat (struct service_processor *sp, struct reverse_heartbeat *rhb)
 
int ibmasm_start_reverse_heartbeat (struct service_processor *sp, struct reverse_heartbeat *rhb)
 
void ibmasm_stop_reverse_heartbeat (struct reverse_heartbeat *rhb)
 
void ibmasm_receive_message (struct service_processor *sp, void *data, int data_size)
 
int ibmasm_send_driver_vpd (struct service_processor *sp)
 
int ibmasm_send_os_state (struct service_processor *sp, int os_state)
 
int ibmasm_send_i2o_message (struct service_processor *sp)
 
irqreturn_t ibmasm_interrupt_handler (int irq, void *dev_id)
 
void ibmasm_handle_mouse_interrupt (struct service_processor *sp)
 
int ibmasm_init_remote_input_dev (struct service_processor *sp)
 
void ibmasm_free_remote_input_dev (struct service_processor *sp)
 
int ibmasmfs_register (void)
 
void ibmasmfs_unregister (void)
 
void ibmasmfs_add_sp (struct service_processor *sp)
 

Variables

int ibmasm_debug
 

Macro Definition Documentation

#define dbg (   STR,
  ARGS... 
)
Value:
do { \
if (ibmasm_debug) \
printk(KERN_DEBUG STR , ##ARGS); \
} while (0)

Definition at line 48 of file ibmasm.h.

#define DRIVER_AUTHOR   "Max Asbock <[email protected]>, Vernon Mauery <[email protected]>"

Definition at line 41 of file ibmasm.h.

#define DRIVER_DESC   "IBM ASM Service Processor Driver"

Definition at line 42 of file ibmasm.h.

#define DRIVER_NAME   "ibmasm"

Definition at line 39 of file ibmasm.h.

#define DRIVER_VERSION   "1.0"

Definition at line 40 of file ibmasm.h.

#define err (   msg)    printk(KERN_ERR "%s: " msg "\n", DRIVER_NAME)

Definition at line 44 of file ibmasm.h.

#define HEARTBEAT_BUFFER_SIZE   0x400

Definition at line 73 of file ibmasm.h.

#define IBMASM_CMD_COMPLETE   1

Definition at line 63 of file ibmasm.h.

#define IBMASM_CMD_FAILED   2

Definition at line 64 of file ibmasm.h.

#define IBMASM_CMD_MAX_BUFFER_SIZE   0x8000

Definition at line 69 of file ibmasm.h.

#define IBMASM_CMD_PENDING   0

Definition at line 62 of file ibmasm.h.

#define IBMASM_CMD_TIMEOUT_EXTRA   240

Definition at line 67 of file ibmasm.h.

#define IBMASM_CMD_TIMEOUT_NORMAL   45

Definition at line 66 of file ibmasm.h.

#define IBMASM_DRIVER_VPD   "Lin32 6.08 "

Definition at line 78 of file ibmasm.h.

#define IBMASM_EVENT_MAX_SIZE   2048u

Definition at line 87 of file ibmasm.h.

#define IBMASM_NAME_SIZE   16

Definition at line 84 of file ibmasm.h.

#define IBMASM_NUM_EVENTS   10

Definition at line 86 of file ibmasm.h.

#define ibmasm_register_uart (   sp)    do { } while(0)

Definition at line 218 of file ibmasm.h.

#define ibmasm_unregister_uart (   sp)    do { } while(0)

Definition at line 219 of file ibmasm.h.

#define info (   msg)    printk(KERN_INFO "%s: " msg "\n", DRIVER_NAME)

Definition at line 45 of file ibmasm.h.

#define REVERSE_HEARTBEAT_TIMEOUT   120

Definition at line 71 of file ibmasm.h.

#define SYSTEM_STATE_OS_DOWN   4

Definition at line 82 of file ibmasm.h.

#define SYSTEM_STATE_OS_UP   5

Definition at line 81 of file ibmasm.h.

#define to_command (   c)    container_of(c, struct command, kref)

Definition at line 99 of file ibmasm.h.

Function Documentation

void ibmasm_cancel_next_event ( struct event_reader reader)

Definition at line 124 of file event.c.

void ibmasm_event_buffer_exit ( struct service_processor sp)

Definition at line 174 of file event.c.

int ibmasm_event_buffer_init ( struct service_processor sp)

Definition at line 150 of file event.c.

void ibmasm_event_reader_register ( struct service_processor sp,
struct event_reader reader 
)

Definition at line 130 of file event.c.

void ibmasm_event_reader_unregister ( struct service_processor sp,
struct event_reader reader 
)

Definition at line 141 of file event.c.

void ibmasm_exec_command ( struct service_processor sp,
struct command cmd 
)

exec_command send a command to a service processor Commands are executed sequentially. One command (sp->current_command) is sent to the service processor. Once the interrupt handler gets a message of type command_response, the message is copied into the current commands buffer,

Definition at line 119 of file command.c.

void ibmasm_free_command ( struct kref kref)

Definition at line 66 of file command.c.

void ibmasm_free_remote_input_dev ( struct service_processor sp)

Definition at line 276 of file remote.c.

int ibmasm_get_next_event ( struct service_processor sp,
struct event_reader reader 
)

get_next_event Called by event readers (initiated from user space through the file system). Sleeps until a new event is available.

Definition at line 91 of file event.c.

void ibmasm_handle_mouse_interrupt ( struct service_processor sp)

Definition at line 184 of file remote.c.

void ibmasm_heartbeat_exit ( struct service_processor sp)

Definition at line 74 of file heartbeat.c.

int ibmasm_heartbeat_init ( struct service_processor sp)

Definition at line 65 of file heartbeat.c.

int ibmasm_init_remote_input_dev ( struct service_processor sp)

Definition at line 210 of file remote.c.

void ibmasm_init_reverse_heartbeat ( struct service_processor sp,
struct reverse_heartbeat rhb 
)

Definition at line 49 of file r_heartbeat.c.

irqreturn_t ibmasm_interrupt_handler ( int  irq,
void dev_id 
)

Definition at line 57 of file lowlevel.c.

struct command* ibmasm_new_command ( struct service_processor sp,
size_t  buffer_size 
)
read

Definition at line 34 of file command.c.

void ibmasm_receive_command_response ( struct service_processor sp,
void response,
size_t  size 
)

receive_command_response called by the interrupt handler when a dot command of type command_response was received.

Definition at line 175 of file command.c.

void ibmasm_receive_event ( struct service_processor sp,
void data,
unsigned int  data_size 
)

receive_event Called by the interrupt handler when a dot command of type sp_event is received. Store the event in the circular event buffer, wake up any sleeping event readers. There is no reader marker in the buffer, therefore readers are responsible for keeping up with the writer, or they will lose events.

Definition at line 57 of file event.c.

void ibmasm_receive_heartbeat ( struct service_processor sp,
void message,
size_t  size 
)

Definition at line 85 of file heartbeat.c.

void ibmasm_receive_message ( struct service_processor sp,
void message,
int  message_size 
)

Dispatch an incoming message to the specific handler for the message. Called from interrupt context.

Definition at line 31 of file dot_command.c.

void ibmasm_register_panic_notifier ( void  )

Definition at line 53 of file heartbeat.c.

int ibmasm_send_driver_vpd ( struct service_processor sp)

send the 4.3.5.10 dot command (driver VPD) to the service processor

Definition at line 68 of file dot_command.c.

int ibmasm_send_i2o_message ( struct service_processor sp)

Definition at line 33 of file lowlevel.c.

int ibmasm_send_os_state ( struct service_processor sp,
int  os_state 
)

send the 4.3.6 dot command (os state) to the service processor During driver init this function is called with os state "up". This causes the service processor to start sending heartbeats the driver. During driver exit the function is called with os state "down", causing the service processor to stop the heartbeats.

Definition at line 124 of file dot_command.c.

int ibmasm_start_reverse_heartbeat ( struct service_processor sp,
struct reverse_heartbeat rhb 
)

start_reverse_heartbeat Loop forever, sending a reverse heartbeat dot command to the service processor, then sleeping. The loop comes to an end if the service processor fails to respond 3 times or we were interrupted.

Definition at line 61 of file r_heartbeat.c.

void ibmasm_stop_reverse_heartbeat ( struct reverse_heartbeat rhb)

Definition at line 95 of file r_heartbeat.c.

void ibmasm_unregister_panic_notifier ( void  )

Definition at line 58 of file heartbeat.c.

void ibmasm_wait_for_response ( struct command cmd,
int  timeout 
)

Sleep until a command has failed or a response has been received and the command status been updated by the interrupt handler. (see receive_response).

Definition at line 162 of file command.c.

void ibmasmfs_add_sp ( struct service_processor sp)

Definition at line 212 of file ibmasmfs.c.

int ibmasmfs_register ( void  )

Definition at line 202 of file ibmasmfs.c.

void ibmasmfs_unregister ( void  )

Definition at line 207 of file ibmasmfs.c.

Variable Documentation

int ibmasm_debug

Definition at line 60 of file module.c.