diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile | 3 | ||||
-rw-r--r-- | lib/libhvcall/Makefile | 2 | ||||
-rw-r--r-- | lib/libhvcall/hvcall.code | 41 | ||||
-rw-r--r-- | lib/libhvcall/hvcall.in | 7 | ||||
-rw-r--r-- | lib/libvirtio/Makefile | 53 | ||||
-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.code | 53 | ||||
-rw-r--r-- | lib/libvirtio/virtio.h (renamed from lib/libhvcall/virtio.h) | 0 | ||||
-rw-r--r-- | lib/libvirtio/virtio.in | 18 |
11 files changed, 126 insertions, 54 deletions
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) |