Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

hwc_rw.c File Reference

#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/ctype.h>
#include <linux/mm.h>
#include <linux/timer.h>
#include <asm/ebcdic.h>
#include <asm/uaccess.h>
#include <asm/types.h>
#include <asm/bitops.h>
#include <asm/setup.h>
#include <asm/page.h>
#include <asm/s390_ext.h>
#include <asm/irq.h>
#include "hwc.h"
#include "hwc_rw.h"

Include dependency graph for hwc_rw.c:

Go to the source code of this file.

Data Structures

struct  __attribute__

Defines

#define MIN(a, b)   (((a<b) ? a : b))
#define HWC_ASCEBC(x)   ((MACHINE_IS_VM ? _ascebc[x] : _ascebc_500[x]))
#define HWC_EBCASC_STR(s, c)   ((MACHINE_IS_VM ? EBCASC(s,c) : EBCASC_500(s,c)))
#define HWC_RW_PRINT_HEADER   "hwc low level driver: "
#define USE_VM_DETECTION
#define DEFAULT_CASE_DELIMITER   '%'
#define DUMP_HWC_INIT_ERROR
#define DUMP_HWC_WRITE_ERROR
#define DUMP_HWC_WRITE_LIST_ERROR
#define DUMP_HWC_READ_ERROR
#define MAX_HWCB_ROOM   (PAGE_SIZE - sizeof(hwcb_list_t))
#define MAX_MESSAGE_SIZE   (MAX_HWCB_ROOM - sizeof(write_hwcb_t))
#define BUF_HWCB   hwc_data.hwcb_list_tail
#define OUT_HWCB   hwc_data.hwcb_list_head
#define ALL_HWCB_MTO   hwc_data.mto_number
#define ALL_HWCB_CHAR   hwc_data.mto_char_sum
#define _LIST(hwcb)   ((hwcb_list_t*)(&(hwcb)[PAGE_SIZE-sizeof(hwcb_list_t)]))
#define _HWCB_CHAR(hwcb)   (_LIST(hwcb)->mto_char_sum)
#define _HWCB_MTO(hwcb)   (_LIST(hwcb)->mto_number)
#define _HWCB_CHAR_LOST(hwcb)   (_LIST(hwcb)->mto_char_sum_lost)
#define _HWCB_MTO_LOST(hwcb)   (_LIST(hwcb)->mto_number_lost)
#define _HWCB_TIMES_LOST(hwcb)   (_LIST(hwcb)->times_lost)
#define _HWCB_NEXT(hwcb)   (_LIST(hwcb)->next)
#define BUF_HWCB_CHAR   _HWCB_CHAR(BUF_HWCB)
#define BUF_HWCB_MTO   _HWCB_MTO(BUF_HWCB)
#define BUF_HWCB_NEXT   _HWCB_NEXT(BUF_HWCB)
#define OUT_HWCB_CHAR   _HWCB_CHAR(OUT_HWCB)
#define OUT_HWCB_MTO   _HWCB_MTO(OUT_HWCB)
#define OUT_HWCB_NEXT   _HWCB_NEXT(OUT_HWCB)
#define BUF_HWCB_CHAR_LOST   _HWCB_CHAR_LOST(BUF_HWCB)
#define BUF_HWCB_MTO_LOST   _HWCB_MTO_LOST(BUF_HWCB)
#define OUT_HWCB_CHAR_LOST   _HWCB_CHAR_LOST(OUT_HWCB)
#define OUT_HWCB_MTO_LOST   _HWCB_MTO_LOST(OUT_HWCB)
#define BUF_HWCB_TIMES_LOST   _HWCB_TIMES_LOST(BUF_HWCB)
#define __HWC_RW_C__
#define MAX_KMEM_PAGES   (sizeof(kmem_pages_t) << 3)
#define HWC_WTIMER_RUNS   1
#define HWC_FLUSH   2
#define HWC_INIT   4
#define HWC_BROKEN   8
#define HWC_INTERRUPT   16
#define HWC_PTIMER_RUNS   32
#define DELAYED_WRITE   0
#define IMMEDIATE_WRITE   1

Typedefs

typedef unsigned long kmem_pages_t

Functions

static unsigned char _page[PAGE_SIZE__attribute__ ((aligned(PAGE_SIZE)))
static unsigned long cr0 __attribute__ ((aligned(8)))
static signed int do_hwc_write (int from_user, unsigned char *, unsigned int, unsigned char)
static asmlinkage int internal_print (char write_time, char *fmt,...)
int hwc_printk (const char *fmt,...)
static u32 service_call (u32 hwc_command_word, unsigned char hwcb[])
static unsigned long hwc_ext_int_param (void)
static int prepare_write_hwcb (void)
static int sane_write_hwcb (void)
static int reuse_write_hwcb (void)
static int allocate_write_hwcb (void)
static int release_write_hwcb (void)
static int add_mto (unsigned char *message, unsigned short int count)
static int write_event_data_1 (void)
static void do_poll_hwc (unsigned long data)
void start_poll_hwc (void)
static void flush_hwcbs (void)
static int write_event_data_2 (u32 ext_int_param)
static void do_put_line (unsigned char *message, unsigned short count)
static void put_line (unsigned char *message, unsigned short count)
static void set_alarm (void)
static void hwc_write_timeout (unsigned long data)
signed int hwc_write (int from_user, const unsigned char *msg, unsigned int count)
unsigned int hwc_chars_in_buffer (unsigned char flag)
static int nr_setbits (kmem_pages_t arg)
unsigned int hwc_write_room (unsigned char flag)
void hwc_flush_buffer (unsigned char flag)
unsigned short int seperate_cases (unsigned char *buf, unsigned short int count)
static gds_vector_t * find_gds_vector (gds_vector_t *start, void *end, u16 id)
static gds_subvector_t * find_gds_subvector (gds_subvector_t *start, void *end, u8 key)
static int get_input (void *start, void *end)
static int eval_selfdeftextmsg (gds_subvector_t *start, void *end)
static int eval_textcmd (gds_subvector_t *start, void *end)
static int eval_cpmsu (gds_vector_t *start, void *end)
static int eval_mdsmu (gds_vector_t *start, void *end)
static int eval_evbuf (gds_vector_t *start, void *end)
static int eval_hwc_receive_mask (_hwcb_mask_t mask)
static int eval_hwc_send_mask (_hwcb_mask_t mask)
static int eval_statechangebuf (statechangebuf_t *scbuf)
static int process_evbufs (void *start, void *end)
static int unconditional_read_1 (void)
static int unconditional_read_2 (u32 ext_int_param)
static int write_event_mask_1 (void)
static int write_event_mask_2 (u32 ext_int_param)
static int set_hwc_ioctls (hwc_ioctls_t *ioctls, char correct)
int do_hwc_init (void)
void hwc_interrupt_handler (struct pt_regs *regs, __u16 code)
int hwc_init (unsigned long *kmem_start)
signed int hwc_register_calls (hwc_high_level_calls_t *calls)
signed int hwc_unregister_calls (hwc_high_level_calls_t *calls)
void hwc_do_interrupt (u32 ext_int_param)
void hwc_unblank (void)
int hwc_ioctl (unsigned int cmd, unsigned long arg)

Variables

static unsigned char _obuf [MAX_HWCB_ROOM]
struct {
   hwc_ioctls_t   ioctls
   hwc_ioctls_t   init_ioctls
   unsigned char *   hwcb_list_head
   unsigned char *   hwcb_list_tail
   unsigned short int   mto_number
   unsigned int   mto_char_sum
   unsigned char   hwcb_count
   unsigned long   kmem_start
   unsigned long   kmem_end
   kmem_pages_t   kmem_pages
   unsigned char *   obuf
   unsigned short int   obuf_cursor
   unsigned short int   obuf_count
   unsigned short int   obuf_start
   unsigned char *   page
   u32   current_servc
   unsigned char *   current_hwcb
   unsigned char   write_nonprio:1
   unsigned char   write_prio:1
   unsigned char   read_nonprio:1
   unsigned char   read_prio:1
   unsigned char   read_statechange:1
   unsigned char   flags
   hwc_high_level_calls_t *   calls
   spinlock_t   lock
   timer_list   write_timer
   timer_list   poll_timer
hwc_data


Define Documentation

#define __HWC_RW_C__
 

Definition at line 118 of file hwc_rw.c.

#define _HWCB_CHAR hwcb   )     (_LIST(hwcb)->mto_char_sum)
 

Definition at line 82 of file hwc_rw.c.

#define _HWCB_CHAR_LOST hwcb   )     (_LIST(hwcb)->mto_char_sum_lost)
 

Definition at line 86 of file hwc_rw.c.

#define _HWCB_MTO hwcb   )     (_LIST(hwcb)->mto_number)
 

Definition at line 84 of file hwc_rw.c.

#define _HWCB_MTO_LOST hwcb   )     (_LIST(hwcb)->mto_number_lost)
 

Definition at line 88 of file hwc_rw.c.

#define _HWCB_NEXT hwcb   )     (_LIST(hwcb)->next)
 

Definition at line 92 of file hwc_rw.c.

#define _HWCB_TIMES_LOST hwcb   )     (_LIST(hwcb)->times_lost)
 

Definition at line 90 of file hwc_rw.c.

#define _LIST hwcb   )     ((hwcb_list_t*)(&(hwcb)[PAGE_SIZE-sizeof(hwcb_list_t)]))
 

Definition at line 80 of file hwc_rw.c.

#define ALL_HWCB_CHAR   hwc_data.mto_char_sum
 

Definition at line 78 of file hwc_rw.c.

Referenced by add_mto(), hwc_chars_in_buffer(), hwc_unblank(), release_write_hwcb(), reuse_write_hwcb(), and sane_write_hwcb().

#define ALL_HWCB_MTO   hwc_data.mto_number
 

Definition at line 77 of file hwc_rw.c.

Referenced by add_mto(), release_write_hwcb(), reuse_write_hwcb(), and sane_write_hwcb().

#define BUF_HWCB   hwc_data.hwcb_list_tail
 

Definition at line 75 of file hwc_rw.c.

Referenced by add_mto(), allocate_write_hwcb(), do_put_line(), hwc_init(), hwc_write_room(), prepare_write_hwcb(), reuse_write_hwcb(), sane_write_hwcb(), set_alarm(), and write_event_data_2().

#define BUF_HWCB_CHAR   _HWCB_CHAR(BUF_HWCB)
 

Definition at line 94 of file hwc_rw.c.

Referenced by add_mto(), prepare_write_hwcb(), reuse_write_hwcb(), and sane_write_hwcb().

#define BUF_HWCB_CHAR_LOST   _HWCB_CHAR_LOST(BUF_HWCB)
 

Definition at line 106 of file hwc_rw.c.

Referenced by allocate_write_hwcb(), release_write_hwcb(), and reuse_write_hwcb().

#define BUF_HWCB_MTO   _HWCB_MTO(BUF_HWCB)
 

Definition at line 96 of file hwc_rw.c.

Referenced by add_mto(), prepare_write_hwcb(), reuse_write_hwcb(), and sane_write_hwcb().

#define BUF_HWCB_MTO_LOST   _HWCB_MTO_LOST(BUF_HWCB)
 

Definition at line 108 of file hwc_rw.c.

Referenced by allocate_write_hwcb(), release_write_hwcb(), and reuse_write_hwcb().

#define BUF_HWCB_NEXT   _HWCB_NEXT(BUF_HWCB)
 

Definition at line 98 of file hwc_rw.c.

Referenced by allocate_write_hwcb(), and reuse_write_hwcb().

#define BUF_HWCB_TIMES_LOST   _HWCB_TIMES_LOST(BUF_HWCB)
 

Definition at line 114 of file hwc_rw.c.

Referenced by allocate_write_hwcb(), release_write_hwcb(), and reuse_write_hwcb().

#define DEFAULT_CASE_DELIMITER   '%'
 

Definition at line 44 of file hwc_rw.c.

Referenced by hwc_init().

#define DELAYED_WRITE   0
 

Definition at line 238 of file hwc_rw.c.

Referenced by allocate_write_hwcb(), eval_hwc_receive_mask(), eval_hwc_send_mask(), eval_statechangebuf(), find_gds_vector(), hwc_do_interrupt(), hwc_init(), hwc_interrupt_handler(), process_evbufs(), release_write_hwcb(), reuse_write_hwcb(), sane_write_hwcb(), and write_event_data_2().

#define DUMP_HWC_INIT_ERROR
 

Definition at line 46 of file hwc_rw.c.

#define DUMP_HWC_READ_ERROR
 

Definition at line 52 of file hwc_rw.c.

#define DUMP_HWC_WRITE_ERROR
 

Definition at line 48 of file hwc_rw.c.

#define DUMP_HWC_WRITE_LIST_ERROR
 

Definition at line 50 of file hwc_rw.c.

#define HWC_ASCEBC x   )     ((MACHINE_IS_VM ? _ascebc[x] : _ascebc_500[x]))
 

Definition at line 36 of file hwc_rw.c.

Referenced by do_hwc_write().

#define HWC_BROKEN   8
 

Definition at line 134 of file hwc_rw.c.

Referenced by do_hwc_init(), and hwc_interrupt_handler().

#define HWC_EBCASC_STR s,
 )     ((MACHINE_IS_VM ? EBCASC(s,c) : EBCASC_500(s,c)))
 

Definition at line 38 of file hwc_rw.c.

Referenced by get_input().

#define HWC_FLUSH   2
 

Definition at line 132 of file hwc_rw.c.

Referenced by flush_hwcbs(), hwc_flush_buffer(), and write_event_data_2().

#define HWC_INIT   4
 

Definition at line 133 of file hwc_rw.c.

Referenced by do_hwc_init(), and hwc_interrupt_handler().

#define HWC_INTERRUPT   16
 

Definition at line 135 of file hwc_rw.c.

Referenced by do_hwc_init(), and hwc_interrupt_handler().

#define HWC_PTIMER_RUNS   32
 

Definition at line 136 of file hwc_rw.c.

Referenced by hwc_do_interrupt(), and start_poll_hwc().

#define HWC_RW_PRINT_HEADER   "hwc low level driver: "
 

Definition at line 40 of file hwc_rw.c.

Referenced by allocate_write_hwcb(), do_hwc_init(), eval_hwc_receive_mask(), eval_hwc_send_mask(), eval_statechangebuf(), find_gds_vector(), hwc_do_interrupt(), hwc_init(), hwc_interrupt_handler(), process_evbufs(), release_write_hwcb(), reuse_write_hwcb(), sane_write_hwcb(), unconditional_read_2(), and write_event_data_2().

#define HWC_WTIMER_RUNS   1
 

Definition at line 131 of file hwc_rw.c.

Referenced by do_hwc_write(), and put_line().

#define IMMEDIATE_WRITE   1
 

Definition at line 239 of file hwc_rw.c.

Referenced by do_hwc_write(), find_gds_vector(), get_input(), hwc_printk(), hwc_write(), and unconditional_read_2().

#define MAX_HWCB_ROOM   (PAGE_SIZE - sizeof(hwcb_list_t))
 

Definition at line 71 of file hwc_rw.c.

Referenced by add_mto(), hwc_init(), and hwc_write_room().

#define MAX_KMEM_PAGES   (sizeof(kmem_pages_t) << 3)
 

Definition at line 129 of file hwc_rw.c.

Referenced by allocate_write_hwcb(), and set_hwc_ioctls().

#define MAX_MESSAGE_SIZE   (MAX_HWCB_ROOM - sizeof(write_hwcb_t))
 

Definition at line 73 of file hwc_rw.c.

Referenced by do_hwc_write(), and set_hwc_ioctls().

#define MIN a,
 )     (((a<b) ? a : b))
 

Definition at line 33 of file hwc_rw.c.

#define OUT_HWCB   hwc_data.hwcb_list_head
 

Definition at line 76 of file hwc_rw.c.

Referenced by allocate_write_hwcb(), do_put_line(), release_write_hwcb(), reuse_write_hwcb(), sane_write_hwcb(), write_event_data_1(), and write_event_data_2().

#define OUT_HWCB_CHAR   _HWCB_CHAR(OUT_HWCB)
 

Definition at line 100 of file hwc_rw.c.

Referenced by release_write_hwcb(), and write_event_data_2().

#define OUT_HWCB_CHAR_LOST   _HWCB_CHAR_LOST(OUT_HWCB)
 

Definition at line 110 of file hwc_rw.c.

#define OUT_HWCB_MTO   _HWCB_MTO(OUT_HWCB)
 

Definition at line 102 of file hwc_rw.c.

Referenced by release_write_hwcb(), and write_event_data_1().

#define OUT_HWCB_MTO_LOST   _HWCB_MTO_LOST(OUT_HWCB)
 

Definition at line 112 of file hwc_rw.c.

#define OUT_HWCB_NEXT   _HWCB_NEXT(OUT_HWCB)
 

Definition at line 104 of file hwc_rw.c.

Referenced by release_write_hwcb(), and reuse_write_hwcb().

#define USE_VM_DETECTION
 

Definition at line 42 of file hwc_rw.c.


Typedef Documentation

typedef unsigned long kmem_pages_t
 

Definition at line 127 of file hwc_rw.c.


Function Documentation

static unsigned long cr0 __attribute__ (aligned(8))   )  [static]
 

static unsigned char _page [PAGE_SIZE] __attribute__ (aligned(PAGE_SIZE))   )  [static]
 

static int add_mto unsigned char *  message,
unsigned short int  count
[static]
 

Definition at line 616 of file hwc_rw.c.

References ALL_HWCB_CHAR, ALL_HWCB_MTO, BUF_HWCB, BUF_HWCB_CHAR, BUF_HWCB_MTO, dest, ENOMEM, long, MAX_HWCB_ROOM, memcpy, and mto_template.

Referenced by do_put_line().

static int allocate_write_hwcb void   )  [static]
 

Definition at line 517 of file hwc_rw.c.

References BUF_HWCB, BUF_HWCB_CHAR_LOST, BUF_HWCB_MTO_LOST, BUF_HWCB_NEXT, BUF_HWCB_TIMES_LOST, DELAYED_WRITE, ENOMEM, find_first_zero_bit, HWC_RW_PRINT_HEADER, internal_print(), MAX_KMEM_PAGES, OUT_HWCB, page, page_nr, prepare_write_hwcb(), and set_bit.

Referenced by do_put_line(), and set_alarm().

Here is the call graph for this function:

int do_hwc_init void   ) 
 

Definition at line 1968 of file hwc_rw.c.

References cr0, EBUSY, EIO, HWC_BROKEN, HWC_INIT, HWC_INTERRUPT, HWC_RW_PRINT_HEADER, init_hwcb_template, memcpy, printk, and write_event_mask_1().

Referenced by hwc_init(), and hwc_interrupt_handler().

Here is the call graph for this function:

static int do_hwc_write int  from_user,
unsigned char *  ,
unsigned  int,
unsigned  char
[static]
 

Definition at line 943 of file hwc_rw.c.

References add_timer(), get_user, HWC_ASCEBC, hwc_write_timeout(), HWC_WTIMER_RUNS, HZ, IMMEDIATE_WRITE, init_timer(), isprint, jiffies, long, MAX_MESSAGE_SIZE, MIN, mod_timer(), obuf_count, obuf_cursor, out, put_line(), set_alarm(), and write_event_data_1().

Referenced by get_input(), hwc_printk(), hwc_write(), and internal_print().

Here is the call graph for this function:

static void do_poll_hwc unsigned long  data  )  [static]
 

Definition at line 669 of file hwc_rw.c.

References spin_lock_irqsave, spin_unlock_irqrestore, and write_event_data_1().

Referenced by start_poll_hwc().

Here is the call graph for this function:

static void do_put_line unsigned char *  message,
unsigned short  count
[static]
 

Definition at line 865 of file hwc_rw.c.

References __asm__(), add_mto(), allocate_write_hwcb(), BUF_HWCB, OUT_HWCB, and reuse_write_hwcb().

Referenced by put_line().

Here is the call graph for this function:

static int eval_cpmsu gds_vector_t *  start,
void *  end
[inline, static]
 

Definition at line 1442 of file hwc_rw.c.

References eval_textcmd(), find_gds_vector(), GDS_ID_TextCmd, and long.

Referenced by eval_mdsmu().

Here is the call graph for this function:

static int eval_evbuf gds_vector_t *  start,
void *  end
[static]
 

Definition at line 1484 of file hwc_rw.c.

References eval_mdsmu(), find_gds_vector(), GDS_ID_MDSMU, and long.

Referenced by process_evbufs().

Here is the call graph for this function:

static int eval_hwc_receive_mask _hwcb_mask_t  mask  )  [inline, static]
 

Definition at line 1502 of file hwc_rw.c.

References DELAYED_WRITE, ET_Msg_Mask, ET_PMsgCmd_Mask, HWC_RW_PRINT_HEADER, and internal_print().

Referenced by eval_statechangebuf(), and write_event_mask_2().

Here is the call graph for this function:

static int eval_hwc_send_mask _hwcb_mask_t  mask  )  [inline, static]
 

Definition at line 1527 of file hwc_rw.c.

References DELAYED_WRITE, ET_OpCmd_Mask, ET_PMsgCmd_Mask, ET_StateChange_Mask, HWC_RW_PRINT_HEADER, and internal_print().

Referenced by eval_statechangebuf(), and write_event_mask_2().

Here is the call graph for this function:

static int eval_mdsmu gds_vector_t *  start,
void *  end
[inline, static]
 

Definition at line 1466 of file hwc_rw.c.

References eval_cpmsu(), find_gds_vector(), GDS_ID_CPMSU, and long.

Referenced by eval_evbuf().

Here is the call graph for this function:

static int eval_selfdeftextmsg gds_subvector_t *  start,
void *  end
[inline, static]
 

Definition at line 1389 of file hwc_rw.c.

References find_gds_subvector(), get_input(), long, and x30.

Referenced by eval_textcmd().

Here is the call graph for this function:

static int eval_statechangebuf statechangebuf_t *  scbuf  )  [static]
 

Definition at line 1571 of file hwc_rw.c.

References __asm__(), DELAYED_WRITE, eval_hwc_receive_mask(), eval_hwc_send_mask(), HWC_RW_PRINT_HEADER, and internal_print().

Referenced by process_evbufs().

Here is the call graph for this function:

static int eval_textcmd gds_subvector_t *  start,
void *  end
[inline, static]
 

Definition at line 1415 of file hwc_rw.c.

References eval_selfdeftextmsg(), find_gds_subvector(), GDS_KEY_SelfDefTextMsg, and long.

Referenced by eval_cpmsu().

Here is the call graph for this function:

static gds_subvector_t* find_gds_subvector gds_subvector_t *  start,
void *  end,
u8  key
[inline, static]
 

Definition at line 1343 of file hwc_rw.c.

References long.

Referenced by eval_selfdeftextmsg(), and eval_textcmd().

static gds_vector_t* find_gds_vector gds_vector_t *  start,
void *  end,
u16  id
[inline, static]
 

Definition at line 1298 of file hwc_rw.c.

References DELAYED_WRITE, HWC_RW_PRINT_HEADER, IMMEDIATE_WRITE, internal_print(), and long.

Referenced by eval_cpmsu(), eval_evbuf(), and eval_mdsmu().

Here is the call graph for this function:

static void flush_hwcbs void   )  [static]
 

Definition at line 753 of file hwc_rw.c.

References HWC_FLUSH, and release_write_hwcb().

Referenced by hwc_flush_buffer(), and write_event_data_2().

Here is the call graph for this function:

static int get_input void *  start,
void *  end
[inline, static]
 

Definition at line 1364 of file hwc_rw.c.

References do_hwc_write(), EBC_TOLOWER, HWC_EBCASC_STR, IMMEDIATE_WRITE, long, and seperate_cases().

Referenced by eval_selfdeftextmsg().

Here is the call graph for this function:

unsigned int hwc_chars_in_buffer unsigned char  flag  ) 
 

Definition at line 1128 of file hwc_rw.c.

References ALL_HWCB_CHAR, IN_HWCB,