aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board-qemu/Makefile2
-rw-r--r--board-qemu/slof/Makefile4
-rw-r--r--board-qemu/virtio-net/Makefile7
-rw-r--r--board-qemu/virtio-net/module_entry.c1
-rw-r--r--lib/Makefile3
-rw-r--r--lib/libhvcall/Makefile2
-rw-r--r--lib/libhvcall/hvcall.code41
-rw-r--r--lib/libhvcall/hvcall.in7
-rw-r--r--lib/libvirtio/Makefile53
-rw-r--r--lib/libvirtio/virtio-blk.c (renamed from lib/libhvcall/virtio-blk.c)2
-rw-r--r--lib/libvirtio/virtio-blk.h (renamed from lib/libhvcall/virtio-blk.h)0
-rw-r--r--lib/libvirtio/virtio.c (renamed from lib/libhvcall/virtio.c)1
-rw-r--r--lib/libvirtio/virtio.code53
-rw-r--r--lib/libvirtio/virtio.h (renamed from lib/libhvcall/virtio.h)0
-rw-r--r--lib/libvirtio/virtio.in18
15 files changed, 135 insertions, 59 deletions
diff --git a/board-qemu/Makefile b/board-qemu/Makefile
index f2a382c..6072a86 100644
--- a/board-qemu/Makefile
+++ b/board-qemu/Makefile
@@ -14,7 +14,7 @@ BOARD_TARGETS = tools_build romfs_build clients_build netdrivers stage1 subdirs
SUBDIRS = slof veth virtio-net
-COMMON_LIBS = libc libbootmsg libbases libnvram libelf libhvcall
+COMMON_LIBS = libc libbootmsg libbases libnvram libelf libhvcall libvirtio
all: $(BOARD_TARGETS)
$(MAKE) boot_rom.bin
diff --git a/board-qemu/slof/Makefile b/board-qemu/slof/Makefile
index e230db3..f7c1892 100644
--- a/board-qemu/slof/Makefile
+++ b/board-qemu/slof/Makefile
@@ -20,14 +20,16 @@ include $(TOPCMNDIR)/make.rules
all: Makefile.dep OF.ffs paflof $(SLOFCMNDIR)/xvect.bin
CPPFLAGS = -I$(LIBCMNDIR)/libbootmsg -I$(LIBCMNDIR)/libhvcall \
- -I$(LIBCMNDIR)/libnvram
+ -I$(LIBCMNDIR)/libvirtio -I$(LIBCMNDIR)/libnvram
SLOF_LIBS = \
$(LIBCMNDIR)/libbootmsg.a \
$(LIBCMNDIR)/libelf.a \
$(LIBCMNDIR)/libhvcall.a \
+ $(LIBCMNDIR)/libvirtio.a \
$(LIBCMNDIR)/libnvram.a
BOARD_SLOF_IN = \
$(LIBCMNDIR)/libhvcall/hvcall.in \
+ $(LIBCMNDIR)/libvirtio/virtio.in \
$(LIBCMNDIR)/libbootmsg/bootmsg.in \
$(LIBCMNDIR)/libelf/libelf.in \
$(LIBCMNDIR)/libnvram/libnvram.in \
diff --git a/board-qemu/virtio-net/Makefile b/board-qemu/virtio-net/Makefile
index 765044e..009e10f 100644
--- a/board-qemu/virtio-net/Makefile
+++ b/board-qemu/virtio-net/Makefile
@@ -17,7 +17,10 @@ endif
include $(TOP)/make.rules
CPPFLAGS = -I./ -I$(TOP)/clients/net-snk/include/ -I$(TOP)/lib/libc/include/ \
- -I$(TOP)/lib/libhvcall -I$(INCLCMNDIR) -I$(INCLCMNDIR)/$(CPUARCH)
+ -I$(TOP)/lib/libhvcall -I$(TOP)/lib/libvirtio -I$(INCLCMNDIR) \
+ -I$(INCLCMNDIR)/$(CPUARCH)
+
+LIBS = $(TOP)/lib/libc.a $(TOP)/lib/libhvcall.a $(TOP)/lib/libvirtio.a
SRCS = module_entry.c virtio-net.c vn-pci.c
@@ -25,7 +28,7 @@ OBJS = $(SRCS:%.c=%.o)
all: net_virtio.elf
-net_virtio.elf: $(OBJS) $(TOP)/lib/libc.a $(TOP)/lib/libhvcall.a
+net_virtio.elf: $(OBJS) $(LIBS)
$(LD) $(LDFLAGS) $^ -o $@ -T virtio-net.lds -N -q
$(STRIP) --strip-unneeded $@
diff --git a/board-qemu/virtio-net/module_entry.c b/board-qemu/virtio-net/module_entry.c
index 9e6ceda..2d2ca94 100644
--- a/board-qemu/virtio-net/module_entry.c
+++ b/board-qemu/virtio-net/module_entry.c
@@ -12,7 +12,6 @@
#include <string.h>
#include <netdriver_int.h>
-#include <libhvcall.h>
#include "virtio-net.h"
extern char __module_start[];
diff --git a/lib/Makefile b/lib/Makefile
index ae03f8f..b3bd44f 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -10,8 +10,7 @@
# * IBM Corporation - initial implementation
# ****************************************************************************/
-SUBDIRS = libc libipmi libbootmsg libbases libnvram libelf libhvcall
-
+SUBDIRS = libc libipmi libbootmsg libbases libnvram libelf libhvcall libvirtio
all: subdirs
diff --git a/lib/libhvcall/Makefile b/lib/libhvcall/Makefile
index da30a07..53ed98f 100644
--- a/lib/libhvcall/Makefile
+++ b/lib/libhvcall/Makefile
@@ -22,7 +22,7 @@ TARGET = ../libhvcall.a
all: $(TARGET)
-SRCS = virtio.c virtio-blk.c
+SRCS =
SRCSS = hvcall.S
diff --git a/lib/libhvcall/hvcall.code b/lib/libhvcall/hvcall.code
index e07a2ef..ebaaac8 100644
--- a/lib/libhvcall/hvcall.code
+++ b/lib/libhvcall/hvcall.code
@@ -11,8 +11,6 @@
*****************************************************************************/
#include <libhvcall.h>
-#include <virtio.h>
-#include <virtio-blk.h>
// : hv-putchar ( hvtermno char -- )
PRIM(hv_X2d_putchar)
@@ -97,42 +95,3 @@ PRIM(RX_X21)
hv_logical_ci_store(8, qaddr, val);
MIRP
-
-// : virtio-vring-size ( queuesize -- ringsize )
-PRIM(virtio_X2d_vring_X2d_size)
- TOS.u = virtio_vring_size(TOS.u);
-MIRP
-
-// : virtio-get-qsize ( dev queue -- queuesize )
-PRIM(virtio_X2d_get_X2d_qsize)
- int queue = TOS.u; POP;
- TOS.u = virtio_get_qsize(TOS.a, queue);
-MIRP
-
-// : virtio-get-config ( dev offset size -- val )
-PRIM(virtio_X2d_get_X2d_config)
- int size = TOS.u; POP;
- int offset = TOS.u; POP;
- TOS.u = virtio_get_config(TOS.a, offset, size);
-MIRP
-
-// : virtio-blk-init ( dev -- )
-PRIM(virtio_X2d_blk_X2d_init)
- void *dev = TOS.a; POP;
- virtioblk_init(dev);
-MIRP
-
-// : virtio-blk-shutdown ( dev -- )
-PRIM(virtio_X2d_blk_X2d_shutdown)
- void *dev = TOS.a; POP;
- virtioblk_shutdown(dev);
-MIRP
-
-// : virtio-blk-read ( dev blkno cnt reg -- #read )
-PRIM(virtio_X2d_blk_X2d_read)
- void *dev = TOS.a; POP;
- long cnt = TOS.n; POP;
- long blkno = TOS.n; POP;
- void *buf = TOS.a;
- TOS.n = virtioblk_read(dev, buf, blkno, cnt);
-MIRP
diff --git a/lib/libhvcall/hvcall.in b/lib/libhvcall/hvcall.in
index b28eedf..abbb2c8 100644
--- a/lib/libhvcall/hvcall.in
+++ b/lib/libhvcall/hvcall.in
@@ -26,10 +26,3 @@ cod(RL@)
cod(RL!)
cod(RX@)
cod(RX!)
-
-cod(virtio-vring-size)
-cod(virtio-get-qsize)
-cod(virtio-get-config)
-cod(virtio-blk-init)
-cod(virtio-blk-shutdown)
-cod(virtio-blk-read)
diff --git a/lib/libvirtio/Makefile b/lib/libvirtio/Makefile
new file mode 100644
index 0000000..e4fb34e
--- /dev/null
+++ b/lib/libvirtio/Makefile
@@ -0,0 +1,53 @@
+# *****************************************************************************
+# * Copyright (c) 2004, 2008 IBM Corporation
+# * All rights reserved.
+# * This program and the accompanying materials
+# * are made available under the terms of the BSD License
+# * which accompanies this distribution, and is available at
+# * http://www.opensource.org/licenses/bsd-license.php
+# *
+# * Contributors:
+# * IBM Corporation - initial implementation
+# ****************************************************************************/
+
+TOPCMNDIR ?= ../..
+
+ASFLAGS = $(FLAG) $(RELEASE) $(CPUARCHDEF) -Wa,-mregnames
+CPPFLAGS = -I../libc/include $(CPUARCHDEF) -I$(INCLBRDDIR) \
+ -I$(INCLCMNDIR) -I$(INCLCMNDIR)/$(CPUARCH)
+LDFLAGS = -nostdlib
+
+TARGET = ../libvirtio.a
+
+
+all: $(TARGET)
+
+SRCS = virtio.c virtio-blk.c
+
+OBJS = $(SRCS:%.c=%.o)
+
+$(TARGET): $(OBJS)
+ $(AR) -rc $@ $(OBJS)
+ $(RANLIB) $@
+
+%.o: %.S
+ $(CC) $(CPPFLAGS) $(ASFLAGS) -c $< -o $@
+
+clean:
+ $(RM) $(TARGET) $(OBJS)
+
+distclean: clean
+ $(RM) Makefile.dep
+
+
+# Rules for creating the dependency file:
+depend:
+ $(RM) Makefile.dep
+ $(MAKE) Makefile.dep
+
+Makefile.dep: Makefile
+ $(CC) -M $(CPPFLAGS) $(CFLAGS) $(SRCS) $(SRCSS) > Makefile.dep
+
+# Include dependency file if available:
+-include Makefile.dep
+
diff --git a/lib/libhvcall/virtio-blk.c b/lib/libvirtio/virtio-blk.c
index d4cdb04..7b1e795 100644
--- a/lib/libhvcall/virtio-blk.c
+++ b/lib/libvirtio/virtio-blk.c
@@ -13,8 +13,6 @@
#include <stdio.h>
#include "virtio.h"
#include "virtio-blk.h"
-#include "libhvcall.h"
-
#define sync() asm volatile (" sync \n" ::: "memory")
diff --git a/lib/libhvcall/virtio-blk.h b/lib/libvirtio/virtio-blk.h
index 7c2b7e0..7c2b7e0 100644
--- a/lib/libhvcall/virtio-blk.h
+++ b/lib/libvirtio/virtio-blk.h
diff --git a/lib/libhvcall/virtio.c b/lib/libvirtio/virtio.c
index 0a3e91b..4e70053 100644
--- a/lib/libhvcall/virtio.c
+++ b/lib/libvirtio/virtio.c
@@ -14,7 +14,6 @@
#include <cache.h>
#include <byteorder.h>
#include "virtio.h"
-#include "libhvcall.h"
/* PCI virtio header offsets */
#define VIRTIOHDR_DEVICE_FEATURES 0
diff --git a/lib/libvirtio/virtio.code b/lib/libvirtio/virtio.code
new file mode 100644
index 0000000..0ed3dc7
--- /dev/null
+++ b/lib/libvirtio/virtio.code
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * Copyright (c) 2004, 2011 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials
+ * are made available under the terms of the BSD License
+ * which accompanies this distribution, and is available at
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * Contributors:
+ * IBM Corporation - initial implementation
+ *****************************************************************************/
+
+#include <virtio.h>
+#include <virtio-blk.h>
+
+// : virtio-vring-size ( queuesize -- ringsize )
+PRIM(virtio_X2d_vring_X2d_size)
+ TOS.u = virtio_vring_size(TOS.u);
+MIRP
+
+// : virtio-get-qsize ( dev queue -- queuesize )
+PRIM(virtio_X2d_get_X2d_qsize)
+ int queue = TOS.u; POP;
+ TOS.u = virtio_get_qsize(TOS.a, queue);
+MIRP
+
+// : virtio-get-config ( dev offset size -- val )
+PRIM(virtio_X2d_get_X2d_config)
+ int size = TOS.u; POP;
+ int offset = TOS.u; POP;
+ TOS.u = virtio_get_config(TOS.a, offset, size);
+MIRP
+
+// : virtio-blk-init ( dev -- )
+PRIM(virtio_X2d_blk_X2d_init)
+ void *dev = TOS.a; POP;
+ virtioblk_init(dev);
+MIRP
+
+// : virtio-blk-shutdown ( dev -- )
+PRIM(virtio_X2d_blk_X2d_shutdown)
+ void *dev = TOS.a; POP;
+ virtioblk_shutdown(dev);
+MIRP
+
+// : virtio-blk-read ( dev blkno cnt reg -- #read )
+PRIM(virtio_X2d_blk_X2d_read)
+ void *dev = TOS.a; POP;
+ long cnt = TOS.n; POP;
+ long blkno = TOS.n; POP;
+ void *buf = TOS.a;
+ TOS.n = virtioblk_read(dev, buf, blkno, cnt);
+MIRP
diff --git a/lib/libhvcall/virtio.h b/lib/libvirtio/virtio.h
index 7355043..7355043 100644
--- a/lib/libhvcall/virtio.h
+++ b/lib/libvirtio/virtio.h
diff --git a/lib/libvirtio/virtio.in b/lib/libvirtio/virtio.in
new file mode 100644
index 0000000..1f2cfd1
--- /dev/null
+++ b/lib/libvirtio/virtio.in
@@ -0,0 +1,18 @@
+/******************************************************************************
+ * Copyright (c) 2004, 2011 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials
+ * are made available under the terms of the BSD License
+ * which accompanies this distribution, and is available at
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * Contributors:
+ * IBM Corporation - initial implementation
+ *****************************************************************************/
+
+cod(virtio-vring-size)
+cod(virtio-get-qsize)
+cod(virtio-get-config)
+cod(virtio-blk-init)
+cod(virtio-blk-shutdown)
+cod(virtio-blk-read)