xemu/pc-bios/s390-ccw/libc.h
Jason J. Herne 86c58705bb s390-bios: cio error handling
Add verbose error output for when unexpected i/o errors happen. This eases the
burden of debugging and reporting i/o errors. No error information is printed
in the success case, here is an example of what is output on error:

cio device error
  ssid  : 0x0000000000000000
  cssid : 0x0000000000000000
  sch_no: 0x0000000000000000

Interrupt Response Block Data:
    Function Ctrl : [Start]
    Activity Ctrl : [Start-Pending]
    Status Ctrl : [Alert] [Primary] [Secondary] [Status-Pending]
    Device Status : [Unit-Check]
    Channel Status :
    cpa=: 0x000000007f8d6038
    prev_ccw=: 0x0000000000000000
    this_ccw=: 0x0000000000000000
Eckd Dasd Sense Data (fmt 32-bytes):
    Sense Condition Flags :
    Residual Count     =: 0x0000000000000000
    Phys Drive ID      =: 0x000000000000009e
    low cyl address    =: 0x0000000000000000
    head addr & hi cyl =: 0x0000000000000000
    format/message     =: 0x0000000000000008
    fmt-dependent[0-7] =: 0x0000000000000004
    fmt-dependent[8-15]=: 0xe561282305082fff
    prog action code   =: 0x0000000000000016
    Configuration info =: 0x00000000000040e0
    mcode / hi-cyl     =: 0x0000000000000000
    cyl & head addr [0]=: 0x0000000000000000
    cyl & head addr [1]=: 0x0000000000000000
    cyl & head addr [2]=: 0x0000000000000000

The Sense Data section is currently only printed for ECKD DASD.

Signed-off-by: Jason J. Herne <jjherne@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <1554388475-18329-10-git-send-email-jjherne@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2019-04-12 12:40:35 +02:00

90 lines
1.7 KiB
C

/*
* libc-style definitions and functions
*
* Copyright (c) 2013 Alexander Graf <agraf@suse.de>
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#ifndef S390_CCW_LIBC_H
#define S390_CCW_LIBC_H
typedef unsigned long size_t;
typedef int bool;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
static inline void *memset(void *s, int c, size_t n)
{
size_t i;
unsigned char *p = s;
for (i = 0; i < n; i++) {
p[i] = c;
}
return s;
}
static inline void *memcpy(void *s1, const void *s2, size_t n)
{
uint8_t *dest = s1;
const uint8_t *src = s2;
size_t i;
for (i = 0; i < n; i++) {
dest[i] = src[i];
}
return s1;
}
static inline int memcmp(const void *s1, const void *s2, size_t n)
{
size_t i;
const uint8_t *p1 = s1, *p2 = s2;
for (i = 0; i < n; i++) {
if (p1[i] != p2[i]) {
return p1[i] > p2[i] ? 1 : -1;
}
}
return 0;
}
static inline size_t strlen(const char *str)
{
size_t i;
for (i = 0; *str; i++) {
str++;
}
return i;
}
static inline char *strcat(char *dest, const char *src)
{
int i;
char *dest_end = dest + strlen(dest);
for (i = 0; i <= strlen(src); i++) {
dest_end[i] = src[i];
}
return dest;
}
static inline int isdigit(int c)
{
return (c >= '0') && (c <= '9');
}
uint64_t atoui(const char *str);
char *uitoa(uint64_t num, char *str, size_t len);
#endif