aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board-qemu/slof/Makefile5
-rw-r--r--lib/Makefile2
-rw-r--r--lib/libusb/Makefile49
-rw-r--r--lib/libusb/usb-core.c20
-rw-r--r--lib/libusb/usb-core.h35
-rw-r--r--lib/libusb/usb-ohci.c43
-rw-r--r--lib/libusb/usb.code26
-rw-r--r--lib/libusb/usb.h25
-rw-r--r--lib/libusb/usb.in16
-rw-r--r--slof/fs/usb/usb-static.fs5
10 files changed, 223 insertions, 3 deletions
diff --git a/board-qemu/slof/Makefile b/board-qemu/slof/Makefile
index 5ac1925..164dfd5 100644
--- a/board-qemu/slof/Makefile
+++ b/board-qemu/slof/Makefile
@@ -20,16 +20,19 @@ include $(TOPCMNDIR)/make.rules
all: Makefile.dep OF.ffs paflof $(SLOFCMNDIR)/xvect.bin
CPPFLAGS = -I$(LIBCMNDIR)/libbootmsg -I$(LIBCMNDIR)/libhvcall \
- -I$(LIBCMNDIR)/libvirtio -I$(LIBCMNDIR)/libnvram
+ -I$(LIBCMNDIR)/libvirtio -I$(LIBCMNDIR)/libnvram \
+ -I$(LIBCMNDIR)/libusb
SLOF_LIBS = \
$(LIBCMNDIR)/libbootmsg.a \
$(LIBCMNDIR)/libelf.a \
$(LIBCMNDIR)/libhvcall.a \
$(LIBCMNDIR)/libvirtio.a \
+ $(LIBCMNDIR)/libusb.a \
$(LIBCMNDIR)/libnvram.a
BOARD_SLOF_IN = \
$(LIBCMNDIR)/libhvcall/hvcall.in \
$(LIBCMNDIR)/libvirtio/virtio.in \
+ $(LIBCMNDIR)/libusb/usb.in \
$(LIBCMNDIR)/libbootmsg/bootmsg.in \
$(LIBCMNDIR)/libelf/libelf.in \
$(LIBCMNDIR)/libnvram/libnvram.in \
diff --git a/lib/Makefile b/lib/Makefile
index b3bd44f..fb1562f 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -10,7 +10,7 @@
# * IBM Corporation - initial implementation
# ****************************************************************************/
-SUBDIRS = libc libipmi libbootmsg libbases libnvram libelf libhvcall libvirtio
+SUBDIRS = libc libipmi libbootmsg libbases libnvram libelf libhvcall libvirtio libusb
all: subdirs
diff --git a/lib/libusb/Makefile b/lib/libusb/Makefile
index e69de29..25c8002 100644
--- a/lib/libusb/Makefile
+++ b/lib/libusb/Makefile
@@ -0,0 +1,49 @@
+# *****************************************************************************
+# * 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 = ../libusb.a
+
+
+all: $(TARGET)
+
+SRCS = usb-core.c usb-ohci.c
+
+OBJS = $(SRCS:%.c=%.o)
+
+$(TARGET): $(OBJS)
+ $(AR) -rc $@ $(OBJS)
+ $(RANLIB) $@
+
+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/libusb/usb-core.c b/lib/libusb/usb-core.c
new file mode 100644
index 0000000..7aa918a
--- /dev/null
+++ b/lib/libusb/usb-core.c
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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 "usb-core.h"
+
+void usb_hcd_register(struct usb_hcd_ops *ops)
+{
+ if (!ops)
+ printf("Error");
+ printf("Registering %s\n", ops->name);
+}
diff --git a/lib/libusb/usb-core.h b/lib/libusb/usb-core.h
new file mode 100644
index 0000000..649cb95
--- /dev/null
+++ b/lib/libusb/usb-core.h
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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
+ *****************************************************************************/
+
+#ifndef __USB_CORE_H
+#define __USB_CORE_H
+
+#include <stdio.h>
+
+enum usb_hcd_type {
+ USB_OHCI = 1,
+ USB_EHCI = 2,
+ USB_XHCI = 3,
+};
+
+struct usb_hcd_ops {
+ const char *name;
+ void (*init)(void);
+ void (*detect)(void);
+ void (*disconnect)(void);
+ struct usb_hcd_ops *next;
+ unsigned int usb_type;
+};
+
+extern void usb_hcd_register(struct usb_hcd_ops *ops);
+
+#endif
diff --git a/lib/libusb/usb-ohci.c b/lib/libusb/usb-ohci.c
new file mode 100644
index 0000000..7f65b71
--- /dev/null
+++ b/lib/libusb/usb-ohci.c
@@ -0,0 +1,43 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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 "usb.h"
+#include "usb-core.h"
+
+static void ohci_init(void)
+{
+
+}
+
+static void ohci_detect(void)
+{
+
+}
+
+static void ohci_disconnect(void)
+{
+
+}
+
+struct usb_hcd_ops ohci_ops = {
+ .name = "ohci-hcd",
+ .init = ohci_init,
+ .detect = ohci_detect,
+ .disconnect = ohci_disconnect,
+ .usb_type = USB_OHCI,
+ .next = NULL,
+};
+
+void usb_ohci_register(void)
+{
+ usb_hcd_register(&ohci_ops);
+}
diff --git a/lib/libusb/usb.code b/lib/libusb/usb.code
new file mode 100644
index 0000000..73b77cb
--- /dev/null
+++ b/lib/libusb/usb.code
@@ -0,0 +1,26 @@
+/******************************************************************************
+ * Copyright (c) 2013 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
+ *****************************************************************************/
+/*
+ * libusb bindings for SLOF - implementation
+ */
+
+#include <usb.h>
+
+
+/************************************************/
+/* Register with the usb-core */
+/* SLOF: USB-OHCI-REGISTER ( -- ) */
+/* LIBNEWUSB: usb_ohci_register(void) */
+/************************************************/
+PRIM(USB_X2d_OHCI_X2d_REGISTER)
+ usb_ohci_register();
+MIRP
diff --git a/lib/libusb/usb.h b/lib/libusb/usb.h
new file mode 100644
index 0000000..ef944ad
--- /dev/null
+++ b/lib/libusb/usb.h
@@ -0,0 +1,25 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2012, 2013 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
+ *****************************************************************************/
+/*
+ * prototypes for libusb implementation used in libusb.code
+ */
+
+#ifndef __LIBUSB_H
+#define __LIBUSB_H
+
+/*******************************************/
+/* SLOF: USB-OHCI-REGISTER */
+/*******************************************/
+extern void usb_ohci_register(void);
+
+#endif
+
diff --git a/lib/libusb/usb.in b/lib/libusb/usb.in
new file mode 100644
index 0000000..ad2dad1
--- /dev/null
+++ b/lib/libusb/usb.in
@@ -0,0 +1,16 @@
+/******************************************************************************
+ * Copyright (c) 2007, 2012, 2013 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
+ *****************************************************************************/
+/*
+ * libusb bindings for SLOF - definitions
+ */
+
+cod(USB-OHCI-REGISTER)
diff --git a/slof/fs/usb/usb-static.fs b/slof/fs/usb/usb-static.fs
index 9d40fc0..e6b3fd5 100644
--- a/slof/fs/usb/usb-static.fs
+++ b/slof/fs/usb/usb-static.fs
@@ -41,4 +41,7 @@
: usb-scan ( -- )
." Scanning USB " cr
-;
+ ohci-alias-num 1 >= IF
+ USB-OHCI-REGISTER
+ then
+; \ No newline at end of file