usb: Upgrade to Linux-3.8.6 stack

This commit is contained in:
Sebastian Sumpf 2013-04-17 17:58:46 +02:00 committed by Norman Feske
parent 2faca15b2b
commit 529e791d66
23 changed files with 866 additions and 318 deletions

View File

@ -9,32 +9,43 @@ VERBOSE ?= @
ECHO = @echo
PATCHES := $(shell find patches -name \*.patch)
LINUX = linux-3.2.2
LINUX = linux-3.8.6
LINUX_TBZ2 = $(LINUX).tar.bz2
LINUX_URL = http://www.kernel.org/pub/linux/kernel/v3.x/$(LINUX_TBZ2)
# Linux utilities
CONTENT += include/linux/list.h
CONTENT += $(addprefix include/linux/,pci_ids.h pci_regs.h usb.h hid.h hiddev.h input.h mod_devicetable.h)
CONTENT += $(addprefix include/linux/byteorder/,generic.h little_endian.h)
CONTENT += $(addprefix include/linux/,pci_ids.h usb.h hid.h hiddev.h input.h mod_devicetable.h)
CONTENT += include/linux/byteorder/generic.h
CONTENT += include/linux/swab.h
CONTENT += $(addprefix include/asm-generic/bitops/,__ffs.h non-atomic.h)
CONTENT_UAPI = byteorder/little_endian.h hid.h input.h pci_regs.h usb/ch11.h \
usb/ch9.h
CONTENT_USB = ch9.h phy.h
CONTENT += $(addprefix include/uapi/linux/,$(CONTENT_UAPI))
CONTENT += $(addprefix include/linux/usb/,$(CONTENT_USB))
CONTENT += include/uapi/asm-generic/ioctl.h
# USB core
CONTENT += drivers/usb/core
CONTENT_CORE = buffer.c config.c devices.c driver.c endpoint.c file.c generic.c \
hcd.c hcd-pci.c hub.c message.c notify.c quirks.c urb.c \
usb.c usb.h
CONTENT += $(addprefix drivers/usb/core/,$(CONTENT_CORE))
CONTENT += drivers/usb/usb-common.c
CONTENT_INCLUDE_USB := ch11.h ch9.h ehci_def.h hcd.h input.h otg.h quirks.h storage.h
CONTENT_INCLUDE_USB := ehci_def.h hcd.h input.h otg.h quirks.h storage.h
CONTENT += $(addprefix include/linux/usb/,$(CONTENT_INCLUDE_USB))
# needed by usb/core/devio.c
CONTENT += include/linux/usbdevice_fs.h include/asm-generic/ioctl.h
CONTENT += include/asm-generic/ioctl.h
# USB host-controller driver
CONTENT_USB_HOST := ehci.h ehci-hcd.c ehci-hub.c ehci-dbg.c ehci-mem.c \
ehci-omap.c ehci-q.c ehci-pci.c ehci-s5p.c ehci-sched.c \
ehci-sysfs.c
ehci-sysfs.c ehci-timer.c
CONTENT_USB_HOST += ohci.h ohci-hcd.c ohci-hub.c ohci-dbg.c ohci-mem.c \
ohci-q.c ohci-pci.c ehci-lpm.c
ohci-q.c ohci-pci.c
CONTENT_USB_HOST += uhci-hcd.h uhci-hcd.c uhci-debug.c uhci-q.c uhci-hub.c \
uhci-pci.c
CONTENT_USB_HOST += pci-quirks.h pci-quirks.c xhci-ext-caps.h
@ -49,7 +60,7 @@ CONTENT += $(addprefix drivers/scsi/,scsi.h scsi.c constants.c scsi_priv.h scsi_
CONTENT += $(addprefix include/scsi/,scsi.h scsi_host.h)
# USB hid driver
CONTENT += drivers/hid/hid-input.c drivers/hid/hid-core.c drivers/hid/hid-ids.h
CONTENT += drivers/hid/hid-input.c drivers/hid/hid-generic.c drivers/hid/hid-core.c drivers/hid/hid-ids.h
CONTENT += drivers/hid/hid-cherry.c drivers/hid/usbhid
# needed by USB hid
@ -62,14 +73,15 @@ CONTENT_NET = usbnet.c
# Panda board
CONTENT_NET += smsc95xx.c smsc95xx.h
# Arndale board
CONTENT_NET += asix.c
CONTENT_NET += asix_devices.c asix_common.c ax88172a.c asix.h
CONTENT += $(addprefix drivers/net/usb/,$(CONTENT_NET))
CONTENT += include/linux/usb/usbnet.h
CONTENT += include/linux/usb/usbnet.h include/linux/netdev_features.h
# Arndale
CONTENT_ARNDALE = ehci.h usb-phy.h
CONTENT += $(addprefix arch/arm/plat-samsung/include/plat/,$(CONTENT_ARNDALE))
CONTENT += arch/arm/plat-samsung/include/plat/usb-phy.h
CONTENT += include/linux/platform_data/usb-ehci-s5p.h
#
#
@ -102,6 +114,7 @@ $(CONTRIB_DIR)/.prepared: $(DOWNLOAD_DIR)/$(LINUX_TBZ2)
$(VERBOSE)touch $@
$(ECHO) "applying patches to '$(CONTRIB_DIR)/'"
$(VERBOSE)for i in $(PATCHES); do patch -d $(CONTRIB_DIR) -p1 < $$i; done
$(VERBOSE)ln -sf ../../uapi/linux/usb/ch11.h $(CONTRIB_DIR)/include/linux/usb/ch11.h
$(DOWNLOAD_DIR):

View File

@ -1,9 +1,9 @@
SRC_C += usbnet.c asix.c
SRC_C += usbnet.c asix_devices.c asix_common.c ax88172a.c
include $(REP_DIR)/lib/mk/usb.inc
include $(REP_DIR)/lib/mk/arm/usb.inc
CC_OPT += -DCONFIG_USB_EHCI_S5P -DCONFIG_USB_EHCI_TT_NEWSCHED
CC_OPT += -DCONFIG_USB_EHCI_S5P -DCONFIG_USB_EHCI_TT_NEWSCHED -DCONFIG_OF
INC_DIR += $(CONTRIB_DIR)/arch/arm/plat-samsung/include
SRC_CC += platform.cc

View File

@ -10,18 +10,20 @@ CONTRIB_DIR := $(REP_DIR)/contrib
DRIVERS_DIR := $(CONTRIB_DIR)/drivers
USB_DIR := $(DRIVERS_DIR)/usb
CC_OLEVEL = -O0
#
# The order of include-search directories is important, we need to look into
# 'contrib' before falling back to our custom 'lx_emul.h' header.
#
INC_DIR += $(LIB_INC_DIR)
INC_DIR += $(CONTRIB_DIR)/include
INC_DIR += $(CONTRIB_DIR)/include $(CONTRIB_DIR)
CC_OPT += -U__linux__ -D__KERNEL__
CC_OPT += -DCONFIG_USB_DEVICEFS -DCONFIG_HOTPLUG -DDEBUG
CC_WARN = -Wall -Wno-unused-variable -Wno-uninitialized \
-Wno-unused-function \
-Wno-unused-function -Wno-overflow
CC_C_OPT += -Wno-implicit-function-declaration -Wno-unused-but-set-variable \
-Wno-pointer-sign
@ -41,7 +43,7 @@ SRC_C += $(addprefix usb/host/, ehci-hcd.c)
# USB hid
SRC_C += $(addprefix hid/usbhid/, hid-core.c hid-quirks.c)
SRC_C += $(addprefix hid/, hid-core.c hid-input.c hid-cherry.c)
SRC_C += $(addprefix hid/, hid-core.c hid-generic.c hid-input.c hid-cherry.c)
SRC_C += $(addprefix input/, evdev.c input.c)
# USB storage
@ -85,6 +87,7 @@ $(SRC_C:.c=.o) $(SRC_CC:.cc=.o): $(GEN_INCLUDES)
# Add suffix, since there are two hid-core.c with the same module init function
#
hid/hid-core.o: MOD_SUFFIX="_core"
hid/hid-generic.o: MOD_SUFFIX="_generic"
$(GEN_INCLUDES):
$(VERBOSE)mkdir -p $(dir $@)

View File

@ -1,7 +1,7 @@
SRC_C += $(addprefix usb/host/,pci-quirks.c uhci-hcd.c)
SRC_C += $(addprefix usb/host/,pci-quirks.c uhci-hcd.c ehci-pci.c)
include $(REP_DIR)/lib/mk/usb.inc
CC_OPT += -DCONFIG_PCI
CC_OPT += -DCONFIG_PCI -DCONFIG_USB_EHCI_PCI=1 -DCONFIG_USB_XHCI_HCD=0
INC_DIR += $(LIB_INC_DIR)/x86_32 $(LIB_INC_DIR)/x86
SRC_CC += pci_driver.cc

View File

@ -1,7 +1,7 @@
SRC_C += $(addprefix usb/host/,pci-quirks.c uhci-hcd.c)
SRC_C += $(addprefix usb/host/,pci-quirks.c uhci-hcd.c ehci-pci.c)
include $(REP_DIR)/lib/mk/usb.inc
CC_OPT += -DCONFIG_PCI
CC_OPT += -DCONFIG_PCI -DCONFIG_USB_EHCI_PCI=1 -DCONFIG_USB_XHCI_HCD=0
INC_DIR += $(LIB_INC_DIR)/x86_64 $(LIB_INC_DIR)/x86
SRC_CC += pci_driver.cc

View File

@ -1,55 +0,0 @@
--- download/linux-3.2.2/drivers/net/usb/asix.c 2012-01-26 01:39:32.000000000 +0100
+++ contrib/drivers/net/usb/asix.c 2013-03-18 15:36:10.106168580 +0100
@@ -191,7 +191,7 @@
netdev_dbg(dev->net, "asix_read_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d\n",
cmd, value, index, size);
- buf = kmalloc(size, GFP_KERNEL);
+ buf = kmalloc(size, GFP_NOIO);
if (!buf)
goto out;
@@ -225,7 +225,7 @@
cmd, value, index, size);
if (data) {
- buf = kmemdup(data, size, GFP_KERNEL);
+ buf = kmemdup(data, size, GFP_NOIO);
if (!buf)
goto out;
}
@@ -270,13 +270,13 @@
netdev_dbg(dev->net, "asix_write_cmd_async() cmd=0x%02x value=0x%04x index=0x%04x size=%d\n",
cmd, value, index, size);
- urb = usb_alloc_urb(0, GFP_ATOMIC);
+ urb = usb_alloc_urb(0, GFP_NOIO);
if (!urb) {
netdev_err(dev->net, "Error allocating URB in write_cmd_async!\n");
return;
}
- req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC);
+ req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO);
if (!req) {
netdev_err(dev->net, "Failed to allocate memory for control request\n");
usb_free_urb(urb);
@@ -294,7 +294,7 @@
(void *)req, data, size,
asix_async_cmd_callback, req);
- status = usb_submit_urb(urb, GFP_ATOMIC);
+ status = usb_submit_urb(urb, GFP_NOIO);
if (status < 0) {
netdev_err(dev->net, "Error submitting the control message: status=%d\n",
status);
@@ -1051,6 +1051,9 @@
dbg("Write IPG,IPG1,IPG2 failed: %d", ret);
goto out;
}
+
+ if (!is_valid_ether_addr(dev->net->dev_addr))
+ random_ether_addr(dev->net->dev_addr);
/* Rewrite MAC address */
memcpy(data->mac_addr, dev->net->dev_addr, ETH_ALEN);

View File

@ -1,7 +1,7 @@
diff -r 4d66ab105ff0 drivers/net/usb/smsc95xx.c
--- a/drivers/net/usb/smsc95xx.c Fri Jul 06 17:50:36 2012 +0200
+++ b/drivers/net/usb/smsc95xx.c Fri Jul 06 17:55:13 2012 +0200
@@ -1032,7 +1032,12 @@
diff -r c094ecb374e9 drivers/net/usb/smsc95xx.c
--- a/drivers/net/usb/smsc95xx.c Thu Apr 11 15:47:15 2013 +0200
+++ b/drivers/net/usb/smsc95xx.c Thu Apr 11 15:52:01 2013 +0200
@@ -1747,7 +1747,13 @@
static void smsc95xx_rx_csum_offload(struct sk_buff *skb)
{
@ -12,6 +12,7 @@ diff -r 4d66ab105ff0 drivers/net/usb/smsc95xx.c
+ */
+ char *tail = skb_tail_pointer(skb);
+ skb->csum = (*(tail - 2) << 8) | *(tail - 1);
+
skb->ip_summed = CHECKSUM_COMPLETE;
skb_trim(skb, skb->len - 2);
}

View File

@ -1,7 +1,7 @@
diff -r 1d04c9c5fa8a drivers/input/evdev.c
--- a/drivers/input/evdev.c Tue Apr 17 16:14:54 2012 +0200
+++ b/drivers/input/evdev.c Wed Apr 18 11:25:37 2012 +0200
@@ -957,6 +957,9 @@
diff -r 3e2b660685e7 drivers/input/evdev.c
--- a/drivers/input/evdev.c Wed Apr 17 11:36:09 2013 +0200
+++ b/drivers/input/evdev.c Wed Apr 17 11:36:46 2013 +0200
@@ -1008,6 +1008,9 @@
if (error)
goto err_cleanup_evdev;
@ -11,12 +11,13 @@ diff -r 1d04c9c5fa8a drivers/input/evdev.c
return 0;
err_cleanup_evdev:
@@ -986,7 +989,7 @@
@@ -1040,8 +1043,7 @@
MODULE_DEVICE_TABLE(input, evdev_ids);
static struct input_handler evdev_handler = {
- .event = evdev_event,
- .events = evdev_events,
+ .event = genode_evdev_event,
.connect = evdev_connect,
.disconnect = evdev_disconnect,
.fops = &evdev_fops,
.legacy_minors = true,

View File

@ -1,7 +1,7 @@
diff -ur a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
--- a/drivers/hid/usbhid/hid-core.c 2012-01-26 01:39:32.000000000 +0100
+++ b/drivers/hid/usbhid/hid-core.c 2013-01-11 15:21:40.907579676 +0100
@@ -789,7 +789,7 @@
diff -r 7c6a35bba203 drivers/hid/usbhid/hid-core.c
--- a/drivers/hid/usbhid/hid-core.c Thu Apr 18 14:21:39 2013 +0200
+++ b/drivers/hid/usbhid/hid-core.c Fri Apr 19 14:53:15 2013 +0200
@@ -895,7 +895,7 @@
&usbhid->inbuf_dma);
usbhid->outbuf = usb_alloc_coherent(dev, usbhid->bufsize, GFP_KERNEL,
&usbhid->outbuf_dma);
@ -10,7 +10,7 @@ diff -ur a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
usbhid->ctrlbuf = usb_alloc_coherent(dev, usbhid->bufsize, GFP_KERNEL,
&usbhid->ctrlbuf_dma);
if (!usbhid->inbuf || !usbhid->outbuf || !usbhid->cr ||
@@ -946,7 +946,7 @@
@@ -1053,7 +1053,7 @@
return -EINVAL;
}
@ -19,50 +19,14 @@ diff -ur a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
dbg_hid("couldn't allocate rdesc memory\n");
return -ENOMEM;
}
Only in b/drivers/hid/usbhid: hid-core.c~
diff -ur a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
--- a/drivers/net/usb/smsc95xx.c 2013-01-11 15:27:53.987584450 +0100
+++ b/drivers/net/usb/smsc95xx.c 2013-01-11 15:11:06.467571241 +0100
@@ -65,7 +65,7 @@
static int smsc95xx_read_reg(struct usbnet *dev, u32 index, u32 *data)
{
- u32 *buf = kmalloc(4, GFP_KERNEL);
+ u32 *buf = kmalloc(4, GFP_NOIO);
int ret;
BUG_ON(!dev);
@@ -90,7 +90,7 @@
static int smsc95xx_write_reg(struct usbnet *dev, u32 index, u32 data)
{
- u32 *buf = kmalloc(4, GFP_KERNEL);
+ u32 *buf = kmalloc(4, GFP_NOIO);
int ret;
BUG_ON(!dev);
@@ -328,7 +328,7 @@
return -ENOMEM;
}
- usb_context = kmalloc(sizeof(struct usb_context), GFP_ATOMIC);
+ usb_context = kmalloc(sizeof(struct usb_context), GFP_NOIO);
if (usb_context == NULL) {
netdev_warn(dev->net, "Error allocating control msg\n");
usb_free_urb(urb);
@@ -990,7 +990,7 @@
}
dev->data[0] = (unsigned long)kzalloc(sizeof(struct smsc95xx_priv),
- GFP_KERNEL);
+ GFP_NOIO);
pdata = (struct smsc95xx_priv *)(dev->data[0]);
if (!pdata) {
diff -ur a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
--- a/drivers/net/usb/usbnet.c 2013-01-11 15:27:53.991584496 +0100
+++ b/drivers/net/usb/usbnet.c 2013-01-11 15:11:06.467571241 +0100
@@ -201,7 +201,7 @@
diff -r 7c6a35bba203 drivers/net/usb/.smsc95xx.c.swp
Binary file drivers/net/usb/.smsc95xx.c.swp has changed
diff -r 7c6a35bba203 drivers/net/usb/.usbnet.c.swp
Binary file drivers/net/usb/.usbnet.c.swp has changed
diff -r 7c6a35bba203 drivers/net/usb/usbnet.c
--- a/drivers/net/usb/usbnet.c Thu Apr 18 14:21:39 2013 +0200
+++ b/drivers/net/usb/usbnet.c Fri Apr 19 14:53:15 2013 +0200
@@ -234,7 +234,7 @@
period = max ((int) dev->status->desc.bInterval,
(dev->udev->speed == USB_SPEED_HIGH) ? 7 : 3);
@ -71,7 +35,7 @@ diff -ur a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
if (buf) {
dev->interrupt = usb_alloc_urb (0, GFP_KERNEL);
if (!dev->interrupt) {
@@ -1512,7 +1512,7 @@
@@ -1587,7 +1587,7 @@
if (!--dev->suspend_count) {
/* resume interrupt URBs */
if (dev->interrupt && test_bit(EVENT_DEV_OPEN, &dev->flags))
@ -80,9 +44,54 @@ diff -ur a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
spin_lock_irq(&dev->txq.lock);
while ((res = usb_get_from_anchor(&dev->deferred))) {
diff -ur a/drivers/usb/core/config.c b/drivers/usb/core/config.c
--- a/drivers/usb/core/config.c 2013-01-11 15:27:53.991584496 +0100
+++ b/drivers/usb/core/config.c 2013-01-11 15:11:06.467571241 +0100
@@ -1614,7 +1614,7 @@
netif_device_present(dev->net) &&
!timer_pending(&dev->delay) &&
!test_bit(EVENT_RX_HALT, &dev->flags))
- rx_alloc_submit(dev, GFP_NOIO);
+ rx_alloc_submit(dev, GFP_KERNEL);
if (!(dev->txq.qlen >= TX_QLEN(dev)))
netif_tx_wake_all_queues(dev->net);
@@ -1665,7 +1665,7 @@
cmd, reqtype, value, index, size);
if (data) {
- buf = kmalloc(size, GFP_KERNEL);
+ buf = kmalloc(size, GFP_NOIO);
if (!buf)
goto out;
}
@@ -1692,7 +1692,7 @@
cmd, reqtype, value, index, size);
if (data) {
- buf = kmemdup(data, size, GFP_KERNEL);
+ buf = kmemdup(data, size, GFP_NOIO);
if (!buf)
goto out;
}
@@ -1804,7 +1804,7 @@
}
if (data) {
- buf = kmemdup(data, size, GFP_ATOMIC);
+ buf = kmemdup(data, size, GFP_NOIO);
if (!buf) {
netdev_err(dev->net, "Error allocating buffer"
" in %s!\n", __func__);
@@ -1812,7 +1812,7 @@
}
}
- req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC);
+ req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO);
if (!req) {
netdev_err(dev->net, "Failed to allocate memory for %s\n",
__func__);
diff -r 7c6a35bba203 drivers/usb/core/config.c
--- a/drivers/usb/core/config.c Thu Apr 18 14:21:39 2013 +0200
+++ b/drivers/usb/core/config.c Fri Apr 19 14:53:15 2013 +0200
@@ -689,7 +689,7 @@
if (!dev->rawdescriptors)
goto err2;
@ -92,7 +101,7 @@ diff -ur a/drivers/usb/core/config.c b/drivers/usb/core/config.c
if (!desc)
goto err2;
@@ -716,7 +716,7 @@
@@ -718,7 +718,7 @@
USB_DT_CONFIG_SIZE);
/* Now that we know the length, get the whole thing */
@ -101,11 +110,10 @@ diff -ur a/drivers/usb/core/config.c b/drivers/usb/core/config.c
if (!bigbuffer) {
result = -ENOMEM;
goto err;
Only in b/drivers/usb/core: config.c~
diff -ur a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
--- a/drivers/usb/core/devices.c 2013-01-11 15:27:53.991584496 +0100
+++ b/drivers/usb/core/devices.c 2013-01-11 15:11:06.467571241 +0100
@@ -505,7 +505,7 @@
diff -r 7c6a35bba203 drivers/usb/core/devices.c
--- a/drivers/usb/core/devices.c Thu Apr 18 14:21:39 2013 +0200
+++ b/drivers/usb/core/devices.c Fri Apr 19 14:53:15 2013 +0200
@@ -506,7 +506,7 @@
return 0;
/* allocate 2^1 pages = 8K (on i386);
* should be more than enough for one device */
@ -114,10 +122,10 @@ diff -ur a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
if (!pages_start)
return -ENOMEM;
diff -ur a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c 2013-01-11 15:27:53.991584496 +0100
+++ b/drivers/usb/core/hub.c 2013-01-11 15:11:06.471571243 +0100
@@ -740,7 +740,7 @@
diff -r 7c6a35bba203 drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c Thu Apr 18 14:21:39 2013 +0200
+++ b/drivers/usb/core/hub.c Fri Apr 19 14:53:15 2013 +0200
@@ -1077,7 +1077,7 @@
hcd = bus_to_hcd(hdev->bus);
if (hcd->driver->update_hub_device) {
ret = hcd->driver->update_hub_device(hcd, hdev,
@ -126,7 +134,7 @@ diff -ur a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
if (ret < 0) {
dev_err(hub->intfdev, "Host not "
"accepting hub info "
@@ -879,7 +879,7 @@
@@ -1217,7 +1217,7 @@
init3:
hub->quiescing = 0;
@ -135,8 +143,8 @@ diff -ur a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
if (status < 0)
dev_err(hub->intfdev, "activate --> %d\n", status);
if (hub->has_indicators && blinkenlights)
@@ -968,20 +968,21 @@
int maxp, ret;
@@ -1352,20 +1352,20 @@
int maxp, ret, i;
char *message = "out of memory";
- hub->buffer = kmalloc(sizeof(*hub->buffer), GFP_KERNEL);
@ -156,11 +164,22 @@ diff -ur a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
- hub->descriptor = kmalloc(sizeof(*hub->descriptor), GFP_KERNEL);
+ hub->descriptor = kmalloc(sizeof(*hub->descriptor), GFP_NOIO);
+ printk("Alloc hub desc: %p\n", hub->descriptor);
if (!hub->descriptor) {
ret = -ENOMEM;
goto fail;
@@ -3790,7 +3791,7 @@
@@ -3437,9 +3437,9 @@
/*
* usb_enable_lpm() can be called as part of a failed device reset,
* which may be initiated by an error path of a mass storage driver.
- * Therefore, use GFP_NOIO.
+ * Therefore, use GFP_KERNEL.
*/
- sel_values = kmalloc(sizeof *(sel_values), GFP_NOIO);
+ sel_values = kmalloc(sizeof *(sel_values), GFP_KERNEL);
if (!sel_values)
return -ENOMEM;
@@ -4921,7 +4921,7 @@
len = max(len, old_length);
}
@ -169,10 +188,9 @@ diff -ur a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
if (buf == NULL) {
dev_err(&udev->dev, "no mem to re-read configs after reset\n");
/* assume the worst */
Only in b/drivers/usb/core: hub.c~
diff -ur a/drivers/usb/core/message.c b/drivers/usb/core/message.c
--- a/drivers/usb/core/message.c 2013-01-11 15:27:53.991584496 +0100
+++ b/drivers/usb/core/message.c 2013-01-11 15:11:06.471571243 +0100
diff -r 7c6a35bba203 drivers/usb/core/message.c
--- a/drivers/usb/core/message.c Thu Apr 18 14:21:39 2013 +0200
+++ b/drivers/usb/core/message.c Fri Apr 19 14:53:15 2013 +0200
@@ -50,7 +50,7 @@
init_completion(&ctx.done);
urb->context = &ctx;
@ -191,7 +209,7 @@ diff -ur a/drivers/usb/core/message.c b/drivers/usb/core/message.c
if (!urb)
return -ENOMEM;
@@ -866,11 +866,11 @@
@@ -865,11 +865,11 @@
if (index <= 0)
return NULL;
@ -205,7 +223,7 @@ diff -ur a/drivers/usb/core/message.c b/drivers/usb/core/message.c
if (!smallbuf)
return buf;
memcpy(smallbuf, buf, len);
@@ -941,7 +941,7 @@
@@ -940,7 +940,7 @@
int usb_get_status(struct usb_device *dev, int type, int target, void *data)
{
int ret;
@ -214,7 +232,7 @@ diff -ur a/drivers/usb/core/message.c b/drivers/usb/core/message.c
if (!status)
return -ENOMEM;
@@ -1713,7 +1713,7 @@
@@ -1730,7 +1730,7 @@
if (cp) {
nintf = cp->desc.bNumInterfaces;
new_interfaces = kmalloc(nintf * sizeof(*new_interfaces),
@ -223,7 +241,7 @@ diff -ur a/drivers/usb/core/message.c b/drivers/usb/core/message.c
if (!new_interfaces) {
dev_err(&dev->dev, "Out of memory\n");
return -ENOMEM;
@@ -1722,7 +1722,7 @@
@@ -1739,7 +1739,7 @@
for (; n < nintf; ++n) {
new_interfaces[n] = kzalloc(
sizeof(struct usb_interface),
@ -232,45 +250,9 @@ diff -ur a/drivers/usb/core/message.c b/drivers/usb/core/message.c
if (!new_interfaces[n]) {
dev_err(&dev->dev, "Out of memory\n");
ret = -ENOMEM;
diff -ur a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
--- a/drivers/usb/core/urb.c 2013-01-11 15:27:53.995584562 +0100
+++ b/drivers/usb/core/urb.c 2013-01-11 15:11:06.471571243 +0100
@@ -266,7 +266,7 @@
*
* The general rules for how to decide which mem_flags to use
* are the same as for kmalloc. There are four
- * different possible values; GFP_KERNEL, GFP_NOFS, GFP_NOIO and
+ * different possible values; GFP_KERNEL, GFP_NOFS, GFP_KERNEL and
* GFP_ATOMIC.
*
* GFP_NOFS is not ever used, as it has not been implemented yet.
@@ -279,7 +279,7 @@
* (c) current->state != TASK_RUNNING, this is the case only after
* you've changed it.
*
- * GFP_NOIO is used in the block io path and error handling of storage
+ * GFP_KERNEL is used in the block io path and error handling of storage
* devices.
*
* All other situations use GFP_KERNEL.
@@ -290,12 +290,12 @@
* (2) queuecommand methods of scsi drivers must use GFP_ATOMIC (also
* called with a spinlock held);
* (3) If you use a kernel thread with a network driver you must use
- * GFP_NOIO, unless (b) or (c) apply;
+ * GFP_KERNEL, unless (b) or (c) apply;
* (4) after you have done a down() you can use GFP_KERNEL, unless (b) or (c)
* apply or your are in a storage driver's block io path;
* (5) USB probe and disconnect can use GFP_KERNEL unless (b) or (c) apply; and
* (6) changing firmware on a running storage or net device uses
- * GFP_NOIO, unless b) or c) apply
+ * GFP_KERNEL, unless b) or c) apply
*
*/
int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
diff -ur a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c
--- a/drivers/usb/storage/alauda.c 2013-01-11 15:27:53.995584562 +0100
+++ b/drivers/usb/storage/alauda.c 2013-01-11 15:11:06.471571243 +0100
diff -r 7c6a35bba203 drivers/usb/storage/alauda.c
--- a/drivers/usb/storage/alauda.c Thu Apr 18 14:21:39 2013 +0200
+++ b/drivers/usb/storage/alauda.c Fri Apr 19 14:53:15 2013 +0200
@@ -448,8 +448,8 @@
num_zones = MEDIA_INFO(us).capacity >> (MEDIA_INFO(us).zoneshift
@ -329,9 +311,9 @@ diff -ur a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c
if (!us->extra) {
US_DEBUGP("init_alauda: Gah! Can't allocate storage for"
"alauda info struct!\n");
diff -ur a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c
--- a/drivers/usb/storage/datafab.c 2013-01-11 15:27:53.995584562 +0100
+++ b/drivers/usb/storage/datafab.c 2013-01-11 15:11:06.471571243 +0100
diff -r 7c6a35bba203 drivers/usb/storage/datafab.c
--- a/drivers/usb/storage/datafab.c Thu Apr 18 14:21:39 2013 +0200
+++ b/drivers/usb/storage/datafab.c Fri Apr 19 14:53:15 2013 +0200
@@ -174,7 +174,7 @@
// bounce buffer and the actual transfer buffer.
@ -377,9 +359,9 @@ diff -ur a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c
if (!us->extra) {
US_DEBUGP("datafab_transport: Gah! "
"Can't allocate storage for Datafab info struct!\n");
diff -ur a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c
--- a/drivers/usb/storage/jumpshot.c 2013-01-11 15:27:53.995584562 +0100
+++ b/drivers/usb/storage/jumpshot.c 2013-01-11 15:11:06.471571243 +0100
diff -r 7c6a35bba203 drivers/usb/storage/jumpshot.c
--- a/drivers/usb/storage/jumpshot.c Thu Apr 18 14:21:39 2013 +0200
+++ b/drivers/usb/storage/jumpshot.c Fri Apr 19 14:53:15 2013 +0200
@@ -188,7 +188,7 @@
// bounce buffer and the actual transfer buffer.
@ -416,9 +398,9 @@ diff -ur a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c
if (!us->extra) {
US_DEBUGP("jumpshot_transport: Gah! Can't allocate storage for jumpshot info struct!\n");
return USB_STOR_TRANSPORT_ERROR;
diff -ur a/drivers/usb/storage/karma.c b/drivers/usb/storage/karma.c
--- a/drivers/usb/storage/karma.c 2013-01-11 15:27:53.995584562 +0100
+++ b/drivers/usb/storage/karma.c 2013-01-11 15:11:06.471571243 +0100
diff -r 7c6a35bba203 drivers/usb/storage/karma.c
--- a/drivers/usb/storage/karma.c Thu Apr 18 14:21:39 2013 +0200
+++ b/drivers/usb/storage/karma.c Fri Apr 19 14:53:15 2013 +0200
@@ -182,11 +182,11 @@
static int rio_karma_init(struct us_data *us)
{
@ -433,9 +415,9 @@ diff -ur a/drivers/usb/storage/karma.c b/drivers/usb/storage/karma.c
if (!data->recv) {
kfree(data);
goto out;
diff -ur a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c
--- a/drivers/usb/storage/onetouch.c 2013-01-11 15:27:53.995584562 +0100
+++ b/drivers/usb/storage/onetouch.c 2013-01-11 15:11:06.471571243 +0100
diff -r 7c6a35bba203 drivers/usb/storage/onetouch.c
--- a/drivers/usb/storage/onetouch.c Thu Apr 18 14:21:39 2013 +0200
+++ b/drivers/usb/storage/onetouch.c Fri Apr 19 14:53:15 2013 +0200
@@ -163,7 +163,7 @@
usb_kill_urb(onetouch->irq);
break;
@ -445,9 +427,9 @@ diff -ur a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c
dev_err(&onetouch->irq->dev->dev,
"usb_submit_urb failed\n");
break;
diff -ur a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
--- a/drivers/usb/storage/realtek_cr.c 2013-01-11 15:27:53.995584562 +0100
+++ b/drivers/usb/storage/realtek_cr.c 2013-01-11 15:11:06.471571243 +0100
diff -r 7c6a35bba203 drivers/usb/storage/realtek_cr.c
--- a/drivers/usb/storage/realtek_cr.c Thu Apr 18 14:21:39 2013 +0200
+++ b/drivers/usb/storage/realtek_cr.c Fri Apr 19 14:53:15 2013 +0200
@@ -367,7 +367,7 @@
u8 cmnd[12] = { 0 };
u8 *buf;
@ -461,12 +443,12 @@ diff -ur a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
u8 cmnd[12] = { 0 };
u8 *buf;
- buf = kmalloc(len, GFP_NOIO);
+ buf = kmalloc(len, GFP_KERNEL);
- buf = kmemdup(data, len, GFP_NOIO);
+ buf = kmemdup(data, len, GFP_KERNEL);
if (buf == NULL)
return USB_STOR_TRANSPORT_ERROR;
memcpy(buf, data, len);
@@ -428,7 +428,7 @@
@@ -427,7 +427,7 @@
u8 cmnd[12] = { 0 };
u8 *buf;
@ -475,9 +457,18 @@ diff -ur a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
if (buf == NULL)
return USB_STOR_TRANSPORT_ERROR;
diff -ur a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c
--- a/drivers/usb/storage/sddr09.c 2013-01-11 15:27:53.999584730 +0100
+++ b/drivers/usb/storage/sddr09.c 2013-01-11 15:11:06.475571244 +0100
@@ -511,7 +511,7 @@
US_DEBUGP("%s, addr = 0xfe47, len = %d\n", __FUNCTION__, len);
- buf = kmemdup(data, len, GFP_NOIO);
+ buf = kmemdup(data, len, GFP_KERNEL);
if (!buf)
return USB_STOR_TRANSPORT_ERROR;
diff -r 7c6a35bba203 drivers/usb/storage/sddr09.c
--- a/drivers/usb/storage/sddr09.c Thu Apr 18 14:21:39 2013 +0200
+++ b/drivers/usb/storage/sddr09.c Fri Apr 19 14:53:15 2013 +0200
@@ -692,7 +692,7 @@
return result;
}
@ -543,9 +534,9 @@ diff -ur a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c
if (!us->extra)
return -ENOMEM;
us->extra_destructor = sddr09_card_info_destructor;
diff -ur a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c
--- a/drivers/usb/storage/sddr55.c 2013-01-11 15:27:53.999584730 +0100
+++ b/drivers/usb/storage/sddr55.c 2013-01-11 15:11:06.475571244 +0100
diff -r 7c6a35bba203 drivers/usb/storage/sddr55.c
--- a/drivers/usb/storage/sddr55.c Thu Apr 18 14:21:39 2013 +0200
+++ b/drivers/usb/storage/sddr55.c Fri Apr 19 14:53:15 2013 +0200
@@ -216,7 +216,7 @@
len = min((unsigned int) sectors, (unsigned int) info->blocksize >>
@ -593,9 +584,9 @@ diff -ur a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c
if (!us->extra)
return USB_STOR_TRANSPORT_ERROR;
us->extra_destructor = sddr55_card_info_destructor;
diff -ur a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c
--- a/drivers/usb/storage/shuttle_usbat.c 2013-01-11 15:27:53.999584730 +0100
+++ b/drivers/usb/storage/shuttle_usbat.c 2013-01-11 15:11:06.475571244 +0100
diff -r 7c6a35bba203 drivers/usb/storage/shuttle_usbat.c
--- a/drivers/usb/storage/shuttle_usbat.c Thu Apr 18 14:21:39 2013 +0200
+++ b/drivers/usb/storage/shuttle_usbat.c Fri Apr 19 14:53:15 2013 +0200
@@ -1068,7 +1068,7 @@
if (!us || !info)
return USB_STOR_TRANSPORT_ERROR;
@ -641,9 +632,9 @@ diff -ur a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usb
if (!us->extra) {
US_DEBUGP("init_usbat: Gah! Can't allocate storage for usbat info struct!\n");
return 1;
diff -ur a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c 2013-01-11 15:27:53.999584730 +0100
+++ b/drivers/usb/storage/transport.c 2013-01-11 15:11:06.475571244 +0100
diff -r 7c6a35bba203 drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c Thu Apr 18 14:21:39 2013 +0200
+++ b/drivers/usb/storage/transport.c Fri Apr 19 14:53:15 2013 +0200
@@ -151,7 +151,7 @@
us->current_urb->transfer_dma = us->iobuf_dma;
@ -662,22 +653,10 @@ diff -ur a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
if (result) {
US_DEBUGP("usb_sg_init returned %d\n", result);
return USB_STOR_XFER_ERROR;
diff -ur a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
--- a/drivers/usb/storage/uas.c 2013-01-11 15:27:53.999584730 +0100
+++ b/drivers/usb/storage/uas.c 2013-01-11 15:11:06.475571244 +0100
@@ -142,7 +142,7 @@
struct scsi_pointer *scp = (void *)cmdinfo;
struct scsi_cmnd *cmnd = container_of(scp,
struct scsi_cmnd, SCp);
- uas_submit_urbs(cmnd, cmnd->device->hostdata, GFP_NOIO);
+ uas_submit_urbs(cmnd, cmnd->device->hostdata, GFP_KERNEL);
}
}
diff -ur a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
--- a/drivers/usb/storage/usb.c 2013-01-11 15:27:53.999584730 +0100
+++ b/drivers/usb/storage/usb.c 2013-01-11 15:11:06.475571244 +0100
@@ -409,7 +409,7 @@
diff -r 7c6a35bba203 drivers/usb/storage/usb.c
--- a/drivers/usb/storage/usb.c Thu Apr 18 14:21:39 2013 +0200
+++ b/drivers/usb/storage/usb.c Fri Apr 19 14:53:15 2013 +0200
@@ -453,7 +453,7 @@
usb_set_intfdata(intf, us);
/* Allocate the control/setup and DMA-mapped buffers */

View File

@ -10,12 +10,15 @@
build {
core init
drivers/pci
drivers/timer
drivers/usb
test/block
}
lappend_if [have_spec acpi] build_components drivers/acpi
lappend_if [have_spec pci] build_components drivers/pci
lappend_if [have_spec pci] build_components drivers/pci/device_pd
create_boot_directory
#
@ -39,22 +42,40 @@ set config {
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
</default-route>}
append_if [have_spec acpi] config {
<start name="acpi">
<resource name="RAM" quantum="8M"/>
<binary name="acpi_drv"/>
<provides>
<service name="PCI"/>
<service name="IRQ" />
</provides>
<route>
<service name="PCI"> <any-child /> </service>
<any-service> <parent/> <any-child /> </any-service>
</route>
</start>}
append_if [expr ![have_spec acpi] && [have_spec pci]] config {
<start name="pci_drv">
<resource name="RAM" quantum="5M"/>
<provides><service name="PCI"/></provides>
</start>}
append config {
<start name="timer">
<resource name="RAM" quantum="512K"/>
<resource name="RAM" quantum="1M"/>
<provides> <service name="Timer"/> </provides>
</start>
<start name="usb_drv">
<resource name="RAM" quantum="6M"/>
<provides> <service name="Block"/> </provides>
<config><storage /></config>
</start>
<start name="pci_drv">
<resource name="RAM" quantum="512K"/>
<provides> <service name="PCI"/> </provides>
</start>
<start name="test-usb">
<resource name="RAM" quantum="1M" />
<resource name="RAM" quantum="2M" />
<binary name="test-block" />
</start>
</config>
@ -70,6 +91,9 @@ set boot_modules {
core init timer usb_drv pci_drv test-block
}
lappend_if [have_spec acpi] boot_modules acpi_drv
lappend_if [have_spec pci] boot_modules pci_drv
lappend_if [have_spec nova] boot_modules pci_device_pd
build_boot_image $boot_modules

View File

@ -20,7 +20,7 @@
#include <lx_emul.h>
/* Linux */
#include <plat/ehci.h>
#include <linux/platform_data/usb-ehci-s5p.h>
using namespace Genode;
@ -137,14 +137,14 @@ static void arndale_ehci_init()
extern "C" void module_ehci_hcd_init();
extern "C" int module_usbnet_init();
extern "C" int module_asix_init();
extern "C" int module_asix_driver_init();
void platform_hcd_init(Services *services)
{
/* register network */
if (services->nic) {
module_usbnet_init();
module_asix_init();
module_asix_driver_init();
}
/* register EHCI controller */

View File

@ -54,11 +54,7 @@ static resource _ehci[] =
/**
* Port informations for platform device
*/
static struct ehci_hcd_omap_platform_data _ehci_data
{
{ OMAP_EHCI_PORT_MODE_PHY, OMAP_EHCI_PORT_MODE_NONE },
{ 0, 0 }
};
static struct ehci_hcd_omap_platform_data _ehci_data;
/**
@ -366,14 +362,14 @@ static void omap_ehci_init()
extern "C" void module_ehci_hcd_init();
extern "C" int module_usbnet_init();
extern "C" int module_smsc95xx_init();
extern "C" int module_smsc95xx_driver_init();
void platform_hcd_init(Services *services)
{
/* register network */
if (services->nic) {
module_usbnet_init();
module_smsc95xx_init();
module_smsc95xx_driver_init();
}
/* register EHCI controller */
@ -388,6 +384,11 @@ void platform_hcd_init(Services *services)
pdev->id = 0;
pdev->num_resources = 2;
pdev->resource = _ehci;
_ehci_data.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY;
_ehci_data.port_mode[1] = OMAP_EHCI_PORT_MODE_NONE;
_ehci_data.phy_reset = 0;
pdev->dev.platform_data = &_ehci_data;
/*

View File

@ -152,11 +152,34 @@ void down_write(struct rw_semaphore *sem) { TRACE; }
void up_write(struct rw_semaphore *sem) { TRACE; }
/*********************
** linux/lockdep.h **
*********************/
bool lockdep_is_held(void *l) { TRACE; return 1; }
/********************
** linux/random.h **
********************/
void add_device_randomness(const void *buf, unsigned int size) { TRACE; }
/*******************
** linux/ktime.h **
*******************/
ktime_t ktime_add_ns(const ktime_t kt, u64 nsec) { TRACE; ktime_t ret = { 0 }; return ret; }
#define KTIME_RET ({TRACE; ktime_t t = { 0 }; return t;})
ktime_t ktime_add(const ktime_t lhs, const ktime_t rhs) { KTIME_RET; }
ktime_t ktime_add_ns(const ktime_t kt, u64 nsec) { KTIME_RET; }
ktime_t ktime_get(void) { KTIME_RET; }
ktime_t ktime_get_monotonic_offset(void) { KTIME_RET; }
ktime_t ktime_set(const long secs, const unsigned long nsecs) { KTIME_RET; }
ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs) { KTIME_RET; }
struct timeval ktime_to_timeval(const ktime_t kt) { TRACE; struct timeval ret; return ret; }
s64 ktime_us_delta(const ktime_t later, const ktime_t earlier) { TRACE; return 0; };
@ -174,6 +197,10 @@ unsigned long round_jiffies(unsigned long j) { TRACE; return 1; }
*********************/
ktime_t ktime_get_real(void) { TRACE; ktime_t ret; return ret; }
int hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
unsigned long delta_ns, const enum hrtimer_mode mode) { TRACE; return 0; }
void hrtimer_init(struct hrtimer *timer, clockid_t clock_id, enum hrtimer_mode mode) { TRACE; }
int hrtimer_cancel(struct hrtimer *timer) { TRACE; return 0; }
/*******************
@ -189,6 +216,8 @@ void mdelay(unsigned long msecs) { TRACE; }
bool cancel_work_sync(struct work_struct *work) { TRACE; return 0; }
int cancel_delayed_work_sync(struct delayed_work *work) { TRACE; return 0; }
bool flush_work(struct work_struct *work) { TRACE; return 0; }
bool flush_work_sync(struct work_struct *work) { TRACE; return 0; }
@ -294,6 +323,9 @@ void pm_runtime_put_noidle(struct device *dev) { TRACE; }
void pm_runtime_use_autosuspend(struct device *dev) { TRACE; }
int pm_runtime_put_sync_autosuspend(struct device *dev) { TRACE; return 0; }
void pm_runtime_no_callbacks(struct device *dev) { TRACE; }
void pm_runtime_set_autosuspend_delay(struct device *dev, int delay) { TRACE; }
int pm_runtime_get_sync(struct device *dev) { TRACE; return 0; }
int pm_runtime_put_sync(struct device *dev) { TRACE; return 0; }
/***********************
@ -369,6 +401,12 @@ int class_register(struct class *cls) { TRACE; return 0; }
void class_unregister(struct class *cls) { TRACE; }
void class_destroy(struct class *cls) { TRACE; }
void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp) { TRACE; return 0; }
void devres_add(struct device *dev, void *res) { TRACE; }
int devres_destroy(struct device *dev, dr_release_t release,
dr_match_t match, void *match_data) { TRACE; return 0; }
void devres_free(void *res) { TRACE; }
/*****************************
** linux/platform_device.h **
@ -768,6 +806,7 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
void scsi_remove_host(struct Scsi_Host *shost) { TRACE; }
void scsi_host_put(struct Scsi_Host *shost) { TRACE; }
struct scsi_device *scsi_get_host_dev(struct Scsi_Host *shost) { TRACE; return 0; }
int scsi_is_host_device(const struct device *dev) { TRACE; return 0; }
/********************************
@ -788,6 +827,12 @@ int omap_usbhs_enable(struct device *dev) { TRACE; return 0; }
void omap_usbhs_disable(struct device *dev) { TRACE; }
/*****************
** linux/net.h **
*****************/
int net_ratelimit(void) { TRACE; return 0; }
/********************
** linux/skbuff.h **
********************/
@ -812,6 +857,8 @@ bool skb_defer_rx_timestamp(struct sk_buff *skb) { TRACE; return 0; }
__u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) { TRACE; return 0; }
u32 ethtool_op_get_link(struct net_device *dev) { TRACE; return 0; }
int ethtool_op_get_ts_info(struct net_device *dev, struct ethtool_ts_info *eti) {
TRACE; return 0; }
/***********************
@ -824,6 +871,7 @@ void netif_start_queue(struct net_device *dev) { TRACE; }
void netif_device_detach(struct net_device *dev) { TRACE; }
void netif_stop_queue(struct net_device *dev) { TRACE; }
void netif_wake_queue(struct net_device *dev) { TRACE; }
void netif_tx_wake_all_queues(struct net_device *dev) { TRACE; }
void netif_device_attach(struct net_device *dev) { TRACE; }
void unregister_netdev(struct net_device *dev) { TRACE; }
void free_netdev(struct net_device *dev) { TRACE; }
@ -887,3 +935,105 @@ struct clk *clk_get(struct device *dev, const char *id)
int clk_enable(struct clk *clk) { TRACE; return 0; }
void clk_disable(struct clk *clk) { TRACE; }
void clk_put(struct clk *clk) { TRACE; }
struct clk *devm_clk_get(struct device *dev, const char *id) { TRACE; return 0; }
int clk_prepare_enable(struct clk *clk) { TRACE; return 0; }
void clk_disable_unprepare(struct clk *clk) { TRACE; }
/********************
** linux/bitmap.h **
********************/
int bitmap_subset(const unsigned long *src1,
const unsigned long *src2, int nbits) { TRACE; return 1; }
/*****************
** linux/idr.h **
*****************/
int ida_simple_get(struct ida *ida, unsigned int start, unsigned int end,
gfp_t gfp_mask) { TRACE; return 0; }
void ida_simple_remove(struct ida *ida, unsigned int id) { TRACE; }
/****************************
** drivers/usb/core/usb.h **
****************************/
#include <linux/usb.h>
#include <drivers/usb/core/usb.h>
const struct attribute_group *usb_interface_groups[1];
const struct attribute_group *usb_device_groups[1];
struct usb_driver usbfs_driver;
DEFINE_MUTEX(usbfs_mutex);
void usb_create_sysfs_intf_files(struct usb_interface *intf) { TRACE; }
void usb_remove_sysfs_intf_files(struct usb_interface *intf) { TRACE; }
int usb_create_sysfs_dev_files(struct usb_device *dev) { TRACE; return 0; }
void usb_remove_sysfs_dev_files(struct usb_device *dev) { TRACE; }
int usb_devio_init(void) { TRACE; return 0; }
void usb_devio_cleanup(void) { TRACE; }
/*******************
** linux/crc16.h **
*******************/
u16 crc16(u16 crc, const u8 *buffer, size_t len) { TRACE; return 0; }
/*******************
** linux/birev.h **
*******************/
u16 bitrev16(u16 in) { TRACE; return 0; }
/******************
** linux/gpio.h **
******************/
bool gpio_is_valid(int number) { TRACE; return false; }
void gpio_set_value_cansleep(unsigned gpio, int value) { TRACE; }
int gpio_request_one(unsigned gpio, unsigned long flags, const char *label) { TRACE; return 0; }
/*********************
** linux/of_gpio.h **
*********************/
int of_get_named_gpio(struct device_node *np,
const char *propname, int index) { TRACE; return 0; }
/******************
** linux/phy.h **
******************/
struct mii_bus *mdiobus_alloc(void) { TRACE; return 0; }
int mdiobus_register(struct mii_bus *bus) { TRACE; return 0; }
void mdiobus_unregister(struct mii_bus *bus) { TRACE; }
void mdiobus_free(struct mii_bus *bus) { TRACE; }
int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) { TRACE; return 0; }
void phy_print_status(struct phy_device *phydev) { TRACE; }
int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd) { TRACE; return 0; }
int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd) { TRACE; return 0; }
int phy_start_aneg(struct phy_device *phydev) { TRACE; return 0; }
void phy_start(struct phy_device *phydev) { TRACE; }
void phy_stop(struct phy_device *phydev) { TRACE; }
int genphy_resume(struct phy_device *phydev) { TRACE; return 0; }
struct phy_device * phy_connect(struct net_device *dev, const char *bus_id,
void (*handler)(struct net_device *), u32 flags,
phy_interface_t interface) { TRACE; return 0; }
void phy_disconnect(struct phy_device *phydev) { TRACE; }

View File

@ -60,14 +60,17 @@ enum usbhs_omap_port_mode
OMAP_EHCI_PORT_MODE_PHY,
};
struct regulator { };
struct ehci_hcd_omap_platform_data
{
enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
int reset_gpio_port[OMAP3_HS_USB_PORTS];
struct regulator *regulator[OMAP3_HS_USB_PORTS];
unsigned phy_reset;
};
struct regulator;
/*****************************
@ -156,5 +159,81 @@ struct clk *clk_get(struct device *, const char *);
int clk_enable(struct clk *);
void clk_disable(struct clk *);
void clk_put(struct clk *);
struct clk *devm_clk_get(struct device *dev, const char *id);
int clk_prepare_enable(struct clk *);
void clk_disable_unprepare(struct clk *);
/******************
** linux/gpio.h **
******************/
enum { GPIOF_OUT_INIT_HIGH = 0x2 };
bool gpio_is_valid(int);
void gpio_set_value_cansleep(unsigned, int);
int gpio_request_one(unsigned, unsigned long, const char *);
/****************
** linux/of.h **
****************/
#define of_match_ptr(ptr) NULL
/*********************
** linux/of_gpio.h **
*********************/
int of_get_named_gpio(struct device_node *, const char *, int);
/******************
** linux/phy.h **
******************/
enum {
MII_BUS_ID_SIZE = 17,
PHY_MAX_ADDR = 32,
PHY_POLL = -1,
};
#define PHY_ID_FMT "%s:%02x"
struct mii_bus
{
const char *name;
char id[MII_BUS_ID_SIZE];
int (*read)(struct mii_bus *bus, int phy_id, int regnum);
int (*write)(struct mii_bus *bus, int phy_id, int regnum, u16 val);
void *priv;
int *irq;
};
struct phy_device
{
int speed;
int duplex;
int link;
};
struct mii_bus *mdiobus_alloc(void);
int mdiobus_register(struct mii_bus *bus);
void mdiobus_unregister(struct mii_bus *bus);
void mdiobus_free(struct mii_bus *bus);
int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd);
void phy_print_status(struct phy_device *phydev);
int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd);
int phy_start_aneg(struct phy_device *phydev);
void phy_stop(struct phy_device *phydev);
int genphy_resume(struct phy_device *phydev);
struct phy_device * phy_connect(struct net_device *dev, const char *bus_id,
void (*handler)(struct net_device *), u32 flags,
phy_interface_t interface);
void phy_disconnect(struct phy_device *phydev);
#endif /* _ARM__PLATFORM__LX_EMUL_H_ */

View File

@ -31,7 +31,6 @@ extern "C" {
#include <dde_kit/timer.h>
#include <dde_kit/resources.h>
#include <linux/usb/storage.h>
#define VERBOSE_LX_EMUL 0
@ -61,10 +60,17 @@ extern "C" {
#endif
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
#define LINUX_VERSION_CODE KERNEL_VERSION(3,2,2)
#define LINUX_VERSION_CODE KERNEL_VERSION(3,8,6)
#define KBUILD_MODNAME "mod-noname"
/*****************
** linux/bcd.h **
*****************/
#define bin2bcd(x) ((((x) / 10) << 4) + (x) % 10)
/***************
** asm/bug.h **
***************/
@ -89,6 +95,11 @@ extern "C" {
#define BUG_ON(condition) do { if (condition) BUG(); } while(0)
/*********************
** linux/kconfig.h **
*********************/
#define IS_ENABLED(x) x
/*****************
** asm/param.h **
@ -169,6 +180,7 @@ typedef __u16 __sum16;
typedef __u32 __wsum;
typedef u64 sector_t;
typedef int clockid_t;
struct list_head {
struct list_head *next, *prev;
@ -227,6 +239,8 @@ typedef unsigned long dma_addr_t;
typedef unsigned short mode_t;
#include <linux/usb/storage.h>
/******************
** asm/system.h **
******************/
@ -280,12 +294,20 @@ enum irqreturn {
typedef enum irqreturn irqreturn_t;
/******************
** linux/swab.h **
******************/
__u16 __swab16p(const __u16 *);
__u32 __swab32p(const __u32 *);
__u64 __swab64p(const __u64 *);
/*************************************
** linux/byteorder/little_endian.h **
*************************************/
#include <linux/byteorder/little_endian.h>
#include <uapi/linux/byteorder/little_endian.h>
/*******************************
@ -303,9 +325,11 @@ typedef enum irqreturn irqreturn_t;
#define cpu_to_be16 __cpu_to_be16
#define cpu_to_le32 __cpu_to_le32
#define cpu_to_be32 __cpu_to_be32
#define cpu_to_le32s __cpu_to_le32s
#define le16_to_cpup __le16_to_cpup
#define be16_to_cpup __be16_to_cpup
#define le32_to_cpup __le32_to_cpup
#define le32_to_cpus __le32_to_cpus
#define be32_to_cpup __be32_to_cpup
@ -322,7 +346,11 @@ void put_unaligned_le64(u64 val, void *p);
u64 get_unaligned_le64(const void *p);
#define put_unaligned put_unaligned_le32
#ifdef __LP64__
#define get_unaligned get_unaligned_le64
#else
#define get_unaligned get_unaligned_le32
#endif
/****************
@ -520,7 +548,8 @@ static inline size_t min(size_t a, size_t b) {
void might_sleep();
#define INT_MAX ((int)(~0U>>1))
#define INT_MAX ((int)(~0U>>1))
#define UINT_MAX (~0U)
char *kasprintf(gfp_t gfp, const char *fmt, ...);
int kstrtouint(const char *s, unsigned int base, unsigned int *res);
@ -534,6 +563,16 @@ int kstrtouint(const char *s, unsigned int base, unsigned int *res);
__val = __val < __min ? __min: __val; \
__val > __max ? __max: __val; })
#define DIV_ROUND_CLOSEST(x, divisor)( \
{ \
typeof(x) __x = x; \
typeof(divisor) __d = divisor; \
(((typeof(x))-1) > 0 || \
((typeof(divisor))-1) > 0 || (__x) > 0) ? \
(((__x) + ((__d) / 2)) / (__d)) : \
(((__x) - ((__d) / 2)) / (__d)); \
})
int strict_strtoul(const char *s, unsigned int base, unsigned long *res);
long simple_strtoul(const char *cp, char **endp, unsigned int base);
@ -563,6 +602,7 @@ int roundup_pow_of_two(u32 n);
#define MINORBITS 20
#define MKDEV(ma,mi) (((ma) << MINORBITS) | (mi))
#define MINOR(dev) ((dev) & 0xff)
/********************
@ -625,6 +665,8 @@ long find_next_zero_bit_le(const void *addr,
int ffs(int x);
int fls(int x);
#define for_each_set_bit(bit, addr, size) for ((bit) = 0; !bit; bit++, dev_err(0, "for_each_set_bit should not be called\n"))
/********************
** linux/string.h **
@ -710,6 +752,20 @@ struct module;
#define module_init(fn) void MOD_CONCAT(fn, MOD_SUFFIX)(void) { fn(); }
#define module_exit(exit_fn) void MOD_CONCAT(exit_fn, MOD_SUFFIX)(void) { exit_fn(); }
#define module_driver(__driver, __register, __unregister, ...) \
static int __init __driver##_init(void) \
{ \
return __register(&(__driver) , ##__VA_ARGS__); \
} \
module_init(__driver##_init); \
static void __exit __driver##_exit(void) \
{ \
__unregister(&(__driver) , ##__VA_ARGS__); \
} \
module_exit(__driver##_exit);
static inline void module_put(struct module *module) { }
static inline void __module_get(struct module *module) { }
@ -751,6 +807,11 @@ struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
*/
void kmem_cache_destroy(struct kmem_cache *);
/**
* Alloc from cache
*/
void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
/**
* Allocate and zero slab
*/
@ -840,9 +901,16 @@ static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec)
{
return ktime_add_ns(kt, usec * 1000);
}
s64 ktime_us_delta(const ktime_t later, const ktime_t earlier);
struct timeval ktime_to_timeval(const ktime_t);
ktime_t ktime_get_real(void);
ktime_t ktime_get(void);
ktime_t ktime_sub(const ktime_t, const ktime_t);
ktime_t ktime_get_monotonic_offset(void);
ktime_t ktime_add(const ktime_t, const ktime_t);
ktime_t ktime_set(const long, const unsigned long);
/*******************
** linux/timer.h **
@ -868,8 +936,19 @@ unsigned long round_jiffies(unsigned long j);
** linux/hrtimer.h **
*********************/
ktime_t ktime_get_real(void);
enum hrtimer_mode { HRTIMER_MODE_ABS = 0 };
enum hrtimer_restart { HRTIMER_NORESTART = 0 };
struct hrtimer
{
enum hrtimer_restart (*function)(struct hrtimer *);
};
int hrtimer_start_range_ns(struct hrtimer *, ktime_t,
unsigned long, const enum hrtimer_mode);
void hrtimer_init(struct hrtimer *, clockid_t, enum hrtimer_mode);
int hrtimer_cancel(struct hrtimer *);
/*******************
** linux/delay.h **
@ -901,6 +980,8 @@ bool cancel_work_sync(struct work_struct *work);
int cancel_delayed_work_sync(struct delayed_work *work);
int schedule_delayed_work(struct delayed_work *work, unsigned long delay);
int schedule_work(struct work_struct *work);
bool flush_work(struct work_struct *work);
bool flush_work_sync(struct work_struct *work);
@ -926,6 +1007,13 @@ bool flush_work_sync(struct work_struct *work);
} while (0)
/* dummy for queue_delayed_work call in storage/usb.c */
#define system_freezable_wq 0
struct workqueue_struct { };
bool queue_delayed_work(struct workqueue_struct *,
struct delayed_work *, unsigned long);
/******************
** linux/wait.h **
******************/
@ -1020,6 +1108,15 @@ void do_gettimeofday(struct timeval *tv);
#define CURRENT_TIME (current_kernel_time())
enum {
CLOCK_REALTIME = 0,
CLOCK_MONOTONIC = 1,
NSEC_PER_USEC = 1000L,
NSEC_PER_MSEC = 1000000L,
};
/*******************
** linux/sched.h **
*******************/
@ -1163,7 +1260,7 @@ int kref_put(struct kref *kref, void (*release) (struct kref *kref));
** linux/kobject.h **
*********************/
struct kobject { int dummy; };
struct kobject { struct kobject *parent; };
struct kobj_uevent_env
{
char buf[32];
@ -1206,6 +1303,11 @@ struct bin_attribute {
.store = _store, \
}
#define __ATTR_NULL { .attr = { .name = NULL } }
#define __ATTR_RO(name) __ATTR_NULL
static const char* modalias = "";
int sysfs_create_group(struct kobject *kobj,
const struct attribute_group *grp);
void sysfs_remove_group(struct kobject *kobj,
@ -1238,6 +1340,9 @@ void pm_runtime_put_noidle(struct device *dev);
void pm_runtime_use_autosuspend(struct device *dev);
int pm_runtime_put_sync_autosuspend(struct device *dev);
void pm_runtime_no_callbacks(struct device *dev);
void pm_runtime_set_autosuspend_delay(struct device *dev, int delay);
int pm_runtime_get_sync(struct device *dev);
int pm_runtime_put_sync(struct device *dev);
/***********************
@ -1284,6 +1389,7 @@ struct device_driver;
struct bus_type {
const char *name;
struct device_attribute *dev_attrs;
int (*match)(struct device *dev, struct device_driver *drv);
int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
int (*probe)(struct device *dev);
@ -1295,6 +1401,7 @@ struct device_driver {
struct bus_type *bus;
struct module *owner;
const char *mod_name;
const struct of_device_id *of_match_table;
int (*probe) (struct device *dev);
int (*remove) (struct device *dev);
@ -1334,6 +1441,7 @@ struct device {
struct bus_type *bus;
struct class *class;
void *driver_data;
struct device_node *of_node;
};
struct device_attribute {
@ -1430,6 +1538,17 @@ int class_register(struct class *cls);
void class_unregister(struct class *cls);
void class_destroy(struct class *cls);
typedef void (*dr_release_t)(struct device *dev, void *res);
typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data);
void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp);
void devres_add(struct device *dev, void *res);
int devres_destroy(struct device *dev, dr_release_t release,
dr_match_t match, void *match_data);
void devres_free(void *res);
void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp);
#ifdef __cplusplus
#undef class
#endif
@ -1471,9 +1590,7 @@ void dma_free_coherent(struct device *, size_t, void *, dma_addr_t);
** linux/dma-mapping.h **
*************************/
static inline u64 DMA_BIT_MASK(unsigned n) {
return (n == 64) ? ~0ULL : (1ULL << n) - 1; }
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
/*********************
** linux/uaccess.h **
@ -1522,6 +1639,8 @@ static inline const char * dmi_get_system_info(int field) { return NULL; }
** linux/dcache.h **
********************/
#define __read_mostly
enum dentry_d_lock_class
{
DENTRY_D_LOCK_NESTED
@ -1640,8 +1759,11 @@ struct inode {
const struct inode_operations *i_op;
struct super_block *i_sb;
unsigned int i_flags;
void *i_private;
loff_t i_size;
union {
struct cdev *i_cdev;
};
void *i_private;
};
struct seq_file;
@ -1829,6 +1951,8 @@ void kunmap(struct page *page);
void *ioremap(resource_size_t offset, unsigned long size);
void iounmap(volatile void *addr);
void *devm_ioremap(struct device *dev, resource_size_t offset,
unsigned long size);
/**
* Map I/O memory write combined
@ -1915,7 +2039,7 @@ void synchronize_irq(unsigned int irq);
*****************/
#include <linux/pci_ids.h>
#include <linux/pci_regs.h>
#include <uapi/linux/pci_regs.h>
/*
* Definitions normally found in pci_regs.h
@ -1923,7 +2047,7 @@ void synchronize_irq(unsigned int irq);
//enum { PCI_BASE_ADDRESS_MEM_MASK = ~0x0fUL };
//enum { PCI_CAP_ID_AGP = 0x02 };
extern struct bus_type pci_bus_type;
enum { PCI_ANY_ID = ~0 };
enum { PCI_ANY_ID = ~0U };
enum { DEVICE_COUNT_RESOURCE = 6 };
//enum { PCIBIOS_MIN_MEM = 0UL };
@ -1938,6 +2062,10 @@ enum { DEVICE_COUNT_RESOURCE = 6 };
.vendor = (vend), .device = (dev), \
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
#define PCI_VDEVICE(vendor, device) \
PCI_VENDOR_ID_##vendor, (device), \
PCI_ANY_ID, PCI_ANY_ID, 0, 0
typedef enum { PCI_D0 = 0 } pci_power_t;
/*
@ -1967,10 +2095,30 @@ struct pci_dev {
pci_power_t current_state;
};
struct pci_fixup {
u16 vendor; /* You can use PCI_ANY_ID here of course */
u16 device; /* You can use PCI_ANY_ID here of course */
u32 class; /* You can use PCI_ANY_ID here too */
unsigned int class_shift; /* should be 0, 8, 16 */
void (*hook)(struct pci_dev *dev);
};
#ifdef __cplusplus
#undef class
#endif /* __cplusplus */
/* quirks */
#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \
class_shift, hook) \
static const struct pci_fixup __pci_fixup_##name __used \
__attribute__((__section__(#section), aligned((sizeof(void *))))) \
= { vendor, device, class, class_shift, hook };
#define DECLARE_PCI_FIXUP_CLASS_FINAL(vendor, device, class, \
class_shift, hook) \
DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \
vendor##device##hook, vendor, device, class, class_shift, hook)
enum {
PCI_ROM_RESOURCE = 6
};
@ -2166,7 +2314,7 @@ void security_task_getsecid(struct task_struct *p, u32 *secid);
*************************/
/*
* Needed by usb/core/devio.h, used to calculate ioctl opcodes
* Needed by drivers/input/evdev.c, used to calculate ioctl opcodes
*/
#include <asm-generic/ioctl.h>
@ -2175,7 +2323,7 @@ void security_task_getsecid(struct task_struct *p, u32 *secid);
** linux/cdev.h **
******************/
struct cdev { int dummy; };
struct cdev { struct kobject kobj; };
void cdev_init(struct cdev *, const struct file_operations *);
int cdev_add(struct cdev *, dev_t, unsigned);
void cdev_del(struct cdev *);
@ -2314,7 +2462,7 @@ struct hid_device;
static inline int hidraw_init(void) { return 0; }
static inline void hidraw_exit(void) { }
static inline void hidraw_report_event(struct hid_device *hid, u8 *data, int len) { }
static inline int hidraw_report_event(struct hid_device *hid, u8 *data, int len) { return 0; }
static inline int hidraw_connect(struct hid_device *hid) { return -1; }
static inline void hidraw_disconnect(struct hid_device *hid) { }
@ -2330,6 +2478,8 @@ static inline void synchronize_rcu(void) { }
#define rcu_dereference(p) p
#define rcu_assign_pointer(p,v) p = v
#define rcu_dereference_protected(p, c) p
/*********************
** linux/rculist.h **
@ -2349,13 +2499,20 @@ static inline void list_del_rcu(struct list_head *entry) {
list_del(entry); }
/*********************
** linux/lockdep.h **
*********************/
bool lockdep_is_held(void *);
/********************
** linux/random.h **
********************/
static inline void add_input_randomness(unsigned int type, unsigned int code,
unsigned int value) { }
void add_device_randomness(const void *, unsigned int);
/*********************
** linux/vmalloc.h **
@ -2532,6 +2689,8 @@ unsigned scsi_bufflen(struct scsi_cmnd *cmd);
void scsi_set_resid(struct scsi_cmnd *cmd, int resid);
int scsi_get_resid(struct scsi_cmnd *cmd);
struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd);
struct scsi_target *scsi_target(struct scsi_device *sdev);
/************************
@ -2544,7 +2703,9 @@ struct scsi_target
struct device dev;
unsigned int channel;
unsigned int id;
unsigned int pdt_1f_for_no_lun; /* PDT = 0x1f */
unsigned int pdt_1f_for_no_lun:1; /* PDT = 0x1f */
unsigned int no_report_luns:1; /* Don't use
* REPORT LUNS for scanning. */
unsigned int target_blocked;
char scsi_level;
};
@ -2583,8 +2744,11 @@ struct scsi_device
unsigned ordered_tags:1; /* ordered queue tag messages are enabled */
unsigned use_10_for_rw:1; /* first try 10-byte read / write */
unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */
unsigned no_report_opcodes:1; /* no REPORT SUPPORTED OPERATION CODES */
unsigned no_write_same:1; /* no WRITE SAME command */
unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */
unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */
unsigned skip_vpd_pages:1; /* do not read VPD pages */
unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */
unsigned allow_restart:1; /* issue START_UNIT in error handler */
unsigned fix_capacity:1; /* READ_CAPACITY is too high by 1 */
@ -2594,6 +2758,8 @@ struct scsi_device
unsigned last_sector_bug:1; /* do not use multisector accesses on
SD_LAST_BUGGY_SECTORS */
unsigned no_read_disc_info:1; /* avoid READ_DISC_INFO cmds */
unsigned try_rc_10_first:1; /* Try READ_CAPACACITY_10 first */
unsigned wce_default_on:1; /* Cache is ON by default */
unsigned int device_blocked; /* device returned QUEUE_FULL. */
@ -2623,11 +2789,24 @@ struct scsi_driver
** Networking support **
************************/
/*********************
** linux/if_vlan.h **
*********************/
enum { VLAN_HLEN = 4 };
/*****************
** linux/net.h **
*****************/
int net_ratelimit(void);
/********************
** linux/skbuff.h **
********************/
struct net_device;
enum {
NET_IP_ALIGN = 2,
CHECKSUM_COMPLETE = 2,
@ -2687,6 +2866,10 @@ struct sk_buff_head
spinlock_t lock;
};
#define skb_queue_walk(queue, skb) \
for (skb = (queue)->next; \
skb != (struct sk_buff *)(queue); \
skb = skb->next)
#define skb_queue_walk_safe(queue, skb, tmp) \
for (skb = (queue)->next, tmp = skb->next; \
@ -2708,6 +2891,18 @@ int skb_tailroom(const struct sk_buff *);
void skb_set_tail_pointer(struct sk_buff *, const int);
struct sk_buff *skb_clone(struct sk_buff *, gfp_t);
void skb_reserve(struct sk_buff *, int);
int skb_header_cloned(const struct sk_buff *);
struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, unsigned int length);
static inline
struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev,
unsigned int length, gfp_t gfp)
{
return netdev_alloc_skb_ip_align(dev, length);
}
static inline int skb_cloned(const struct sk_buff *skb) {
return skb->cloned; }
@ -2731,13 +2926,14 @@ void dev_kfree_skb(struct sk_buff *);
void dev_kfree_skb_any(struct sk_buff *);
/****************
** linux/if.h **
****************/
/*********************
** linux/uapi/if.h **
*********************/
enum {
IFF_PROMISC = 0x100, /* receive all packets */
IFF_ALLMULTI = 0x200, /* receive all multicast packets */
IFF_NOARP = 0x80, /* no APR protocol */
IFF_PROMISC = 0x100, /* receive all packets */
IFF_ALLMULTI = 0x200, /* receive all multicast packets */
IFF_MULTICAST = 0x1000, /* supports multicast */
IFNAMSIZ = 16,
};
@ -2763,13 +2959,18 @@ enum {
*********************/
enum {
DUPLEX_HALF = 0x0,
DUPLEX_FULL = 0x1,
ETHTOOL_GSET = 0x1,
ETHTOOL_FWVERS_LEN = 32,
ETHTOOL_BUSINFO_LEN = 32,
WAKE_PHY = 0x1,
WAKE_MAGIC = 0x20,
WAKE_PHY = 0,
WAKE_UCAST = (1 << 1),
WAKE_MCAST = (1 << 2),
WAKE_BCAST = (1 << 3),
WAKE_ARP = (1 << 4),
WAKE_MAGIC = (1 << 5),
SPEED_100 = 100,
SPEED_1000 = 1000,
@ -2782,6 +2983,11 @@ struct ethtool_cmd
u8 duplex;
};
struct ethtool_regs
{
u32 version;
};
struct ethtool_eeprom
{
u32 magic;
@ -2805,14 +3011,16 @@ struct ethtool_wolinfo {
};
struct ethhdr { };
struct ethtool_ts_info;
struct net_device;
struct ethtool_ops
{
int (*get_settings)(struct net_device *, struct ethtool_cmd *);
int (*set_settings)(struct net_device *, struct ethtool_cmd *);
void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
int (*get_regs_len)(struct net_device *);
void (*get_regs)(struct net_device *, struct ethtool_regs *, void *);
int (*nway_reset)(struct net_device *);
u32 (*get_link)(struct net_device *);
int (*get_eeprom_len)(struct net_device *);
@ -2822,16 +3030,21 @@ struct ethtool_ops
void (*set_msglevel)(struct net_device *, u32);
void (*get_wol)(struct net_device *, struct ethtool_wolinfo *);
int (*set_wol)(struct net_device *, struct ethtool_wolinfo *);
int (*get_ts_info)(struct net_device *, struct ethtool_ts_info *);
};
__u32 ethtool_cmd_speed(const struct ethtool_cmd *ep);
__u32 ethtool_cmd_speed(const struct ethtool_cmd *);
u32 ethtool_op_get_link(struct net_device *);
int ethtool_op_get_ts_info(struct net_device *, struct ethtool_ts_info *);
/***********************
** linux/netdevice.h **
***********************/
#include <linux/netdev_features.h>
#define netif_err(priv, type, dev, fmt, args...) dde_kit_printf("netif_err: " fmt, ## args);
#define netif_info(priv, type, dev, fmt, args...) dde_kit_printf("netif_info: " fmt, ## args);
@ -2857,10 +3070,6 @@ typedef enum netdev_tx netdev_tx_t;
enum {
MAX_ADDR_LEN = 32,
NETIF_F_HW_CSUM = 8,
NETIF_F_RXCSUM = (1 << 29),
NET_RX_SUCCESS = 0,
NETIF_MSG_DRV = 0x1,
@ -2879,7 +3088,7 @@ struct net_device_ops
int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd);
void (*ndo_tx_timeout) (struct net_device *dev);
int (*ndo_change_mtu)(struct net_device *dev, int new_mtu);
int (*ndo_set_features)(struct net_device *dev, u32 features);
int (*ndo_set_features)(struct net_device *dev, netdev_features_t features);
};
struct net_device_stats
@ -2914,12 +3123,16 @@ struct net_device
unsigned int flags;
unsigned short hard_header_len; /* hardware hdr length */
unsigned int mtu;
unsigned short needed_headroom;
unsigned short needed_tailroom;
unsigned char *dev_addr;
unsigned char _dev_addr[ETH_ALEN];
unsigned long trans_start; /* Time (in jiffies) of last Tx */
int watchdog_timeo; /* used by dev_watchdog() */
struct device dev;
void *priv;
struct phy_device *phydev;
};
@ -2952,8 +3165,8 @@ u32 netif_msg_init(int, int);
static inline void *netdev_priv(const struct net_device *dev) { return dev->priv; }
int netif_running(const struct net_device *);
int netif_device_present(struct net_device *);
int netif_running(const struct net_device *);
int netif_device_present(struct net_device *);
void netif_device_detach(struct net_device *);
void netif_start_queue(struct net_device *);
void netif_stop_queue(struct net_device *);
@ -2961,7 +3174,8 @@ void netif_wake_queue(struct net_device *);
void netif_device_attach(struct net_device *);
void unregister_netdev(struct net_device *);
void free_netdev(struct net_device *);
int netif_rx(struct sk_buff *);
int netif_rx(struct sk_buff *);
void netif_tx_wake_all_queues(struct net_device *);
void netif_carrier_off(struct net_device *);
int netdev_mc_empty(struct net_device *);
@ -2976,14 +3190,17 @@ enum {
FLOW_CTRL_RX = 0x2,
MII_BMCR = 0x0,
MII_PHYSID1 = 0x2,
MII_BMSR = 0x1,
MII_PHYSID1 = 0x2,
MII_PHYSID2 = 0x3,
MII_ADVERTISE = 0x4,
MII_LPA = 0x5,
MII_CTRL1000 = 0x9,
MII_CTRL1000 = 0x9,
BMCR_RESET = 0x8000, /* reset to default state */
BMCR_ANENABLE = 0x1000, /* enable auto negotiation */
BMCR_RESET = 0x8000, /* reset to default state */
BMCR_ANENABLE = 0x1000, /* enable auto negotiation */
BMSR_LSTATUS = 0x4,
ADVERTISE_PAUSE_CAP = 0x0400, /* try for pause */
ADVERTISE_CSMA = 0x0001, /* only selector supported */
@ -3038,6 +3255,7 @@ struct tasklet_struct
static inline void tasklet_schedule(struct tasklet_struct *t) { t->func(t->data); }
void tasklet_kill(struct tasklet_struct *);
/*************************
** linux/etherdevice.h **
*************************/
@ -3051,6 +3269,10 @@ void random_ether_addr(u8 *addr);
struct net_device *alloc_etherdev(int);
void eth_hw_addr_random(struct net_device *dev);
void eth_random_addr(u8 *addr);
/********************
** asm/checksum.h **
********************/
@ -3058,6 +3280,7 @@ struct net_device *alloc_etherdev(int);
__wsum csum_partial(const void *, int, __wsum);
__sum16 csum_fold(__wsum);
/********************
** linux/socket.h **
********************/
@ -3067,12 +3290,78 @@ struct sockaddr {
char sa_data[14];
};
/*****************
** linux/idr.h **
*****************/
#define DEFINE_IDA(name) struct ida name;
struct ida { };
int ida_simple_get(struct ida *ida, unsigned int start, unsigned int end,
gfp_t gfp_mask);
void ida_simple_remove(struct ida *ida, unsigned int id);
/*******************
** linux/async.h **
*******************/
struct async_domain { };
#define ASYNC_DOMAIN(name) struct async_domain name = { };
/*******************************
** uapi/linux/usbdevice_fs.h **
*******************************/
enum { USBDEVFS_HUB_PORTINFO };
struct usbdevfs_hub_portinfo
{
char nports;
char port [127];
};
/********************
** linux/bitmap.h **
********************/
int bitmap_subset(const unsigned long *,
const unsigned long *, int);
/*******************
** linux/crc16.h **
*******************/
u16 crc16(u16 crc, const u8 *buffer, size_t len);
/*******************
** linux/birev.h **
*******************/
u16 bitrev16(u16 in);
/******************
** linux/phy.h **
******************/
typedef enum {
PHY_INTERFACE_MODE_MII = 1,
} phy_interface_t;
/**********************************
** Platform specific defintions **
*********************************/
#include <platform/lx_emul.h>
**********************************/
#include <platform/lx_emul.h>
/**********
** misc **
**********/

View File

@ -27,6 +27,7 @@ void platform_execute(void *sp, void *func, void *arg)
}
extern "C" void module_ehci_hcd_init();
extern "C" void module_ehci_pci_init();
extern "C" void module_uhci_hcd_init();
inline void platform_hcd_init(Services *s)
@ -34,6 +35,7 @@ inline void platform_hcd_init(Services *s)
/* ehci_hcd should always be loaded before uhci_hcd and ohci_hcd, not after */
module_ehci_hcd_init();
module_ehci_pci_init();
module_uhci_hcd_init();
}

View File

@ -28,6 +28,7 @@ void platform_execute(void *sp, void *func, void *arg)
}
extern "C" void module_ehci_hcd_init();
extern "C" void module_ehci_pci_init();
extern "C" void module_uhci_hcd_init();
inline void platform_hcd_init(Services *s)
@ -35,6 +36,7 @@ inline void platform_hcd_init(Services *s)
/* ehci_hcd should always be loaded before uhci_hcd and ohci_hcd, not after */
module_ehci_hcd_init();
module_ehci_pci_init();
module_uhci_hcd_init();
}

View File

@ -369,6 +369,8 @@ void *kmalloc(size_t size, gfp_t flags)
if (a & 0x3)
PERR("Unaligned kmalloc %lx", a);
//PDBG("Kmalloc: [%lx-%lx) from %p", a, a + size, __builtin_return_address(0));
return addr;
}
@ -662,6 +664,12 @@ void *ioremap(resource_size_t offset, unsigned long size)
return _ioremap(offset, size, 0);
}
void *devm_ioremap(struct device *dev, resource_size_t offset,
unsigned long size)
{
return ioremap(offset, size);
}
/********************
** linux/device.h **
@ -672,7 +680,7 @@ void *ioremap(resource_size_t offset, unsigned long size)
*/
class Driver : public Genode::List<Driver>::Element
{
private:
public:
struct device_driver *_drv; /* Linux driver */
@ -748,6 +756,7 @@ int device_add(struct device *dev)
if (driver->match(dev)) {
int ret = driver->probe(dev);
dde_kit_log(DEBUG_DRIVER, "Probe return %d", ret);
if (!ret)
return 0;
}
@ -797,6 +806,13 @@ long find_next_zero_bit_le(const void *addr,
}
void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp)
{
return kzalloc(size, gfp);
}
/*******************************
** linux/byteorder/generic.h **
*******************************/

View File

@ -38,6 +38,7 @@ extern "C" void subsys_input_init();
extern "C" void module_evdev_init();
extern "C" void module_hid_init();
extern "C" void module_hid_init_core();
extern "C" void module_hid_init_generic();
extern "C" void module_usb_stor_init();
extern "C" void module_ch_init();
@ -66,6 +67,7 @@ static void init(Services *services)
/* HID */
module_hid_init_core();
module_hid_init();
module_hid_init_generic();
module_ch_init();
}

View File

@ -367,6 +367,11 @@ struct sk_buff *alloc_skb(unsigned int size, gfp_t priority)
return skb;
}
struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, unsigned int length)
{
return _alloc_skb(length + NET_IP_ALIGN, false);
}
void dev_kfree_skb(struct sk_buff *skb)
{
@ -500,6 +505,12 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
}
int skb_header_cloned(const struct sk_buff *skb)
{
return skb->cloned;
}
void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
{
skb->tail = skb->data + offset;
@ -591,11 +602,11 @@ struct sk_buff *skb_dequeue(struct sk_buff_head *list)
** linux/inerrupt.h **
**********************/
static void snprint_mac(char *buf, char *mac)
static void snprint_mac(u8 *buf, u8 *mac)
{
for (int i = 0; i < ETH_ALEN; i++)
{
Genode::snprintf(&buf[i * 3], 3, "%02x", mac[i]);
Genode::snprintf((char *)&buf[i * 3], 3, "%02x", mac[i]);
if ((i * 3) < MAC_LEN)
buf[(i * 3) + 2] = ':';
}
@ -604,11 +615,27 @@ static void snprint_mac(char *buf, char *mac)
}
/*************************
** linux/etherdevice.h **
*************************/
void eth_hw_addr_random(struct net_device *dev)
{
random_ether_addr(dev->_dev_addr);
}
void eth_random_addr(u8 *addr)
{
random_ether_addr(addr);
}
void random_ether_addr(u8 *addr)
{
using namespace Genode;
char str[MAC_LEN + 1];
char fallback[] = { 0x2e, 0x60, 0x90, 0x0c, 0x4e, 0x01 };
u8 str[MAC_LEN + 1];
u8 fallback[] = { 0x2e, 0x60, 0x90, 0x0c, 0x4e, 0x01 };
Nic::Mac_address mac;
/* try using configured mac */
@ -628,7 +655,7 @@ void random_ether_addr(u8 *addr)
/* use configured mac*/
Genode::memcpy(addr, mac.addr, ETH_ALEN);
snprint_mac(str, mac.addr);
snprint_mac(str, (u8 *)mac.addr);
PINF("Using configured mac: %s", str);
#ifdef GENODE_NET_STAT

View File

@ -195,7 +195,13 @@ int pci_register_driver(struct pci_driver *drv)
bool found = false;
while (id->vendor || id->subvendor || id->class_mask) {
while (id->device_class || id->class_mask) {
if (id->device_class == (unsigned)PCI_ANY_ID) {
dde_kit_log(DEBUG_PCI, "Skipping PCI_ANY_ID device class");
id++;
continue;
}
Pci::Device_capability cap = pci.first_device(id->device_class,
id->class_mask);

View File

@ -14,7 +14,6 @@
#include <signal.h>
#include <lx_emul.h>
static Signal_helper *_signal = 0;
/**
@ -238,3 +237,11 @@ int schedule_work(struct work_struct *work)
Work::schedule((void *)work, false);
return 1;
}
bool queue_delayed_work(struct workqueue_struct *wq,
struct delayed_work *dwork, unsigned long delay)
{
Work::schedule((void *)dwork, true);
return true;
}

View File

@ -167,8 +167,9 @@ void scsi_add_device(struct scsi_device *sdev)
* XXX move to 'main'
*/
if (!announce) {
enum { STACK_SIZE = 1024 * sizeof(addr_t) };
static Cap_connection cap_stor;
static Rpc_entrypoint ep_stor(&cap_stor, 4096, "usb_stor_ep");
static Rpc_entrypoint ep_stor(&cap_stor, STACK_SIZE, "usb_stor_ep");
static Block::Root root(&ep_stor, env()->heap(), _signal->receiver(), device);
env()->parent()->announce(ep_stor.manage(&root));
announce = true;