Skip to content

Commit

Permalink
pc-bios/s390-ccw: Add fill_hex_val func to provide better msgs
Browse files Browse the repository at this point in the history
Factor out helper function for dumping a hex value into a buffer.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
  • Loading branch information
Eugene (jno) Dvurechenski authored and cohuck committed Jun 27, 2014
1 parent 60612d5 commit 058cc1f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions pc-bios/s390-ccw/s390-ccw.h
Expand Up @@ -86,15 +86,21 @@ static inline void fill_hex(char *out, unsigned char val)
out[1] = hex[val & 0xf];
}

static inline void print_int(const char *desc, u64 addr)
static inline void fill_hex_val(char *out, void *ptr, unsigned size)
{
unsigned char *addr_c = (unsigned char *)&addr;
char out[] = ": 0xffffffffffffffff\n";
unsigned char *value = ptr;
unsigned int i;

for (i = 0; i < sizeof(addr); i++) {
fill_hex(&out[4 + (i*2)], addr_c[i]);
for (i = 0; i < size; i++) {
fill_hex(&out[i*2], value[i]);
}
}

static inline void print_int(const char *desc, u64 addr)
{
char out[] = ": 0xffffffffffffffff\n";

fill_hex_val(&out[4], &addr, sizeof(addr));

sclp_print(desc);
sclp_print(out);
Expand Down

0 comments on commit 058cc1f

Please sign in to comment.