patch-2.2.18 linux/drivers/s390/char/hwc_rw.c
Next file: linux/drivers/s390/char/hwc_rw.h
Previous file: linux/drivers/s390/char/hwc_con.c
Back to the patch index
Back to the overall index
- Lines: 2313
- Date:
Wed Nov 8 23:05:32 2000
- Orig file:
v2.2.17/drivers/s390/char/hwc_rw.c
- Orig date:
Sun Jun 11 21:44:15 2000
diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/drivers/s390/char/hwc_rw.c linux/drivers/s390/char/hwc_rw.c
@@ -6,11 +6,11 @@
* Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
* Author(s): Martin Peschke <peschke@fh-brandenburg.de>
*
+ *
*
- *
- *
- *
- *
+ *
+ *
+ *
*/
#include <linux/kernel.h>
@@ -50,6 +50,8 @@
#undef BUFFER_STRESS_TEST
+#define MEASURE_HWC_OUTPUT
+
typedef struct {
unsigned char *next;
unsigned short int mto_char_sum;
@@ -115,7 +117,7 @@
static unsigned char _obuf[MAX_HWCB_ROOM];
static unsigned char
- _page[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE)));
+ _page[PAGE_SIZE] __attribute__ ((aligned (PAGE_SIZE)));
typedef u32 kmem_pages_t;
@@ -179,39 +181,42 @@
{
{
},
- {
- 8,
- 0,
- 80,
- CODE_ASCII,
- 1,
- 50,
- MAX_KMEM_PAGES,
-
- 0,
-
- 0x6c
-
+ {
+ 8,
+ 0,
+ 80,
+ CODE_ASCII,
+ 1,
+ 50,
+ MAX_KMEM_PAGES,
+
+ 0,
+
+ 0x6c,
+
+ 0,
+ 0,
+ 0
},
- NULL,
- NULL,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- _obuf,
- 0,
- 0,
- 0,
- _page,
- 0,
- NULL,
- 0,
- 0,
- 0,
- 0,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ _obuf,
+ 0,
+ 0,
+ 0,
+ _page,
+ 0,
+ NULL,
+ 0,
+ 0,
+ 0,
+ 0,
0,
NULL
@@ -225,9 +230,9 @@
#define IMMEDIATE_WRITE 1
static signed int do_hwc_write (int from_user, unsigned char *,
- unsigned int,
- unsigned char,
- unsigned char);
+ unsigned int,
+ unsigned char,
+ unsigned char);
static asmlinkage int
internal_print (char write_time, char *fmt,...)
@@ -236,10 +241,10 @@
int i;
unsigned char buf[512];
- va_start(args, fmt);
- i = vsprintf(buf, fmt, args);
- va_end(args);
- return do_hwc_write(0, buf, i, CODE_ASCII, write_time);
+ va_start (args, fmt);
+ i = vsprintf (buf, fmt, args);
+ va_end (args);
+ return do_hwc_write (0, buf, i, CODE_ASCII, write_time);
}
int
@@ -250,18 +255,18 @@
unsigned char buf[512];
unsigned long flags;
int retval;
-
- spin_lock_irqsave(&hwc_data.lock, flags);
- i = vsprintf(buf, fmt, args);
- va_end(args);
- retval = do_hwc_write(0, buf, i, CODE_ASCII, IMMEDIATE_WRITE);
-
- spin_unlock_irqrestore(&hwc_data.lock, flags);
+ spin_lock_irqsave (&hwc_data.lock, flags);
+
+ i = vsprintf (buf, fmt, args);
+ va_end (args);
+ retval = do_hwc_write (0, buf, i, CODE_ASCII, IMMEDIATE_WRITE);
+
+ spin_unlock_irqrestore (&hwc_data.lock, flags);
return retval;
}
-
+
#ifdef DUMP_HWCB_INPUT
static void
@@ -275,46 +280,46 @@
old_final_nl = hwc_data.ioctls.final_nl;
hwc_data.ioctls.final_nl = 1;
-
- internal_print(DELAYED_WRITE, "\n%8x ", area);
+
+ internal_print (DELAYED_WRITE, "\n%8x ", area);
for (index = 0; index < count; index++) {
-
+
if (area[index] <= 0xF)
- internal_print(DELAYED_WRITE, "0%x", area[index]);
+ internal_print (DELAYED_WRITE, "0%x", area[index]);
else
internal_print (DELAYED_WRITE, "%x", area[index]);
-
+
if ((index & 0xF) == 0xF)
- internal_print(DELAYED_WRITE, "\n%8x ",
- &area[index + 1]);
- else if ((index & 3) == 3)
- internal_print(DELAYED_WRITE, " ");
+ internal_print (DELAYED_WRITE, "\n%8x ",
+ &area[index + 1]);
+ else if ((index & 3) == 3)
+ internal_print (DELAYED_WRITE, " ");
}
-
- internal_print(IMMEDIATE_WRITE, "\n");
+
+ internal_print (IMMEDIATE_WRITE, "\n");
hwc_data.ioctls.final_nl = old_final_nl;
}
-#endif
+#endif
static inline u32
service_call (
- u32 hwc_command_word,
- unsigned char hwcb[])
+ u32 hwc_command_word,
+ unsigned char hwcb[])
{
unsigned int condition_code = 1;
- __asm__ __volatile__("L 1, 0(0,%0) \n\t"
- "LRA 2, 0(0,%1) \n\t"
- ".long 0xB2200012 \n\t"
- :
- :"a"(&hwc_command_word), "a"(hwcb)
- :"1", "2", "memory");
-
- __asm__ __volatile__("IPM %0 \n\t"
- "SRL %0, 28 \n\t"
- :"=r"(condition_code));
+ __asm__ __volatile__ ("L 1, 0(0,%0) \n\t"
+ "LRA 2, 0(0,%1) \n\t"
+ ".long 0xB2200012 \n\t"
+ :
+ :"a" (&hwc_command_word), "a" (hwcb)
+ :"1", "2", "memory");
+
+ __asm__ __volatile__ ("IPM %0 \n\t"
+ "SRL %0, 28 \n\t"
+ :"=r" (condition_code));
return condition_code;
}
@@ -324,8 +329,8 @@
{
u32 param;
- __asm__ __volatile__("L %0,128(0,0)\n\t"
- :"=r"(param));
+ __asm__ __volatile__ ("L %0,128(0,0)\n\t"
+ :"=r" (param));
return ((unsigned char *) param);
}
@@ -337,14 +342,14 @@
if (!BUF_HWCB)
return -ENOMEM;
-
+
BUF_HWCB_MTO = 0;
BUF_HWCB_CHAR = 0;
hwcb = (write_hwcb_t *) BUF_HWCB;
- memcpy(hwcb, &write_hwcb_template, sizeof(write_hwcb_t));
-
+ memcpy (hwcb, &write_hwcb_template, sizeof (write_hwcb_t));
+
if (!hwc_data.write_nonprio && hwc_data.write_prio)
hwcb->msgbuf.type = ET_PMsgCmd;
@@ -363,27 +368,27 @@
if (!OUT_HWCB)
return -ENOMEM;
-
- if ((unsigned long)OUT_HWCB & 0xFFF) {
+
+ if ((unsigned long) OUT_HWCB & 0xFFF) {
bad_addr = OUT_HWCB;
#ifdef DUMP_HWC_WRITE_LIST_ERROR
- __asm__("LHI 1,0xe30\n\t"
- "LRA 2,0(0,%0) \n\t"
- "J .+0 \n\t"
- :
- :"a"(bad_addr)
- :"1", "2");
-#endif
-
+ __asm__ ("LHI 1,0xe30\n\t"
+ "LRA 2,0(0,%0) \n\t"
+ "J .+0 \n\t"
+ :
+ : "a" (bad_addr)
+ : "1", "2");
+#endif
+
hwc_data.kmem_pages = 0;
- if ((unsigned long)BUF_HWCB & 0xFFF) {
+ if ((unsigned long) BUF_HWCB & 0xFFF) {
lost_hwcb = hwc_data.hwcb_count;
lost_msg = ALL_HWCB_MTO;
lost_char = ALL_HWCB_CHAR;
-
+
OUT_HWCB = NULL;
BUF_HWCB = NULL;
ALL_HWCB_MTO = 0;
@@ -399,27 +404,27 @@
ALL_HWCB_CHAR = BUF_HWCB_CHAR;
hwc_data.hwcb_count = 1;
page = (unsigned long) BUF_HWCB;
-
+
if (page >= hwc_data.kmem_start &&
- page < hwc_data.kmem_end) {
-
+ page <= hwc_data.kmem_end) {
+
page_nr = (int)
- ((page - hwc_data.kmem_start) >> 12);
- set_bit(page_nr, &hwc_data.kmem_pages);
+ ((page - hwc_data.kmem_start) >> 12);
+ set_bit (page_nr, &hwc_data.kmem_pages);
}
}
-
- internal_print(
- DELAYED_WRITE,
- HWC_RW_PRINT_HEADER
+
+ internal_print (
+ DELAYED_WRITE,
+ HWC_RW_PRINT_HEADER
"found invalid HWCB at address 0x%x. List corrupted. "
- "Lost %i HWCBs with %i characters within up to %i "
- "messages. Saved %i HWCB with last %i characters i"
- "within up to %i messages.\n",
- (unsigned int)bad_addr,
- lost_hwcb, lost_char, lost_msg,
- hwc_data.hwcb_count,
- ALL_HWCB_CHAR, ALL_HWCB_MTO);
+ "Lost %i HWCBs with %i characters within up to %i "
+ "messages. Saved %i HWCB with last %i characters i"
+ "within up to %i messages.\n",
+ (unsigned int) bad_addr,
+ lost_hwcb, lost_char, lost_msg,
+ hwc_data.hwcb_count,
+ ALL_HWCB_CHAR, ALL_HWCB_MTO);
}
return 0;
}
@@ -430,18 +435,18 @@
int retval;
if (hwc_data.hwcb_count < 2)
-#ifdef DUMP_HWC_WRITE_LIST_ERROR
- __asm__("LHI 1,0xe31\n\t"
- "LRA 2,0(0,%0)\n\t"
- "LRA 3,0(0,%1)\n\t"
- "J .+0 \n\t"
- :
- :"a"(BUF_HWCB), "a"(OUT_HWCB)
- :"1", "2", "3");
+#ifdef DUMP_HWC_WRITE_LIST_ERROR
+ __asm__ ("LHI 1,0xe31\n\t"
+ "LRA 2,0(0,%0)\n\t"
+ "LRA 3,0(0,%1)\n\t"
+ "J .+0 \n\t"
+ :
+ : "a" (BUF_HWCB), "a" (OUT_HWCB)
+ : "1", "2", "3");
#else
return -EPERM;
-#endif
-
+#endif
+
if (hwc_data.current_hwcb == OUT_HWCB) {
if (hwc_data.hwcb_count > 2) {
@@ -471,34 +476,34 @@
ALL_HWCB_MTO -= BUF_HWCB_MTO;
ALL_HWCB_CHAR -= BUF_HWCB_CHAR;
- retval = prepare_write_hwcb();
+ retval = prepare_write_hwcb ();
if (hwc_data.hwcb_count == hwc_data.ioctls.max_hwcb)
- internal_print(
- DELAYED_WRITE,
- HWC_RW_PRINT_HEADER
- "reached my own limit of "
- "allowed buffer space for output (%i HWCBs = %li "
- "bytes), skipped content of oldest HWCB %i time(s) "
- "(%i lines = %i characters)\n",
- hwc_data.ioctls.max_hwcb,
- hwc_data.ioctls.max_hwcb * PAGE_SIZE,
- BUF_HWCB_TIMES_LOST,
- BUF_HWCB_MTO_LOST,
- BUF_HWCB_CHAR_LOST);
+ internal_print (
+ DELAYED_WRITE,
+ HWC_RW_PRINT_HEADER
+ "reached my own limit of "
+ "allowed buffer space for output (%i HWCBs = %li "
+ "bytes), skipped content of oldest HWCB %i time(s) "
+ "(%i lines = %i characters)\n",
+ hwc_data.ioctls.max_hwcb,
+ hwc_data.ioctls.max_hwcb * PAGE_SIZE,
+ BUF_HWCB_TIMES_LOST,
+ BUF_HWCB_MTO_LOST,
+ BUF_HWCB_CHAR_LOST);
else
internal_print (
- DELAYED_WRITE,
- HWC_RW_PRINT_HEADER
- "page allocation failed, "
- "could not expand buffer for output (currently in "
- "use: %i HWCBs = %li bytes), skipped content of "
+ DELAYED_WRITE,
+ HWC_RW_PRINT_HEADER
+ "page allocation failed, "
+ "could not expand buffer for output (currently in "
+ "use: %i HWCBs = %li bytes), skipped content of "
"oldest HWCB %i time(s) (%i lines = %i characters)\n",
- hwc_data.hwcb_count,
- hwc_data.hwcb_count * PAGE_SIZE,
- BUF_HWCB_TIMES_LOST,
- BUF_HWCB_MTO_LOST,
- BUF_HWCB_CHAR_LOST);
+ hwc_data.hwcb_count,
+ hwc_data.hwcb_count * PAGE_SIZE,
+ BUF_HWCB_TIMES_LOST,
+ BUF_HWCB_MTO_LOST,
+ BUF_HWCB_CHAR_LOST);
return retval;
}
@@ -508,16 +513,16 @@
{
unsigned char *page;
int page_nr;
-
+
if (hwc_data.hwcb_count == hwc_data.ioctls.max_hwcb)
return -ENOMEM;
-
- page_nr = find_first_zero_bit(&hwc_data.kmem_pages, MAX_KMEM_PAGES);
+
+ page_nr = find_first_zero_bit (&hwc_data.kmem_pages, MAX_KMEM_PAGES);
if (page_nr < hwc_data.ioctls.kmem_hwcb) {
page = (unsigned char *)
- (hwc_data.kmem_start + (page_nr << 12));
- set_bit(page_nr, &hwc_data.kmem_pages);
+ (hwc_data.kmem_start + (page_nr << 12));
+ set_bit (page_nr, &hwc_data.kmem_pages);
} else
page = (unsigned char *) __get_free_page (GFP_ATOMIC);
@@ -526,7 +531,7 @@
if (!OUT_HWCB)
OUT_HWCB = page;
- else
+ else
BUF_HWCB_NEXT = page;
BUF_HWCB = page;
@@ -535,7 +540,7 @@
hwc_data.hwcb_count++;
- prepare_write_hwcb();
+ prepare_write_hwcb ();
BUF_HWCB_TIMES_LOST = 0;
BUF_HWCB_MTO_LOST = 0;
@@ -543,13 +548,13 @@
#ifdef BUFFER_STRESS_TEST
- internal_print(
- DELAYED_WRITE,
- "*** " HWC_RW_PRINT_HEADER
- "page #%i at 0x%x for buffering allocated. ***\n",
- hwc_data.hwcb_count, page);
+ internal_print (
+ DELAYED_WRITE,
+ "*** " HWC_RW_PRINT_HEADER
+ "page #%i at 0x%x for buffering allocated. ***\n",
+ hwc_data.hwcb_count, page);
-#endif
+#endif
return 0;
}
@@ -559,54 +564,53 @@
{
unsigned long page;
int page_nr;
-
- if (!hwc_data.hwcb_count)
- return -ENODATA;
-
- if (hwc_data.hwcb_count == 1) {
-
- prepare_write_hwcb();
-
- ALL_HWCB_CHAR = 0;
- ALL_HWCB_MTO = 0;
- BUF_HWCB_TIMES_LOST = 0;
- BUF_HWCB_MTO_LOST = 0;
- BUF_HWCB_CHAR_LOST = 0;
+
+ if (!hwc_data.hwcb_count)
+ return -ENODATA;
+
+ if (hwc_data.hwcb_count == 1) {
+
+ prepare_write_hwcb ();
+
+ ALL_HWCB_CHAR = 0;
+ ALL_HWCB_MTO = 0;
+ BUF_HWCB_TIMES_LOST = 0;
+ BUF_HWCB_MTO_LOST = 0;
+ BUF_HWCB_CHAR_LOST = 0;
} else {
- page = (unsigned long) OUT_HWCB;
-
- ALL_HWCB_MTO -= OUT_HWCB_MTO;
- ALL_HWCB_CHAR -= OUT_HWCB_CHAR;
- hwc_data.hwcb_count--;
-
- OUT_HWCB = OUT_HWCB_NEXT;
-
- if (page >= hwc_data.kmem_start &&
- page < hwc_data.kmem_end) {
+ page = (unsigned long) OUT_HWCB;
+
+ ALL_HWCB_MTO -= OUT_HWCB_MTO;
+ ALL_HWCB_CHAR -= OUT_HWCB_CHAR;
+ hwc_data.hwcb_count--;
+
+ OUT_HWCB = OUT_HWCB_NEXT;
-/* memset((void *) page, 0, PAGE_SIZE); */
+ if (page >= hwc_data.kmem_start &&
+ page <= hwc_data.kmem_end) {
+ /*memset((void *) page, 0, PAGE_SIZE); */
- page_nr = (int) ((page - hwc_data.kmem_start) >> 12);
- clear_bit(page_nr, &hwc_data.kmem_pages);
+ page_nr = (int) ((page - hwc_data.kmem_start) >> 12);
+ clear_bit (page_nr, &hwc_data.kmem_pages);
} else
- free_page(page);
+ free_page (page);
#ifdef BUFFER_STRESS_TEST
- internal_print(
- DELAYED_WRITE,
- "*** " HWC_RW_PRINT_HEADER
- "page at 0x%x released, %i pages still in use ***\n",
- page, hwc_data.hwcb_count);
+ internal_print (
+ DELAYED_WRITE,
+ "*** " HWC_RW_PRINT_HEADER
+ "page at 0x%x released, %i pages still in use ***\n",
+ page, hwc_data.hwcb_count);
-#endif
- }
+#endif
+ }
return 0;
}
static int
add_mto (
- unsigned char *message,
- unsigned short int count)
+ unsigned char *message,
+ unsigned short int count)
{
unsigned short int mto_size;
write_hwcb_t *hwcb;
@@ -619,32 +623,38 @@
if (BUF_HWCB == hwc_data.current_hwcb)
return -ENOMEM;
- mto_size = sizeof(mto_t) + count;
+ mto_size = sizeof (mto_t) + count;
hwcb = (write_hwcb_t *) BUF_HWCB;
-
+
if ((MAX_HWCB_ROOM - hwcb->length) < mto_size)
return -ENOMEM;
mto = (mto_t *) (((unsigned long) hwcb) + hwcb->length);
- memcpy(mto, &mto_template, sizeof(mto_t));
+ memcpy (mto, &mto_template, sizeof (mto_t));
- dest = (void *) (((unsigned long) mto) + sizeof(mto_t));
+ dest = (void *) (((unsigned long) mto) + sizeof (mto_t));
- memcpy(dest, message, count);
+ memcpy (dest, message, count);
mto->length += count;
-
- hwcb->length += mto_size;
- hwcb->msgbuf.length += mto_size;
- hwcb->msgbuf.mdb.length += mto_size;
+
+ hwcb->length += mto_size;
+ hwcb->msgbuf.length += mto_size;
+ hwcb->msgbuf.mdb.length += mto_size;
BUF_HWCB_MTO++;
ALL_HWCB_MTO++;
BUF_HWCB_CHAR += count;
ALL_HWCB_CHAR += count;
+#ifdef MEASURE_HWC_OUTPUT
+
+ hwc_data.ioctls.measured_lines++;
+ hwc_data.ioctls.measured_chars += count;
+#endif
+
return count;
}
@@ -659,38 +669,41 @@
if (hwc_data.current_servc)
return -EBUSY;
-
- retval = sane_write_hwcb();
+
+ retval = sane_write_hwcb ();
if (retval < 0)
return retval;
if (!OUT_HWCB_MTO)
return -ENODATA;
- condition_code = service_call(HWC_CMDW_WRITEDATA, OUT_HWCB);
+ condition_code = service_call (HWC_CMDW_WRITEDATA, OUT_HWCB);
-#ifdef DUMP_HWC_WRITE_ERROR
+#ifdef DUMP_HWC_WRITE_ERROR
if (condition_code != HWC_COMMAND_INITIATED)
- __asm__("LHI 1,0xe20\n\t"
- "L 2,0(0,%0)\n\t"
- "LRA 3,0(0,%1)\n\t"
- "J .+0 \n\t"
- :
- :"a"(&condition_code), "a"(OUT_HWCB)
- :"1", "2", "3");
-#endif
+ __asm__ ("LHI 1,0xe20\n\t"
+ "L 2,0(0,%0)\n\t"
+ "LRA 3,0(0,%1)\n\t"
+ "J .+0 \n\t"
+ :
+ : "a" (&condition_code), "a" (OUT_HWCB)
+ : "1", "2", "3");
+#endif
switch (condition_code) {
- case HWC_COMMAND_INITIATED :
- hwc_data.current_servc = HWC_CMDW_WRITEDATA;
- hwc_data.current_hwcb = OUT_HWCB;
- retval = condition_code;
- break;
- case HWC_BUSY :
- retval = -EBUSY;
- break;
- default :
- retval = -EIO;
+ case HWC_COMMAND_INITIATED:
+ hwc_data.current_servc = HWC_CMDW_WRITEDATA;
+ hwc_data.current_hwcb = OUT_HWCB;
+ retval = condition_code;
+#ifdef MEASURE_HWC_OUTPUT
+ hwc_data.ioctls.measured_wcalls++;
+#endif
+ break;
+ case HWC_BUSY:
+ retval = -EBUSY;
+ break;
+ default:
+ retval = -EIO;
}
return retval;
@@ -700,9 +713,9 @@
flush_hwcbs (void)
{
while (hwc_data.hwcb_count > 1)
- release_write_hwcb();
+ release_write_hwcb ();
- release_write_hwcb();
+ release_write_hwcb ();
hwc_data.flags &= ~HWC_FLUSH;
}
@@ -716,7 +729,7 @@
#ifdef DUMP_HWC_WRITE_ERROR
unsigned char *param;
- param = ext_int_param();
+ param = ext_int_param ();
if (param != hwc_data.current_hwcb) {
internal_print (
DELAYED_WRITE,
@@ -734,42 +747,42 @@
#ifdef DUMP_HWC_WRITE_LIST_ERROR
if (((unsigned char *) hwcb) != hwc_data.current_hwcb) {
- __asm__("LHI 1,0xe22\n\t"
- "LRA 2,0(0,%0)\n\t"
- "LRA 3,0(0,%1)\n\t"
- "LRA 4,0(0,%2)\n\t"
- "LRA 5,0(0,%3)\n\t"
- "J .+0 \n\t"
- :
- :"a"(OUT_HWCB),
- "a"(hwc_data.current_hwcb),
- "a"(BUF_HWCB),
+ __asm__ ("LHI 1,0xe22\n\t"
+ "LRA 2,0(0,%0)\n\t"
+ "LRA 3,0(0,%1)\n\t"
+ "LRA 4,0(0,%2)\n\t"
+ "LRA 5,0(0,%3)\n\t"
+ "J .+0 \n\t"
+ :
+ : "a" (OUT_HWCB),
+ "a" (hwc_data.current_hwcb),
+ "a" (BUF_HWCB),
"a" (hwcb)
- :"1", "2", "3", "4", "5");
+ : "1", "2", "3", "4", "5");
}
#endif
#ifdef DUMP_HWC_WRITE_ERROR
if (hwcb->response_code != 0x0020) {
- __asm__("LHI 1,0xe21\n\t"
- "LRA 2,0(0,%0)\n\t"
- "LRA 3,0(0,%1)\n\t"
- "LRA 4,0(0,%2)\n\t"
- "LH 5,0(0,%3)\n\t"
- "SRL 5,8(0)\n\t"
- "J .+0 \n\t"
- :
- :"a"(OUT_HWCB), "a"(hwc_data.current_hwcb),
- "a"(BUF_HWCB),
- "a"(&(hwc_data.hwcb_count))
- :"1", "2", "3", "4", "5");
+ __asm__ ("LHI 1,0xe21\n\t"
+ "LRA 2,0(0,%0)\n\t"
+ "LRA 3,0(0,%1)\n\t"
+ "LRA 4,0(0,%2)\n\t"
+ "LH 5,0(0,%3)\n\t"
+ "SRL 5,8(0)\n\t"
+ "J .+0 \n\t"
+ :
+ : "a" (OUT_HWCB), "a" (hwc_data.current_hwcb),
+ "a" (BUF_HWCB),
+ "a" (&(hwc_data.hwcb_count))
+ : "1", "2", "3", "4", "5");
}
-#endif
+#endif
if (hwcb->response_code == 0x0020) {
retval = OUT_HWCB_CHAR;
- release_write_hwcb();
+ release_write_hwcb ();
} else {
internal_print (
DELAYED_WRITE,
@@ -787,53 +800,53 @@
hwc_data.current_hwcb = NULL;
if (hwc_data.flags & HWC_FLUSH)
- flush_hwcbs();
+ flush_hwcbs ();
return retval;
}
static void
do_put_line (
- unsigned char * message,
- unsigned short count)
+ unsigned char *message,
+ unsigned short count)
{
- if (add_mto(message, count) != count) {
+ if (add_mto (message, count) != count) {
+
+ if (allocate_write_hwcb () < 0)
+ reuse_write_hwcb ();
- if (allocate_write_hwcb() < 0)
- reuse_write_hwcb();
-
-#ifdef DUMP_HWC_WRITE_LIST_ERROR
- if (add_mto(message, count) != count)
- __asm__("LHI 1,0xe32\n\t"
- "LRA 2,0(0,%0)\n\t"
- "L 3,0(0,%1)\n\t"
- "LRA 4,0(0,%2)\n\t"
- "LRA 5,0(0,%3)\n\t"
- "J .+0 \n\t"
- :
- :"a"(message), "a"(&hwc_data.kmem_pages),
- "a"(BUF_HWCB), "a"(OUT_HWCB)
- :"1", "2", "3", "4", "5");
+#ifdef DUMP_HWC_WRITE_LIST_ERROR
+ if (add_mto (message, count) != count)
+ __asm__ ("LHI 1,0xe32\n\t"
+ "LRA 2,0(0,%0)\n\t"
+ "L 3,0(0,%1)\n\t"
+ "LRA 4,0(0,%2)\n\t"
+ "LRA 5,0(0,%3)\n\t"
+ "J .+0 \n\t"
+ :
+ : "a" (message), "a" (&hwc_data.kmem_pages),
+ "a" (BUF_HWCB), "a" (OUT_HWCB)
+ : "1", "2", "3", "4", "5");
#else
- add_mto(message, count);
-#endif
+ add_mto (message, count);
+#endif
}
}
static void
put_line (
- unsigned char * message,
- unsigned short count)
+ unsigned char *message,
+ unsigned short count)
{
-
+
if ((!hwc_data.obuf_start) && (hwc_data.flags & HWC_TIMER_RUNS)) {
- del_timer(&hwc_data.write_timer);
+ del_timer (&hwc_data.write_timer);
hwc_data.flags &= ~HWC_TIMER_RUNS;
}
hwc_data.obuf_start += count;
- do_put_line(message, count);
+ do_put_line (message, count);
hwc_data.obuf_start -= count;
}
@@ -844,39 +857,39 @@
write_hwcb_t *hwcb;
if ((!BUF_HWCB) || (BUF_HWCB == hwc_data.current_hwcb))
- allocate_write_hwcb();
+ allocate_write_hwcb ();
hwcb = (write_hwcb_t *) BUF_HWCB;
hwcb->msgbuf.mdb.mdb_body.go.general_msg_flags |= GMF_SndAlrm;
-}
+}
static void
hwc_write_timeout (unsigned long data)
{
unsigned long flags;
-
- spin_lock_irqsave(&hwc_data.lock, flags);
-
+
+ spin_lock_irqsave (&hwc_data.lock, flags);
+
hwc_data.obuf_start = hwc_data.obuf_count;
if (hwc_data.obuf_count)
- put_line(hwc_data.obuf, hwc_data.obuf_count);
+ put_line (hwc_data.obuf, hwc_data.obuf_count);
hwc_data.obuf_start = 0;
hwc_data.obuf_cursor = 0;
hwc_data.obuf_count = 0;
-
- write_event_data_1();
- spin_unlock_irqrestore(&hwc_data.lock, flags);
+ write_event_data_1 ();
+
+ spin_unlock_irqrestore (&hwc_data.lock, flags);
}
static int
do_hwc_write (
- int from_user,
+ int from_user,
unsigned char *msg,
- unsigned int count,
- unsigned char code,
- unsigned char write_time)
+ unsigned int count,
+ unsigned char code,
+ unsigned char write_time)
{
unsigned int i_msg = 0;
unsigned short int spaces = 0;
@@ -889,18 +902,18 @@
if (hwc_data.obuf_start) {
obuf_cursor = 0;
obuf_count = 0;
- obuf_columns = MIN(hwc_data.ioctls.columns,
- MAX_MESSAGE_SIZE - hwc_data.obuf_start);
+ obuf_columns = MIN (hwc_data.ioctls.columns,
+ MAX_MESSAGE_SIZE - hwc_data.obuf_start);
} else {
obuf_cursor = hwc_data.obuf_cursor;
obuf_count = hwc_data.obuf_count;
obuf_columns = hwc_data.ioctls.columns;
}
-
+
for (i_msg = 0; i_msg < count; i_msg++) {
if (from_user)
- get_user(orig_ch, msg + i_msg);
+ get_user (orig_ch, msg + i_msg);
else
orig_ch = msg[i_msg];
if (code == CODE_EBCDIC)
@@ -909,42 +922,42 @@
ch = orig_ch;
processed_characters++;
-
+
if ((obuf_cursor == obuf_columns) &&
(ch != '\n') &&
(ch != '\t')) {
- put_line(&hwc_data.obuf[hwc_data.obuf_start],
- obuf_columns);
+ put_line (&hwc_data.obuf[hwc_data.obuf_start],
+ obuf_columns);
obuf_cursor = 0;
obuf_count = 0;
}
switch (ch) {
- case '\n' :
+ case '\n':
- put_line(&hwc_data.obuf[hwc_data.obuf_start],
- obuf_count);
+ put_line (&hwc_data.obuf[hwc_data.obuf_start],
+ obuf_count);
obuf_cursor = 0;
obuf_count = 0;
break;
- case '\a' :
+ case '\a':
hwc_data.obuf_start += obuf_count;
- set_alarm();
+ set_alarm ();
hwc_data.obuf_start -= obuf_count;
break;
- case '\t' :
+ case '\t':
do {
if (obuf_cursor < obuf_columns) {
hwc_data.obuf[hwc_data.obuf_start +
- obuf_cursor]
- = 0x20;
+ obuf_cursor]
+ = 0x20;
obuf_cursor++;
} else
break;
@@ -952,47 +965,47 @@
break;
- case '\f' :
- case '\v' :
+ case '\f':
+ case '\v':
spaces = obuf_cursor;
- put_line(&hwc_data.obuf[hwc_data.obuf_start],
- obuf_count);
+ put_line (&hwc_data.obuf[hwc_data.obuf_start],
+ obuf_count);
obuf_count = obuf_cursor;
while (spaces) {
hwc_data.obuf[hwc_data.obuf_start +
- obuf_cursor - spaces]
- = 0x20;
+ obuf_cursor - spaces]
+ = 0x20;
spaces--;
}
break;
- case '\b' :
+ case '\b':
if (obuf_cursor)
obuf_cursor--;
break;
- case '\r' :
+ case '\r':
obuf_cursor = 0;
break;
- case 0x00 :
+ case 0x00:
- put_line(&hwc_data.obuf[hwc_data.obuf_start],
- obuf_count);
+ put_line (&hwc_data.obuf[hwc_data.obuf_start],
+ obuf_count);
obuf_cursor = 0;
obuf_count = 0;
goto out;
- default:
+ default:
- if (isprint(ch))
+ if (isprint (ch))
hwc_data.obuf[hwc_data.obuf_start +
- obuf_cursor++]
- = (code == CODE_ASCII) ?
+ obuf_cursor++]
+ = (code == CODE_ASCII) ?
(MACHINE_IS_VM ?
_ascebc[orig_ch] :
_ascebc_500[orig_ch]) :
@@ -1006,9 +1019,9 @@
if (hwc_data.obuf_start ||
(hwc_data.ioctls.final_nl == 0)) {
-
- put_line(&hwc_data.obuf[hwc_data.obuf_start],
- obuf_count);
+
+ put_line (&hwc_data.obuf[hwc_data.obuf_start],
+ obuf_count);
obuf_cursor = 0;
obuf_count = 0;
} else {
@@ -1018,34 +1031,34 @@
if (hwc_data.flags & HWC_TIMER_RUNS) {
hwc_data.write_timer.expires =
- jiffies +
- hwc_data.ioctls.final_nl*HZ/10;
+ jiffies +
+ hwc_data.ioctls.final_nl * HZ / 10;
} else {
- init_timer(&hwc_data.write_timer);
+ init_timer (&hwc_data.write_timer);
hwc_data.write_timer.function =
- hwc_write_timeout;
+ hwc_write_timeout;
hwc_data.write_timer.data =
- (unsigned long)NULL;
+ (unsigned long) NULL;
hwc_data.write_timer.expires =
- jiffies +
- hwc_data.ioctls.final_nl*HZ/10;
- add_timer(&hwc_data.write_timer);
+ jiffies +
+ hwc_data.ioctls.final_nl * HZ / 10;
+ add_timer (&hwc_data.write_timer);
hwc_data.flags |= HWC_TIMER_RUNS;
}
} else;
- }
+ }
} else;
-out :
+ out:
if (!hwc_data.obuf_start) {
hwc_data.obuf_cursor = obuf_cursor;
hwc_data.obuf_count = obuf_count;
}
if (write_time == IMMEDIATE_WRITE)
- write_event_data_1();
+ write_event_data_1 ();
return processed_characters;
}
@@ -1055,14 +1068,14 @@
{
unsigned long flags;
int retval;
-
- spin_lock_irqsave(&hwc_data.lock, flags);
+
+ spin_lock_irqsave (&hwc_data.lock, flags);
retval = do_hwc_write (from_user, (unsigned char *) msg,
count, hwc_data.ioctls.code,
- IMMEDIATE_WRITE);
+ IMMEDIATE_WRITE);
- spin_unlock_irqrestore(&hwc_data.lock, flags);
+ spin_unlock_irqrestore (&hwc_data.lock, flags);
return retval;
}
@@ -1073,15 +1086,15 @@
unsigned short int number = 0;
unsigned long flags;
- spin_lock_irqsave(&hwc_data.lock, flags);
+ spin_lock_irqsave (&hwc_data.lock, flags);
if (flag & IN_HWCB)
number += ALL_HWCB_CHAR;
-
+
if (flag & IN_WRITE_BUF)
number += hwc_data.obuf_cursor;
-
- spin_unlock_irqrestore(&hwc_data.lock, flags);
+
+ spin_unlock_irqrestore (&hwc_data.lock, flags);
return number;
}
@@ -1092,7 +1105,7 @@
int i;
int nr = 0;
- for (i = 0; i < (sizeof(arg) << 3); i++) {
+ for (i = 0; i < (sizeof (arg) << 3); i++) {
if (arg & 1)
nr++;
arg >>= 1;
@@ -1107,24 +1120,24 @@
unsigned int number = 0;
unsigned long flags;
write_hwcb_t *hwcb;
-
- spin_lock_irqsave(&hwc_data.lock, flags);
- if (flag & IN_HWCB) {
+ spin_lock_irqsave (&hwc_data.lock, flags);
+
+ if (flag & IN_HWCB) {
if (BUF_HWCB) {
hwcb = (write_hwcb_t *) BUF_HWCB;
- number += MAX_HWCB_ROOM - hwcb->length;
+ number += MAX_HWCB_ROOM - hwcb->length;
}
number += (hwc_data.ioctls.kmem_hwcb -
- nr_setbits(hwc_data.kmem_pages)) *
- (MAX_HWCB_ROOM -
- (sizeof(write_hwcb_t) + sizeof(mto_t)));
+ nr_setbits (hwc_data.kmem_pages)) *
+ (MAX_HWCB_ROOM -
+ (sizeof (write_hwcb_t) + sizeof (mto_t)));
}
- if (flag & IN_WRITE_BUF)
- number += MAX_HWCB_ROOM - hwc_data.obuf_cursor;
+ if (flag & IN_WRITE_BUF)
+ number += MAX_HWCB_ROOM - hwc_data.obuf_cursor;
- spin_unlock_irqrestore(&hwc_data.lock, flags);
+ spin_unlock_irqrestore (&hwc_data.lock, flags);
return number;
}
@@ -1134,19 +1147,19 @@
{
unsigned long flags;
- spin_lock_irqsave(&hwc_data.lock, flags);
+ spin_lock_irqsave (&hwc_data.lock, flags);
if (flag & IN_HWCB) {
if (hwc_data.current_servc != HWC_CMDW_WRITEDATA)
- flush_hwcbs();
+ flush_hwcbs ();
else
hwc_data.flags |= HWC_FLUSH;
}
if (flag & IN_WRITE_BUF) {
- hwc_data.obuf_cursor = 0;
+ hwc_data.obuf_cursor = 0;
hwc_data.obuf_count = 0;
}
- spin_unlock_irqrestore(&hwc_data.lock, flags);
+ spin_unlock_irqrestore (&hwc_data.lock, flags);
}
unsigned short int
@@ -1170,7 +1183,7 @@
i_out++;
- i_in++;
+ i_in++;
} else
_case = ~_case;
@@ -1179,7 +1192,7 @@
if (_case) {
- if (hwc_data.ioctls.tolower)
+ if (hwc_data.ioctls.tolower)
buf[i_out] = _ebc_toupper[buf[i_in]];
else
@@ -1203,43 +1216,43 @@
int retval = 0;
switch (id) {
- case GDS_ID_MDSMU :
- name = "Multiple Domain Support Message Unit";
- break;
- case GDS_ID_MDSRouteInfo :
- name = "MDS Routing Information";
- break;
- case GDS_ID_AgUnWrkCorr :
- name = "Agent Unit of Work Correlator";
- break;
- case GDS_ID_SNACondReport :
- name = "SNA Condition Report";
- break;
- case GDS_ID_CPMSU :
- name = "CP Management Services Unit";
- break;
- case GDS_ID_RoutTargInstr :
- name = "Routing and Targeting Instructions";
- break;
- case GDS_ID_OpReq :
- name = "Operate Request";
- break;
- case GDS_ID_TextCmd :
- name = "Text Command";
- break;
+ case GDS_ID_MDSMU:
+ name = "Multiple Domain Support Message Unit";
+ break;
+ case GDS_ID_MDSRouteInfo:
+ name = "MDS Routing Information";
+ break;
+ case GDS_ID_AgUnWrkCorr:
+ name = "Agent Unit of Work Correlator";
+ break;
+ case GDS_ID_SNACondReport:
+ name = "SNA Condition Report";
+ break;
+ case GDS_ID_CPMSU:
+ name = "CP Management Services Unit";
+ break;
+ case GDS_ID_RoutTargInstr:
+ name = "Routing and Targeting Instructions";
+ break;
+ case GDS_ID_OpReq:
+ name = "Operate Request";
+ break;
+ case GDS_ID_TextCmd:
+ name = "Text Command";
+ break;
- default :
- name = "unknown GDS variable";
- retval = -EINVAL;
+ default:
+ name = "unknown GDS variable";
+ retval = -EINVAL;
}
return retval;
}
-#endif
+#endif
inline static gds_vector_t *
find_gds_vector (
- gds_vector_t *start, void *end, u16 id)
+ gds_vector_t * start, void *end, u16 id)
{
gds_vector_t *vec;
gds_vector_t *retval = NULL;
@@ -1247,31 +1260,31 @@
vec = start;
while (((void *) vec) < end) {
- if (vec->gds_id == id) {
+ if (vec->gds_id == id) {
#ifdef DUMP_HWCB_INPUT
int retval_name;
unsigned char name[64];
- retval_name = gds_vector_name(id, name);
- internal_print(
- DELAYED_WRITE,
- HWC_RW_PRINT_HEADER
- "%s at 0x%x up to 0x%x, length: %d",
- name,
- (unsigned long) vec,
- ((unsigned long) vec) + vec->length - 1,
- vec->length);
+ retval_name = gds_vector_name (id, name);
+ internal_print (
+ DELAYED_WRITE,
+ HWC_RW_PRINT_HEADER
+ "%s at 0x%x up to 0x%x, length: %d",
+ name,
+ (unsigned long) vec,
+ ((unsigned long) vec) + vec->length - 1,
+ vec->length);
if (retval_name < 0)
- internal_print(
- IMMEDIATE_WRITE,
- ", id: 0x%x\n",
- vec->gds_id);
+ internal_print (
+ IMMEDIATE_WRITE,
+ ", id: 0x%x\n",
+ vec->gds_id);
else
internal_print (
- IMMEDIATE_WRITE,
- "\n");
-#endif
+ IMMEDIATE_WRITE,
+ "\n");
+#endif
retval = vec;
break;
@@ -1284,7 +1297,7 @@
inline static gds_subvector_t *
find_gds_subvector (
- gds_subvector_t *start, void *end, u8 key)
+ gds_subvector_t * start, void *end, u8 key)
{
gds_subvector_t *subvec;
gds_subvector_t *retval = NULL;
@@ -1292,12 +1305,12 @@
subvec = start;
while (((void *) subvec) < end) {
- if (subvec->key == key) {
+ if (subvec->key == key) {
retval = subvec;
break;
}
subvec = (gds_subvector_t *)
- (((unsigned long) subvec) + subvec->length);
+ (((unsigned long) subvec) + subvec->length);
}
return retval;
@@ -1311,17 +1324,17 @@
count = ((unsigned long) end) - ((unsigned long) start);
if (hwc_data.ioctls.tolower)
- EBC_TOLOWER(start, count);
+ EBC_TOLOWER (start, count);
if (hwc_data.ioctls.delim)
- count = seperate_cases(start, count);
+ count = seperate_cases (start, count);
if (hwc_data.ioctls.echo)
- do_hwc_write(0, start, count, CODE_EBCDIC, IMMEDIATE_WRITE);
+ do_hwc_write (0, start, count, CODE_EBCDIC, IMMEDIATE_WRITE);
if (hwc_data.ioctls.code == CODE_ASCII) {
if (MACHINE_IS_VM)
- EBCASC(start, count);
+ EBCASC (start, count);
else
EBCASC_500 (start, count);
}
@@ -1343,15 +1356,15 @@
subvec = start;
while (((void *) subvec) < end) {
- subvec = find_gds_subvector(subvec, end, 0x30);
+ subvec = find_gds_subvector (subvec, end, 0x30);
if (!subvec)
break;
subvec_data = (void *)
- (((unsigned long) subvec) +
- sizeof(gds_subvector_t));
+ (((unsigned long) subvec) +
+ sizeof (gds_subvector_t));
subvec_end = (void *)
- (((unsigned long) subvec) + subvec->length);
- retval += get_input(subvec_data, subvec_end);
+ (((unsigned long) subvec) + subvec->length);
+ retval += get_input (subvec_data, subvec_end);
subvec = (gds_subvector_t *) subvec_end;
}
@@ -1369,16 +1382,16 @@
subvec = start;
while (((void *) subvec) < end) {
- subvec = find_gds_subvector(
- subvec, end, GDS_KEY_SelfDefTextMsg);
+ subvec = find_gds_subvector (
+ subvec, end, GDS_KEY_SelfDefTextMsg);
if (!subvec)
break;
subvec_data = (gds_subvector_t *)
- (((unsigned long) subvec) +
- sizeof(gds_subvector_t));
+ (((unsigned long) subvec) +
+ sizeof (gds_subvector_t));
subvec_end = (void *)
- (((unsigned long) subvec) + subvec->length);
- retval += eval_selfdeftextmsg(subvec_data, subvec_end);
+ (((unsigned long) subvec) + subvec->length);
+ retval += eval_selfdeftextmsg (subvec_data, subvec_end);
subvec = (gds_subvector_t *) subvec_end;
}
@@ -1396,13 +1409,13 @@
vec = start;
while (((void *) vec) < end) {
- vec = find_gds_vector(vec, end, GDS_ID_TextCmd);
+ vec = find_gds_vector (vec, end, GDS_ID_TextCmd);
if (!vec)
break;
vec_data = (gds_subvector_t *)
- (((unsigned long) vec) + sizeof(gds_vector_t));
+ (((unsigned long) vec) + sizeof (gds_vector_t));
vec_end = (void *) (((unsigned long) vec) + vec->length);
- retval += eval_textcmd(vec_data, vec_end);
+ retval += eval_textcmd (vec_data, vec_end);
vec = (gds_vector_t *) vec_end;
}
@@ -1417,12 +1430,12 @@
void *vec_end;
int retval = 0;
- vec = find_gds_vector(start, end, GDS_ID_CPMSU);
+ vec = find_gds_vector (start, end, GDS_ID_CPMSU);
if (vec) {
vec_data = (gds_vector_t *)
- (((unsigned long) vec) + sizeof(gds_vector_t));
+ (((unsigned long) vec) + sizeof (gds_vector_t));
vec_end = (void *) (((unsigned long) vec) + vec->length);
- retval = eval_cpmsu(vec_data, vec_end);
+ retval = eval_cpmsu (vec_data, vec_end);
}
return retval;
}
@@ -1435,12 +1448,12 @@
void *vec_end;
int retval = 0;
- vec = find_gds_vector(start, end, GDS_ID_MDSMU);
+ vec = find_gds_vector (start, end, GDS_ID_MDSMU);
if (vec) {
vec_data = (gds_vector_t *)
- (((unsigned long) vec) + sizeof(gds_vector_t));
+ (((unsigned long) vec) + sizeof (gds_vector_t));
vec_end = (void *) (((unsigned long) vec) + vec->length);
- retval = eval_mdsmu(vec_data, vec_end);
+ retval = eval_mdsmu (vec_data, vec_end);
}
return retval;
}
@@ -1456,39 +1469,39 @@
evbuf = (evbuf_t *) start;
while (((void *) evbuf) < end) {
evbuf_data = (gds_vector_t *)
- (((unsigned long) evbuf) + sizeof(evbuf_t));
+ (((unsigned long) evbuf) + sizeof (evbuf_t));
evbuf_end = (void *) (((unsigned long) evbuf) + evbuf->length);
switch (evbuf->type) {
- case ET_OpCmd :
- case ET_CntlProgOpCmd :
- case ET_PMsgCmd :
+ case ET_OpCmd:
+ case ET_CntlProgOpCmd:
+ case ET_PMsgCmd:
#ifdef DUMP_HWCB_INPUT
-
- internal_print(
- DELAYED_WRITE,
- HWC_RW_PRINT_HEADER
- "event buffer "
- "at 0x%x up to 0x%x, length: %d\n",
- (unsigned long) evbuf,
- (unsigned long) (evbuf_end - 1),
- evbuf->length);
- dump_storage_area((void *)evbuf, evbuf->length);
+
+ internal_print (
+ DELAYED_WRITE,
+ HWC_RW_PRINT_HEADER
+ "event buffer "
+ "at 0x%x up to 0x%x, length: %d\n",
+ (unsigned long) evbuf,
+ (unsigned long) (evbuf_end - 1),
+ evbuf->length);
+ dump_storage_area ((void *) evbuf, evbuf->length);
#endif
- retval += eval_evbuf(evbuf_data, evbuf_end);
- break;
- case ET_StateChange :
-
- retval = -ENOSYS;
- break;
- default :
- printk(
- KERN_WARNING
- HWC_RW_PRINT_HEADER
- "unconditional read: "
- "unknown event buffer found, "
- "type 0x%x",
- evbuf->type);
- retval = -ENOSYS;
+ retval += eval_evbuf (evbuf_data, evbuf_end);
+ break;
+ case ET_StateChange:
+
+ retval = -ENOSYS;
+ break;
+ default:
+ printk (
+ KERN_WARNING
+ HWC_RW_PRINT_HEADER
+ "unconditional read: "
+ "unknown event buffer found, "
+ "type 0x%x",
+ evbuf->type);
+ retval = -ENOSYS;
}
evbuf = (evbuf_t *) evbuf_end;
}
@@ -1501,40 +1514,40 @@
unsigned short int condition_code;
read_hwcb_t *hwcb = (read_hwcb_t *) hwc_data.page;
int retval;
-
+
if ((!hwc_data.read_prio) && (!hwc_data.read_nonprio))
return -EOPNOTSUPP;
if (hwc_data.current_servc)
return -EBUSY;
-
- memset(hwcb, 0x00, PAGE_SIZE);
- memcpy(hwcb, &read_hwcb_template, sizeof(read_hwcb_t));
- condition_code = service_call(HWC_CMDW_READDATA, hwc_data.page);
+ memset (hwcb, 0x00, PAGE_SIZE);
+ memcpy (hwcb, &read_hwcb_template, sizeof (read_hwcb_t));
-#ifdef DUMP_HWC_READ_ERROR
+ condition_code = service_call (HWC_CMDW_READDATA, hwc_data.page);
+
+#ifdef DUMP_HWC_READ_ERROR
if (condition_code == HWC_NOT_OPERATIONAL)
- __asm__("LHI 1,0xe40\n\t"
- "L 2,0(0,%0)\n\t"
- "LRA 3,0(0,%1)\n\t"
- "J .+0 \n\t"
- :
- :"a"(&condition_code), "a"(hwc_data.page)
- :"1", "2", "3");
-#endif
+ __asm__ ("LHI 1,0xe40\n\t"
+ "L 2,0(0,%0)\n\t"
+ "LRA 3,0(0,%1)\n\t"
+ "J .+0 \n\t"
+ :
+ : "a" (&condition_code), "a" (hwc_data.page)
+ : "1", "2", "3");
+#endif
switch (condition_code) {
- case HWC_COMMAND_INITIATED :
- hwc_data.current_servc = HWC_CMDW_READDATA;
- hwc_data.current_hwcb = hwc_data.page;
- retval = condition_code;
- break;
- case HWC_BUSY :
- retval = -EBUSY;
- break;
- default :
- retval = -EIO;
+ case HWC_COMMAND_INITIATED:
+ hwc_data.current_servc = HWC_CMDW_READDATA;
+ hwc_data.current_hwcb = hwc_data.page;
+ retval = condition_code;
+ break;
+ case HWC_BUSY:
+ retval = -EBUSY;
+ break;
+ default:
+ retval = -EIO;
}
return retval;
@@ -1545,33 +1558,33 @@
{
read_hwcb_t *hwcb = (read_hwcb_t *) hwc_data.page;
-#ifdef DUMP_HWC_READ_ERROR
+#ifdef DUMP_HWC_READ_ERROR
if ((hwcb->response_code != 0x0020) &&
(hwcb->response_code != 0x0220) &&
(hwcb->response_code != 0x60F0) &&
(hwcb->response_code != 0x62F0))
- __asm__("LHI 1,0xe41\n\t"
- "LRA 2,0(0,%0)\n\t"
- "L 3,0(0,%1)\n\t"
- "J .+0\n\t"
- :
- :"a"(hwc_data.page), "a"(&(hwcb->response_code))
- :"1", "2", "3");
-#endif
+ __asm__ ("LHI 1,0xe41\n\t"
+ "LRA 2,0(0,%0)\n\t"
+ "L 3,0(0,%1)\n\t"
+ "J .+0\n\t"
+ :
+ : "a" (hwc_data.page), "a" (&(hwcb->response_code))
+ : "1", "2", "3");
+#endif
hwc_data.current_servc = 0;
hwc_data.current_hwcb = NULL;
switch (hwcb->response_code) {
- case 0x0020 :
- case 0x0220 :
- return process_evbufs(
- (void *) (((unsigned long) hwcb) + sizeof(read_hwcb_t)),
- (void *) (((unsigned long) hwcb) + hwcb->length));
+ case 0x0020:
+ case 0x0220:
+ return process_evbufs (
+ (void *) (((unsigned long) hwcb) + sizeof (read_hwcb_t)),
+ (void *) (((unsigned long) hwcb) + hwcb->length));
- case 0x60F0 :
- case 0x62F0 :
+ case 0x60F0:
+ case 0x62F0:
internal_print (
IMMEDIATE_WRITE,
HWC_RW_PRINT_HEADER
@@ -1581,67 +1594,67 @@
hwcb->response_code);
return 0;
- case 0x0100 :
- internal_print(
- IMMEDIATE_WRITE,
- HWC_RW_PRINT_HEADER
- "unconditional read: HWCB boundary violation - this "
- "must not occur in a correct driver, please contact "
- "author\n");
+ case 0x0100:
+ internal_print (
+ IMMEDIATE_WRITE,
+ HWC_RW_PRINT_HEADER
+ "unconditional read: HWCB boundary violation - this "
+ "must not occur in a correct driver, please contact "
+ "author\n");
return -EIO;
- case 0x0300 :
- internal_print(
- IMMEDIATE_WRITE,
- HWC_RW_PRINT_HEADER
- "unconditional read: "
+ case 0x0300:
+ internal_print (
+ IMMEDIATE_WRITE,
+ HWC_RW_PRINT_HEADER
+ "unconditional read: "
"insufficient HWCB length - this must not occur in a "
- "correct driver, please contact author\n");
+ "correct driver, please contact author\n");
return -EIO;
- case 0x01F0 :
- internal_print(
- IMMEDIATE_WRITE,
- HWC_RW_PRINT_HEADER
- "unconditional read: "
- "invalid command - this must not occur in a correct "
- "driver, please contact author\n");
+ case 0x01F0:
+ internal_print (
+ IMMEDIATE_WRITE,
+ HWC_RW_PRINT_HEADER
+ "unconditional read: "
+ "invalid command - this must not occur in a correct "
+ "driver, please contact author\n");
return -EIO;
- case 0x40F0 :
- internal_print(
- IMMEDIATE_WRITE,
- HWC_RW_PRINT_HEADER
- "unconditional read: invalid function code - this "
- "must not occur in a correct driver, please contact "
- "author\n");
+ case 0x40F0:
+ internal_print (
+ IMMEDIATE_WRITE,
+ HWC_RW_PRINT_HEADER
+ "unconditional read: invalid function code - this "
+ "must not occur in a correct driver, please contact "
+ "author\n");
return -EIO;
- case 0x70F0 :
- internal_print(
- IMMEDIATE_WRITE,
- HWC_RW_PRINT_HEADER
- "unconditional read: invalid selection mask - this "
- "must not occur in a correct driver, please contact "
- "author\n");
+ case 0x70F0:
+ internal_print (
+ IMMEDIATE_WRITE,
+ HWC_RW_PRINT_HEADER
+ "unconditional read: invalid selection mask - this "
+ "must not occur in a correct driver, please contact "
+ "author\n");
return -EIO;
- case 0x0040 :
- internal_print(
- IMMEDIATE_WRITE,
- HWC_RW_PRINT_HEADER
- "unconditional read: HWC equipment check - don't "
- "know how to handle this case\n");
+ case 0x0040:
+ internal_print (
+ IMMEDIATE_WRITE,
+ HWC_RW_PRINT_HEADER
+ "unconditional read: HWC equipment check - don't "
+ "know how to handle this case\n");
return -EIO;
-
- default :
- internal_print(
- IMMEDIATE_WRITE,
- HWC_RW_PRINT_HEADER
+
+ default:
+ internal_print (
+ IMMEDIATE_WRITE,
+ HWC_RW_PRINT_HEADER
"unconditional read: invalid response code %x - this "
- "must not occur in a correct driver, please contact "
- "author\n",
- hwcb->response_code);
+ "must not occur in a correct driver, please contact "
+ "author\n",
+ hwcb->response_code);
return -EIO;
}
}
@@ -1651,32 +1664,32 @@
{
unsigned int condition_code;
int retval;
-
- condition_code = service_call(HWC_CMDW_WRITEMASK, hwc_data.page);
+
+ condition_code = service_call (HWC_CMDW_WRITEMASK, hwc_data.page);
#ifdef DUMP_HWC_INIT_ERROR
if (condition_code == HWC_NOT_OPERATIONAL)
- __asm__("LHI 1,0xe10\n\t"
- "L 2,0(0,%0)\n\t"
- "LRA 3,0(0,%1)\n\t"
- "J .+0\n\t"
- :
- :"a"(&condition_code), "a"(hwc_data.page)
- :"1", "2", "3");
-#endif
+ __asm__ ("LHI 1,0xe10\n\t"
+ "L 2,0(0,%0)\n\t"
+ "LRA 3,0(0,%1)\n\t"
+ "J .+0\n\t"
+ :
+ : "a" (&condition_code), "a" (hwc_data.page)
+ : "1", "2", "3");
+#endif
switch (condition_code) {
- case HWC_COMMAND_INITIATED :
- hwc_data.current_servc = HWC_CMDW_WRITEMASK;
- hwc_data.current_hwcb = hwc_data.page;
- retval = condition_code;
- break;
- case HWC_BUSY :
- retval = -EBUSY;
- break;
- default :
- retval = -EIO;
+ case HWC_COMMAND_INITIATED:
+ hwc_data.current_servc = HWC_CMDW_WRITEMASK;
+ hwc_data.current_hwcb = hwc_data.page;
+ retval = condition_code;
+ break;
+ case HWC_BUSY:
+ retval = -EBUSY;
+ break;
+ default:
+ retval = -EIO;
}
return retval;
@@ -1690,10 +1703,10 @@
if (hwcb->hwc_receive_mask & ET_Msg_Mask)
hwc_data.write_nonprio = 1;
-
+
if (hwcb->hwc_receive_mask & ET_PMsgCmd_Mask)
hwc_data.write_prio = 1;
-
+
if (hwcb->hwc_send_mask & ET_OpCmd_Mask) {
internal_print (DELAYED_WRITE,
HWC_RW_PRINT_HEADER
@@ -1710,16 +1723,16 @@
(!hwc_data.write_nonprio) ||
((!hwc_data.read_nonprio) && (!hwc_data.read_prio)))
#ifdef DUMP_HWC_INIT_ERROR
- __asm__("LHI 1,0xe11\n\t"
- "LRA 2,0(0,%0)\n\t"
- "L 3,0(0,%1)\n\t"
- "J .+0\n\t"
- :
- :"a"(hwcb), "a"(&(hwcb->response_code))
- :"1", "2", "3");
+ __asm__ ("LHI 1,0xe11\n\t"
+ "LRA 2,0(0,%0)\n\t"
+ "L 3,0(0,%1)\n\t"
+ "J .+0\n\t"
+ :
+ : "a" (hwcb), "a" (&(hwcb->response_code))
+ : "1", "2", "3");
#else
retval = -EIO;
-#endif
+#endif
hwc_data.current_servc = 0;
hwc_data.current_hwcb = NULL;
@@ -1732,7 +1745,7 @@
{
int retval = 0;
hwc_ioctls_t tmp;
-
+
if (ioctls->width_htab > MAX_MESSAGE_SIZE) {
if (correct)
tmp.width_htab = MAX_MESSAGE_SIZE;
@@ -1742,7 +1755,7 @@
tmp.width_htab = ioctls->width_htab;
tmp.echo = ioctls->echo;
-
+
if (ioctls->columns > MAX_MESSAGE_SIZE) {
if (correct)
tmp.columns = MAX_MESSAGE_SIZE;
@@ -1750,21 +1763,21 @@
retval = -EINVAL;
} else
tmp.columns = ioctls->columns;
-
+
switch (ioctls->code) {
- case CODE_EBCDIC :
- case CODE_ASCII :
- tmp.code = ioctls->code;
- break;
- default :
- if (correct)
- tmp.code = CODE_ASCII;
+ case CODE_EBCDIC:
+ case CODE_ASCII:
+ tmp.code = ioctls->code;
+ break;
+ default:
+ if (correct)
+ tmp.code = CODE_ASCII;
else
retval = -EINVAL;
}
-
+
tmp.final_nl = ioctls->final_nl;
-
+
if (ioctls->max_hwcb < 2) {
if (correct)
tmp.max_hwcb = 2;
@@ -1772,9 +1785,9 @@
retval = -EINVAL;
} else
tmp.max_hwcb = ioctls->max_hwcb;
-
+
tmp.tolower = ioctls->tolower;
-
+
if (ioctls->kmem_hwcb > ioctls->max_hwcb) {
if (correct)
tmp.kmem_hwcb = ioctls->max_hwcb;
@@ -1782,7 +1795,7 @@
retval = -EINVAL;
} else
tmp.kmem_hwcb = ioctls->kmem_hwcb;
-
+
if (ioctls->kmem_hwcb > MAX_KMEM_PAGES) {
if (correct)
ioctls->kmem_hwcb = MAX_KMEM_PAGES;
@@ -1797,6 +1810,10 @@
}
tmp.delim = ioctls->delim;
+ tmp.measured_lines = ioctls->measured_lines;
+ tmp.measured_chars = ioctls->measured_chars;
+ tmp.measured_wcalls = ioctls->measured_wcalls;
+
if (!(retval < 0))
hwc_data.ioctls = tmp;
@@ -1864,7 +1881,7 @@
if (register_external_interrupt (0x2401, do_hwc_interrupt) != 0)
panic ("Couldn't request external interrupts 0x2401");
- spin_lock_init(&hwc_data.lock);
+ spin_lock_init (&hwc_data.lock);
#ifdef USE_VM_DETECTION
@@ -1880,7 +1897,7 @@
hwc_data.init_ioctls.delim = 0;
}
#endif
- retval = set_hwc_ioctls(&hwc_data.init_ioctls, 1);
+ retval = set_hwc_ioctls (&hwc_data.init_ioctls, 1);
*kmem_start = (*kmem_start + PAGE_SIZE - 1) & -4096L;
hwc_data.kmem_start = *kmem_start;
@@ -1889,26 +1906,26 @@
retval = do_hwc_init ();
- ctl_set_bit(0, 9);
+ ctl_set_bit (0, 9);
-#ifdef BUFFER_STRESS_TEST
+#ifdef BUFFER_STRESS_TEST
- internal_print(
- DELAYED_WRITE,
- HWC_RW_PRINT_HEADER
- "use %i bytes for buffering.\n",
- hwc_data.ioctls.kmem_hwcb * PAGE_SIZE);
+ internal_print (
+ DELAYED_WRITE,
+ HWC_RW_PRINT_HEADER
+ "use %i bytes for buffering.\n",
+ hwc_data.ioctls.kmem_hwcb * PAGE_SIZE);
for (i = 0; i < 500; i++) {
hwcb = (init_hwcb_t *) BUF_HWCB;
- internal_print(
- DELAYED_WRITE,
- HWC_RW_PRINT_HEADER
- "This is stress test message #%i, free: %i bytes\n",
- i,
- MAX_HWCB_ROOM - (hwcb->length + sizeof(mto_t)));
+ internal_print (
+ DELAYED_WRITE,
+ HWC_RW_PRINT_HEADER
+ "This is stress test message #%i, free: %i bytes\n",
+ i,
+ MAX_HWCB_ROOM - (hwcb->length + sizeof (mto_t)));
}
-#endif
+#endif
return /*retval */ 0;
}
@@ -1956,34 +1973,34 @@
" temporary breakdown\n");
}
} else {
- spin_lock(&hwc_data.lock);
+ spin_lock (&hwc_data.lock);
- if (!hwc_data.current_servc) {
+ if (!hwc_data.current_servc) {
- unconditional_read_1();
+ unconditional_read_1 ();
- } else {
+ } else {
- switch (hwc_data.current_servc) {
+ switch (hwc_data.current_servc) {
- case HWC_CMDW_WRITEMASK :
+ case HWC_CMDW_WRITEMASK:
- write_event_mask_2();
+ write_event_mask_2 ();
break;
-
- case HWC_CMDW_WRITEDATA :
- write_event_data_2();
+ case HWC_CMDW_WRITEDATA:
+
+ write_event_data_2 ();
break;
- case HWC_CMDW_READDATA :
+ case HWC_CMDW_READDATA:
- unconditional_read_2();
+ unconditional_read_2 ();
break;
- }
+ }
- write_event_data_1();
- }
+ write_event_data_1 ();
+ }
if (hwc_data.calls != NULL)
if (hwc_data.calls->wake_up != NULL)
(hwc_data.calls->wake_up) ();
@@ -1996,7 +2013,7 @@
{
spin_lock (&hwc_data.lock);
- spin_unlock(&hwc_data.lock);
+ spin_unlock (&hwc_data.lock);
asm volatile ("STCTL 0,0,%0":"=m" (cr0));
cr0_save = cr0;
@@ -2021,39 +2038,45 @@
int retval = 0;
unsigned long flags;
unsigned int obuf;
-
- spin_lock_irqsave(&hwc_data.lock, flags);
-
+
+ spin_lock_irqsave (&hwc_data.lock, flags);
+
switch (cmd) {
- case TIOCHWCSHTAB :
- if (get_user(tmp.width_htab, (ioctl_htab_t *) arg))
+ case TIOCHWCSMEAS:
+ hwc_data.ioctls.measured_lines = 0;
+ hwc_data.ioctls.measured_chars = 0;
+ hwc_data.ioctls.measured_wcalls = 0;
+ break;
+
+ case TIOCHWCSHTAB:
+ if (get_user (tmp.width_htab, (ioctl_htab_t *) arg))
goto fault;
break;
-
- case TIOCHWCSECHO :
- if (get_user(tmp.echo, (ioctl_echo_t *) arg))
+
+ case TIOCHWCSECHO:
+ if (get_user (tmp.echo, (ioctl_echo_t *) arg))
goto fault;
break;
-
- case TIOCHWCSCOLS :
- if (get_user(tmp.columns, (ioctl_cols_t *) arg))
+
+ case TIOCHWCSCOLS:
+ if (get_user (tmp.columns, (ioctl_cols_t *) arg))
goto fault;
break;
-
- case TIOCHWCSCODE :
- if (get_user(tmp.code, (ioctl_code_t *) arg))
+
+ case TIOCHWCSCODE:
+ if (get_user (tmp.code, (ioctl_code_t *) arg))
goto fault;
break;
-
- case TIOCHWCSNL :
- if (get_user(tmp.final_nl, (ioctl_nl_t *) arg))
+
+ case TIOCHWCSNL:
+ if (get_user (tmp.final_nl, (ioctl_nl_t *) arg))
goto fault;
break;
- case TIOCHWCSOBUF :
- if (get_user(obuf, (unsigned int *) arg))
+ case TIOCHWCSOBUF:
+ if (get_user (obuf, (unsigned int *) arg))
goto fault;
if (obuf & 0xFFF)
tmp.max_hwcb = (((obuf | 0xFFF) + 1) >> 12);
@@ -2061,93 +2084,108 @@
tmp.max_hwcb = (obuf >> 12);
break;
- case TIOCHWCSCASE :
- if (get_user(tmp.tolower, (ioctl_case_t *) arg))
+ case TIOCHWCSCASE:
+ if (get_user (tmp.tolower, (ioctl_case_t *) arg))
goto fault;
break;
-
- case TIOCHWCSDELIM :
- if (get_user(tmp.delim, (ioctl_delim_t *) arg))
+
+ case TIOCHWCSDELIM:
+ if (get_user (tmp.delim, (ioctl_delim_t *) arg))
goto fault;
break;
- case TIOCHWCSINIT :
- retval = set_hwc_ioctls(&hwc_data.init_ioctls, 1);
+ case TIOCHWCSINIT:
+ retval = set_hwc_ioctls (&hwc_data.init_ioctls, 1);
break;
- case TIOCHWCGHTAB :
- if (put_user(tmp.width_htab, (ioctl_htab_t *) arg))
+ case TIOCHWCGMEASL:
+ if (put_user (tmp.measured_lines, (ioctl_meas_t *) arg))
goto fault;
break;
- case TIOCHWCGECHO :
- if (put_user(tmp.echo, (ioctl_echo_t *) arg))
+ case TIOCHWCGMEASC:
+ if (put_user (tmp.measured_chars, (ioctl_meas_t *) arg))
goto fault;
break;
- case TIOCHWCGCOLS :
- if (put_user(tmp.columns, (ioctl_cols_t *) arg))
+ case TIOCHWCGMEASS:
+ if (put_user (tmp.measured_wcalls, (ioctl_meas_t *) arg))
goto fault;
break;
- case TIOCHWCGCODE :
- if (put_user(tmp.code, (ioctl_code_t *) arg))
+ case TIOCHWCGHTAB:
+ if (put_user (tmp.width_htab, (ioctl_htab_t *) arg))
goto fault;
+ break;
+ case TIOCHWCGECHO:
+ if (put_user (tmp.echo, (ioctl_echo_t *) arg))
+ goto fault;
break;
- case TIOCHWCGNL :
- if (put_user(tmp.final_nl, (ioctl_nl_t *) arg))
+ case TIOCHWCGCOLS:
+ if (put_user (tmp.columns, (ioctl_cols_t *) arg))
goto fault;
break;
- case TIOCHWCGOBUF :
- if (put_user(tmp.max_hwcb, (ioctl_obuf_t *) arg))
+ case TIOCHWCGCODE:
+ if (put_user (tmp.code, (ioctl_code_t *) arg))
goto fault;
+
break;
- case TIOCHWCGKBUF :
- if (put_user(tmp.kmem_hwcb, (ioctl_obuf_t *) arg))
+ case TIOCHWCGNL:
+ if (put_user (tmp.final_nl, (ioctl_nl_t *) arg))
goto fault;
break;
- case TIOCHWCGCASE :
- if (put_user(tmp.tolower, (ioctl_case_t *) arg))
+ case TIOCHWCGOBUF:
+ if (put_user (tmp.max_hwcb, (ioctl_obuf_t *) arg))
goto fault;
break;
-
- case TIOCHWCGDELIM :
- if (put_user(tmp.delim, (ioctl_delim_t *) arg))
+
+ case TIOCHWCGKBUF:
+ if (put_user (tmp.kmem_hwcb, (ioctl_obuf_t *) arg))
goto fault;
break;
-#if 0
-
- case TIOCHWCGINIT :
- if (put_user(&hwc_data.init_ioctls, (hwc_ioctls_t *) arg))
+
+ case TIOCHWCGCASE:
+ if (put_user (tmp.tolower, (ioctl_case_t *) arg))
goto fault;
break;
- case TIOCHWCGCURR :
- if (put_user(&hwc_data.ioctls, (hwc_ioctls_t *) arg))
+ case TIOCHWCGDELIM:
+ if (put_user (tmp.delim, (ioctl_delim_t *) arg))
+ goto fault;
+ break;
+#if 0
+
+ case TIOCHWCGINIT:
+ if (put_user (&hwc_data.init_ioctls, (hwc_ioctls_t *) arg))
+ goto fault;
+ break;
+
+ case TIOCHWCGCURR:
+ if (put_user (&hwc_data.ioctls, (hwc_ioctls_t *) arg))
goto fault;
break;
#endif
-
- default :
+
+ default:
goto noioctlcmd;
}
- if (_IOC_DIR(cmd) == _IOC_WRITE)
- retval = set_hwc_ioctls(&tmp, 0);
+ if (_IOC_DIR (cmd) == _IOC_WRITE)
+ retval = set_hwc_ioctls (&tmp, 0);
goto out;
- fault:
- retval = -EFAULT;
- goto out;
- noioctlcmd:
- retval = -ENOIOCTLCMD;
- out:
- spin_unlock_irqrestore(&hwc_data.lock, flags);
- return retval;
+ fault:
+ retval = -EFAULT;
+ goto out;
+ noioctlcmd:
+ retval = -ENOIOCTLCMD;
+ out:
+ spin_unlock_irqrestore (&hwc_data.lock, flags);
+ return retval;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)