From: Alexander Graf <agraf@suse.de>
To: qemu-devel@nongnu.org
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
Dominik Dingel <dingel@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 08/12] S390: ccw firmware: Add glue header
Date: Mon, 22 Apr 2013 21:18:14 +0200 [thread overview]
Message-ID: <1366658298-9275-9-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1366658298-9275-1-git-send-email-agraf@suse.de>
Like all great programs, we have to call between different functions in
different object files. And all of them need a common ground of defines.
Provide a file that provides these defines.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
pc-bios/s390-ccw/s390-ccw.h | 131 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 131 insertions(+), 0 deletions(-)
create mode 100644 pc-bios/s390-ccw/s390-ccw.h
diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h
new file mode 100644
index 0000000..a03dbaf
--- /dev/null
+++ b/pc-bios/s390-ccw/s390-ccw.h
@@ -0,0 +1,131 @@
+/*
+ * S390 CCW boot loader
+ *
+ * Copyright (c) 2013 Alexander Graf <agraf@suse.de>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or (at
+ * your option) any later version. See the COPYING file in the top-level
+ * directory.
+ */
+
+#ifndef S390_CCW_H
+#define S390_CCW_H
+
+/* #define DEBUG */
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned int u32;
+typedef unsigned long long u64;
+typedef unsigned long ulong;
+typedef 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;
+typedef unsigned char __u8;
+typedef unsigned short __u16;
+typedef unsigned int __u32;
+typedef unsigned long long __u64;
+
+#define true 1
+#define false 0
+#define PAGE_SIZE 4096
+
+#ifndef EIO
+#define EIO 1
+#endif
+#ifndef EBUSY
+#define EBUSY 2
+#endif
+#ifndef NULL
+#define NULL 0
+#endif
+
+#include "cio.h"
+
+/* main.c */
+void virtio_panic(const char *string);
+
+/* sclp-ascii.c */
+void sclp_print(const char *string);
+void sclp_setup(void);
+
+/* virtio.c */
+unsigned long virtio_load_direct(ulong rec_list1, ulong rec_list2,
+ ulong subchan_id, void *load_addr);
+bool virtio_is_blk(struct subchannel_id schid);
+void virtio_setup_block(struct subchannel_id schid);
+int virtio_read(ulong sector, void *load_addr);
+
+/* bootmap.c */
+int zipl_load(void);
+
+static inline void *memset(void *s, int c, size_t n)
+{
+ int i;
+ unsigned char *p = s;
+
+ for (i = 0; i < n; i++) {
+ p[i] = c;
+ }
+
+ return s;
+}
+
+static inline void fill_hex(char *out, unsigned char val)
+{
+ const char hex[] = "0123456789abcdef";
+
+ out[0] = hex[(val >> 4) & 0xf];
+ out[1] = hex[val & 0xf];
+}
+
+static inline void print_int(const char *desc, u64 addr)
+{
+ unsigned char *addr_c = (unsigned char*)&addr;
+ char out[] = ": 0xffffffffffffffff\n";
+ unsigned int i;
+
+ for (i = 0; i < sizeof(addr); i++) {
+ fill_hex(&out[4 + (i*2)], addr_c[i]);
+ }
+
+ sclp_print(desc);
+ sclp_print(out);
+}
+
+static inline void debug_print_int(const char *desc, u64 addr)
+{
+#ifdef DEBUG
+ print_int(desc, addr);
+#endif
+}
+
+static inline void debug_print_addr(const char *desc, void *p)
+{
+#ifdef DEBUG
+ debug_print_int(desc, (unsigned int)(unsigned long)p);
+#endif
+}
+
+/***********************************************
+ * Hypercall functions *
+ ***********************************************/
+
+#define KVM_S390_VIRTIO_NOTIFY 0
+#define KVM_S390_VIRTIO_RESET 1
+#define KVM_S390_VIRTIO_SET_STATUS 2
+#define KVM_S390_VIRTIO_CCW_NOTIFY 3
+
+static inline void yield(void)
+{
+ asm volatile ("diag 0,0,0x44"
+ : :
+ : "memory", "cc");
+}
+
+#define SECTOR_SIZE 512
+
+#endif /* S390_CCW_H */
--
1.6.0.2
next prev parent reply other threads:[~2013-04-22 19:19 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-22 19:18 [Qemu-devel] [PATCH 00/12] S390: Add virtio-ccw firmware Alexander Graf
2013-04-22 19:18 ` [Qemu-devel] [PATCH 01/12] S390: Make IPL reset address dynamic Alexander Graf
2013-04-22 19:18 ` [Qemu-devel] [PATCH 02/12] S390: IPL: Support ELF firmware Alexander Graf
2013-04-22 19:18 ` [Qemu-devel] [PATCH 03/12] S390: IPL: Use different firmware for different machines Alexander Graf
2013-04-22 19:18 ` [Qemu-devel] [PATCH 04/12] S390: ccw firmware: Add start assembly Alexander Graf
2013-04-22 19:18 ` [Qemu-devel] [PATCH 05/12] S390: ccw firmware: Add main program Alexander Graf
2013-04-23 8:43 ` Christian Borntraeger
2013-04-23 8:58 ` Cornelia Huck
2013-04-23 11:35 ` Alexander Graf
2013-04-23 11:51 ` Cornelia Huck
2013-04-22 19:18 ` [Qemu-devel] [PATCH 06/12] S390: ccw firmware: Add sclp output Alexander Graf
2013-04-22 19:18 ` [Qemu-devel] [PATCH 07/12] S390: ccw firmware: Add virtio device drivers Alexander Graf
2013-04-23 11:24 ` Cornelia Huck
2013-04-22 19:18 ` Alexander Graf [this message]
2013-04-22 19:18 ` [Qemu-devel] [PATCH 09/12] S390: ccw firmware: Add bootmap interpreter Alexander Graf
2013-04-22 19:18 ` [Qemu-devel] [PATCH 10/12] S390: ccw firmware: Add Makefile Alexander Graf
2013-04-23 10:31 ` Christian Borntraeger
2013-04-22 19:18 ` [Qemu-devel] [PATCH 11/12] S390: ccw firmware: Add compiled blob Alexander Graf
2013-04-22 19:18 ` [Qemu-devel] [PATCH 12/12] S390: CCW: Use new, working firmware by default Alexander Graf
2013-04-23 9:20 ` [Qemu-devel] [PATCH 00/12] S390: Add virtio-ccw firmware Christian Borntraeger
2013-04-23 11:38 ` Alexander Graf
2013-04-23 11:23 ` [Qemu-devel] [PATCH 0/4] updates for s390-ccw.img Christian Borntraeger
2013-04-23 11:23 ` [Qemu-devel] [PATCH 1/4] s390-ccw.img: replace while loop with a disabled wait on s390 bios Christian Borntraeger
2013-04-23 11:23 ` [Qemu-devel] [PATCH 2/4] s390-ccw.img: build s390-ccw rom on s3900 system by default Christian Borntraeger
2013-04-23 11:23 ` [Qemu-devel] [PATCH 3/4] s390-ccw.img: Fix compile warning in s390 ccw virtio code Christian Borntraeger
2013-04-23 11:31 ` Alexander Graf
2013-04-23 11:45 ` Christian Borntraeger
2013-04-26 6:38 ` Alexander Graf
2013-04-23 11:23 ` [Qemu-devel] [PATCH 4/4] s390-ccw.img: Take care of the elf->img transition Christian Borntraeger
2013-04-23 11:33 ` [Qemu-devel] [PATCH 0/4] updates for s390-ccw.img Alexander Graf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1366658298-9275-9-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=dingel@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).