Commit 17c64879 authored by David Hildenbrand's avatar David Hildenbrand Committed by Paolo Bonzini
Browse files

s390x: compile sclp-ascii.c



We can reuse strlen and memcpy. __pa(x) is already defined in page.h
We don't have (and need) defines for error values and consuming sclp
irqs is not required, as we won't be passing control to some other OS.
Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
Message-Id: <20170522085702.17856-5-david@redhat.com>
Reviewed-by: default avatarThomas Huth <thuth@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 71b608db
......@@ -8,7 +8,9 @@
* directory.
*/
#include "s390-ccw.h"
#include <libcflat.h>
#include <string.h>
#include <asm/page.h>
#include "sclp.h"
static char _sccb[PAGE_SIZE] __attribute__((__aligned__(4096)));
......@@ -24,11 +26,10 @@ static int sclp_service_call(unsigned int command, void *sccb)
" srl %0,28"
: "=&d" (cc) : "d" (command), "a" (__pa(sccb))
: "cc", "memory");
consume_sclp_int();
if (cc == 3)
return -EIO;
return -1;
if (cc == 2)
return -EBUSY;
return -1;
return 0;
}
......@@ -51,24 +52,9 @@ void sclp_setup(void)
sclp_set_write_mask();
}
static int _strlen(const char *str)
{
int i;
for (i = 0; *str; i++)
str++;
return i;
}
static void _memcpy(char *dest, const char *src, int len)
{
int i;
for (i = 0; i < len; i++)
dest[i] = src[i];
}
void sclp_print(const char *str)
{
int len = _strlen(str);
int len = strlen(str);
WriteEventData *sccb = (void *)_sccb;
sccb->h.length = sizeof(WriteEventData) + len;
......@@ -76,7 +62,7 @@ void sclp_print(const char *str)
sccb->ebh.length = sizeof(EventBufferHeader) + len;
sccb->ebh.type = SCLP_EVENT_ASCII_CONSOLE_DATA;
sccb->ebh.flags = 0;
_memcpy(sccb->data, str, len);
memcpy(sccb->data, str, len);
sclp_service_call(SCLP_CMD_WRITE_EVENT_DATA, sccb);
}
......@@ -102,6 +102,4 @@ typedef struct ReadEventData {
uint32_t mask;
} __attribute__((packed)) ReadEventData;
#define __pa(x) (x)
#endif /* SCLP_H */
......@@ -19,6 +19,7 @@ cflatobjs += lib/util.o
cflatobjs += lib/alloc.o
cflatobjs += lib/s390x/io.o
cflatobjs += lib/s390x/stack.o
cflatobjs += lib/s390x/sclp-ascii.o
OBJDIRS += lib/s390x
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment