From 8bc14eb75a968da3a9533e57488694d71952cdcc Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Wed, 27 Feb 2013 12:05:44 +0100 Subject: [PATCH] usb: enable 64bit support for x86 Fix #436 --- dde_linux/lib/mk/x86_32/usb.mk | 7 +--- dde_linux/lib/mk/x86_64/usb.mk | 7 ++++ .../{x86 => x86_32}/platform/platform.h | 0 .../usb/include/x86_64/platform/platform.h | 41 +++++++++++++++++++ dde_linux/src/lib/usb/lx_emul.cc | 4 +- 5 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 dde_linux/lib/mk/x86_64/usb.mk rename dde_linux/src/lib/usb/include/{x86 => x86_32}/platform/platform.h (100%) create mode 100644 dde_linux/src/lib/usb/include/x86_64/platform/platform.h diff --git a/dde_linux/lib/mk/x86_32/usb.mk b/dde_linux/lib/mk/x86_32/usb.mk index 468e57938c..a537f77eb1 100644 --- a/dde_linux/lib/mk/x86_32/usb.mk +++ b/dde_linux/lib/mk/x86_32/usb.mk @@ -3,10 +3,5 @@ SRC_C += $(addprefix usb/host/,pci-quirks.c uhci-hcd.c) include $(REP_DIR)/lib/mk/usb.inc CC_OPT += -DCONFIG_PCI -INC_DIR += $(LIB_INC_DIR)/x86 +INC_DIR += $(LIB_INC_DIR)/x86_32 $(LIB_INC_DIR)/x86 SRC_CC += pci_driver.cc - - - - - diff --git a/dde_linux/lib/mk/x86_64/usb.mk b/dde_linux/lib/mk/x86_64/usb.mk new file mode 100644 index 0000000000..c1bcd6df8a --- /dev/null +++ b/dde_linux/lib/mk/x86_64/usb.mk @@ -0,0 +1,7 @@ +SRC_C += $(addprefix usb/host/,pci-quirks.c uhci-hcd.c) + +include $(REP_DIR)/lib/mk/usb.inc + +CC_OPT += -DCONFIG_PCI +INC_DIR += $(LIB_INC_DIR)/x86_64 $(LIB_INC_DIR)/x86 +SRC_CC += pci_driver.cc diff --git a/dde_linux/src/lib/usb/include/x86/platform/platform.h b/dde_linux/src/lib/usb/include/x86_32/platform/platform.h similarity index 100% rename from dde_linux/src/lib/usb/include/x86/platform/platform.h rename to dde_linux/src/lib/usb/include/x86_32/platform/platform.h diff --git a/dde_linux/src/lib/usb/include/x86_64/platform/platform.h b/dde_linux/src/lib/usb/include/x86_64/platform/platform.h new file mode 100644 index 0000000000..8f211f7fb9 --- /dev/null +++ b/dde_linux/src/lib/usb/include/x86_64/platform/platform.h @@ -0,0 +1,41 @@ +/** + * \brief Platform specific code + * \author Sebastian Sumpf + * \author Alexander Boettcher + * \date 2012-06-10 + */ + +/* + * Copyright (C) 2012-2013 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _X86_64__PLATFORM_H_ +#define _X86_64__PLATFORM_H_ + +#include + +static inline +void platform_execute(void *sp, void *func, void *arg) +{ + asm volatile ("movq %2, %%rdi;" + "movq %1, 0(%0);" + "movq %0, %%rsp;" + "call *0(%%rsp);" + : "+r" (sp), "+r" (func), "+r" (arg) : : "memory"); +} + +extern "C" void module_ehci_hcd_init(); +extern "C" void module_uhci_hcd_init(); + +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_uhci_hcd_init(); +} + +#endif /* _X86_64__PLATFORM_H_ */ diff --git a/dde_linux/src/lib/usb/lx_emul.cc b/dde_linux/src/lib/usb/lx_emul.cc index 7e4930a568..e3ca9d859b 100644 --- a/dde_linux/src/lib/usb/lx_emul.cc +++ b/dde_linux/src/lib/usb/lx_emul.cc @@ -572,7 +572,7 @@ struct kmem_cache struct kmem_cache *kmem_cache_create(const char *name, size_t size, size_t align, unsigned long falgs, void (*ctor)(void *)) { - dde_kit_log(DEBUG_SLAB, "\"%s\" obj_size=%d", name, size); + dde_kit_log(DEBUG_SLAB, "\"%s\" obj_size=%zd", name, size); struct kmem_cache *cache; @@ -643,7 +643,7 @@ void *_ioremap(resource_size_t phys_addr, unsigned long size, int wc) { dde_kit_addr_t map_addr; if (dde_kit_request_mem(phys_addr, size, wc, &map_addr)) { - PERR("Failed to request I/O memory: [%x,%lx)", phys_addr, phys_addr + size); + PERR("Failed to request I/O memory: [%zx,%lx)", phys_addr, phys_addr + size); return 0; }