[haiku-commits] BRANCH xyzzy-github.x86_64 - src/add-ons/kernel/bus_managers/usb src/add-ons/kernel/busses/usb src/add-ons/kernel/drivers/disk/usb/usb_disk src/add-ons/kernel/drivers/input/usb_hid build/jam

  • From: xyzzy-github.x86_64 <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 6 Aug 2012 11:49:17 +0200 (CEST)

added 3 changesets to branch 'refs/remotes/xyzzy-github/x86_64'
old head: cc30eec43d7b2a525040edc8d3879f21bb1c0c2d
new head: 44672ada83568d55e0bc5bdf60ad932161e13e2c

----------------------------------------------------------------------------

d8b4cfc: Get USB functional on x86-64.
  
  - Various changes to printf format specifiers to make them 32/64 safe.
  - Adjustments to various descriptor structures since addr_t is not 32-bit
    on x86-64, and consequently this breaks the physical structure that's
    expected. Also adjusted padding to accomodate 32-byte boundaries when
    64-bit pointers are in use.
  - Adjustments to make use of phys_addr_t where needed.

                                      [ Rene Gollent <anevilyak@xxxxxxxxx> ]

abfb41a: Added USB modules to image.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

44672ad: Add usb_hid to image and get it building/working.

                                      [ Rene Gollent <anevilyak@xxxxxxxxx> ]

----------------------------------------------------------------------------

15 files changed, 241 insertions(+), 194 deletions(-)
build/jam/Haiku64Image                             |   16 +-
src/add-ons/kernel/bus_managers/usb/Device.cpp     |    8 +-
src/add-ons/kernel/bus_managers/usb/Hub.cpp        |   31 ++--
src/add-ons/kernel/bus_managers/usb/Jamfile        |    3 +-
.../bus_managers/usb/PhysicalMemoryAllocator.cpp   |   24 ++-
.../bus_managers/usb/PhysicalMemoryAllocator.h     |    4 +-
src/add-ons/kernel/bus_managers/usb/Stack.cpp      |   15 +-
src/add-ons/kernel/bus_managers/usb/usb.cpp        |   86 +++++-----
src/add-ons/kernel/bus_managers/usb/usb_private.h  |    9 +-
.../kernel/bus_managers/usb/usbspec_private.h      |    4 +-
src/add-ons/kernel/busses/usb/ehci.cpp             |  134 +++++++++-------
src/add-ons/kernel/busses/usb/ehci.h               |    2 +-
src/add-ons/kernel/busses/usb/ehci_hardware.h      |   61 ++++---
.../kernel/drivers/disk/usb/usb_disk/usb_disk.cpp  |   24 +--
.../kernel/drivers/input/usb_hid/Driver.cpp        |   14 +-

############################################################################

Commit:      d8b4cfc9829119291e68cfe0152c239fd8850b3d

Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Sat Aug  4 21:52:27 2012 UTC
Committer:   Alex Smith <alex@xxxxxxxxxxxxxxxx>
Commit-Date: Mon Aug  6 08:23:38 2012 UTC

Get USB functional on x86-64.

- Various changes to printf format specifiers to make them 32/64 safe.
- Adjustments to various descriptor structures since addr_t is not 32-bit
  on x86-64, and consequently this breaks the physical structure that's
  expected. Also adjusted padding to accomodate 32-byte boundaries when
  64-bit pointers are in use.
- Adjustments to make use of phys_addr_t where needed.

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/bus_managers/usb/Device.cpp 
b/src/add-ons/kernel/bus_managers/usb/Device.cpp
index e169952..1d6ce1b 100644
--- a/src/add-ons/kernel/bus_managers/usb/Device.cpp
+++ b/src/add-ons/kernel/bus_managers/usb/Device.cpp
@@ -81,11 +81,11 @@ Device::Device(Object *parent, int8 hubAddress, uint8 
hubPort,
                        &actualLength);
 
                if (status < B_OK || actualLength != 
sizeof(usb_configuration_descriptor)) {
-                       TRACE_ERROR("error fetching configuration %ld\n", i);
+                       TRACE_ERROR("error fetching configuration %" B_PRId32 
"\n", i);
                        return;
                }
 
-               TRACE("configuration %ld\n", i);
+               TRACE("configuration %" B_PRId32 "\n", i);
                TRACE("\tlength:..............%d\n", configDescriptor.length);
                TRACE("\tdescriptor_type:.....0x%02x\n", 
configDescriptor.descriptor_type);
                TRACE("\ttotal_length:........%d\n", 
configDescriptor.total_length);
@@ -106,8 +106,8 @@ Device::Device(Object *parent, int8 hubAddress, uint8 
hubPort,
 
                if (status < B_OK || actualLength != 
configDescriptor.total_length) {
                        TRACE_ERROR("error fetching full configuration"
-                               " descriptor %ld got %lu expected %u\n", i,
-                               actualLength, configDescriptor.total_length);
+                               " descriptor %" B_PRId32 " got %" B_PRIuSIZE " 
expected %"
+                               B_PRIu16 "\n", i, actualLength, 
configDescriptor.total_length);
                        free(configData);
                        return;
                }
diff --git a/src/add-ons/kernel/bus_managers/usb/Hub.cpp 
b/src/add-ons/kernel/bus_managers/usb/Hub.cpp
index df51aea..271efaf 100644
--- a/src/add-ons/kernel/bus_managers/usb/Hub.cpp
+++ b/src/add-ons/kernel/bus_managers/usb/Hub.cpp
@@ -87,7 +87,7 @@ Hub::Hub(Object *parent, int8 hubAddress, uint8 hubPort,
                        USB_REQUEST_SET_FEATURE, PORT_POWER, i + 1, 0, NULL, 0, 
NULL);
 
                if (status < B_OK)
-                       TRACE_ERROR("power up failed on port %ld\n", i);
+                       TRACE_ERROR("power up failed on port %" B_PRId32 "\n", 
i);
        }
 
        // Wait for power to stabilize
@@ -201,10 +201,11 @@ Hub::Explore(change_item **changeList)
 
 #ifdef TRACE_USB
                if (fPortStatus[i].change) {
-                       TRACE("port %ld: status: 0x%04x; change: 0x%04x\n", i,
+                       TRACE("port %" B_PRId32 ": status: 0x%04x; change: 
0x%04x\n", i,
                                fPortStatus[i].status, fPortStatus[i].change);
-                       TRACE("device at port %ld: %p (%ld)\n", i, fChildren[i],
-                               fChildren[i] != NULL ? fChildren[i]->USBID() : 
0);
+                       TRACE("device at port %" B_PRId32 ": %p (%" B_PRId32 
")\n", i,
+                               fChildren[i], fChildren[i] != NULL
+                                       ? fChildren[i]->USBID() : 0);
                }
 #endif
 
@@ -216,7 +217,7 @@ Hub::Explore(change_item **changeList)
 
                        if (fPortStatus[i].status & PORT_STATUS_CONNECTION) {
                                // new device attached!
-                               TRACE_ALWAYS("port %ld: new device 
connected\n", i);
+                               TRACE_ALWAYS("port %" B_PRId32 ": new device 
connected\n", i);
 
                                int32 retry = 2;
                                while (retry--) {
@@ -226,7 +227,8 @@ Hub::Explore(change_item **changeList)
                                        // reset the port, this will also 
enable it
                                        result = ResetPort(i);
                                        if (result < B_OK) {
-                                               TRACE_ERROR("resetting port %ld 
failed\n", i);
+                                               TRACE_ERROR("resetting port %" 
B_PRId32 " failed\n",
+                                                       i);
                                                break;
                                        }
 
@@ -282,7 +284,7 @@ Hub::Explore(change_item **changeList)
                                }
                        } else {
                                // Device removed...
-                               TRACE_ALWAYS("port %ld: device removed\n", i);
+                               TRACE_ALWAYS("port %" B_PRId32 ": device 
removed\n", i);
                                if (fChildren[i] != NULL) {
                                        TRACE("removing device %p\n", 
fChildren[i]);
                                        fChildren[i]->Changed(changeList, 
false);
@@ -293,28 +295,31 @@ Hub::Explore(change_item **changeList)
 
                // other port changes we do not really handle, report and clear 
them
                if (fPortStatus[i].change & PORT_STATUS_ENABLE) {
-                       TRACE_ALWAYS("port %ld %sabled\n", i, 
(fPortStatus[i].status & PORT_STATUS_ENABLE) ? "en" : "dis");
+                       TRACE_ALWAYS("port %" B_PRId32 " %sabled\n", i,
+                               (fPortStatus[i].status & PORT_STATUS_ENABLE) ? 
"en" : "dis");
                        DefaultPipe()->SendRequest(USB_REQTYPE_CLASS | 
USB_REQTYPE_OTHER_OUT,
                                USB_REQUEST_CLEAR_FEATURE, C_PORT_ENABLE, i + 1,
                                0, NULL, 0, NULL);
                }
 
                if (fPortStatus[i].change & PORT_STATUS_SUSPEND) {
-                       TRACE_ALWAYS("port %ld is %ssuspended\n", i, 
(fPortStatus[i].status & PORT_STATUS_SUSPEND) ? "" : "not ");
+                       TRACE_ALWAYS("port %" B_PRId32 " is %ssuspended\n", i,
+                               (fPortStatus[i].status & PORT_STATUS_SUSPEND) ? 
"" : "not ");
                        DefaultPipe()->SendRequest(USB_REQTYPE_CLASS | 
USB_REQTYPE_OTHER_OUT,
                                USB_REQUEST_CLEAR_FEATURE, C_PORT_SUSPEND, i + 
1,
                                0, NULL, 0, NULL);
                }
 
                if (fPortStatus[i].change & PORT_STATUS_OVER_CURRENT) {
-                       TRACE_ALWAYS("port %ld is %sin an over current 
state\n", i, (fPortStatus[i].status & PORT_STATUS_OVER_CURRENT) ? "" : "not ");
+                       TRACE_ALWAYS("port %" B_PRId32 " is %sin an over 
current state\n",
+                               i, (fPortStatus[i].status & 
PORT_STATUS_OVER_CURRENT) ? "" : "not ");
                        DefaultPipe()->SendRequest(USB_REQTYPE_CLASS | 
USB_REQTYPE_OTHER_OUT,
                                USB_REQUEST_CLEAR_FEATURE, C_PORT_OVER_CURRENT, 
i + 1,
                                0, NULL, 0, NULL);
                }
 
                if (fPortStatus[i].change & PORT_STATUS_RESET) {
-                       TRACE_ALWAYS("port %ld was reset\n", i);
+                       TRACE_ALWAYS("port %" B_PRId32 "was reset\n", i);
                        DefaultPipe()->SendRequest(USB_REQTYPE_CLASS | 
USB_REQTYPE_OTHER_OUT,
                                USB_REQUEST_CLEAR_FEATURE, C_PORT_RESET, i + 1,
                                0, NULL, 0, NULL);
@@ -400,7 +405,7 @@ Hub::BuildDeviceName(char *string, uint32 *index, size_t 
bufferSize,
                if (*index < bufferSize) {
                        int32 managerIndex = 
GetStack()->IndexOfBusManager(GetBusManager());
                        size_t totalBytes = snprintf(string + *index, 
bufferSize - *index,
-                               "%ld", managerIndex);
+                               "%" B_PRId32, managerIndex);
                        *index += std::min(totalBytes, bufferSize - *index - 1);
                }
        }
@@ -418,7 +423,7 @@ Hub::BuildDeviceName(char *string, uint32 *index, size_t 
bufferSize,
                        if (fChildren[i] == device) {
                                if (*index < bufferSize) {
                                        size_t totalBytes = snprintf(string + 
*index,
-                                               bufferSize - *index, "/%ld", i);
+                                               bufferSize - *index, "/%" 
B_PRId32, i);
                                        *index += std::min(totalBytes, 
bufferSize - *index - 1);
                                }
                                break;
diff --git a/src/add-ons/kernel/bus_managers/usb/Jamfile 
b/src/add-ons/kernel/bus_managers/usb/Jamfile
index 737c74e..5c8afe8 100644
--- a/src/add-ons/kernel/bus_managers/usb/Jamfile
+++ b/src/add-ons/kernel/bus_managers/usb/Jamfile
@@ -28,8 +28,7 @@ KernelStaticLibrary libusb.a :
        Object.cpp
        PhysicalMemoryAllocator.cpp
        $(compatSources)
-       : -fno-pic
-;      
+;
 
 KernelAddon usb :
        usb.cpp
diff --git a/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.cpp 
b/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.cpp
index 29450ea..c86dbd0 100644
--- a/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.cpp
+++ b/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.cpp
@@ -77,8 +77,6 @@ PhysicalMemoryAllocator::PhysicalMemoryAllocator(const char 
*name,
 
        fArea = create_area(fName, &fLogicalBase, B_ANY_KERNEL_ADDRESS,
                roundedSize, B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
-               // TODO: Use B_CONTIGUOUS when the TODOs regarding 64 bit 
physical
-               // addresses are fixed (if possible).
        if (fArea < B_OK) {
                TRACE_ERROR(("PMA: failed to create memory area\n"));
                return;
@@ -131,9 +129,8 @@ PhysicalMemoryAllocator::_Unlock()
 
 status_t
 PhysicalMemoryAllocator::Allocate(size_t size, void **logicalAddress,
-       void **physicalAddress)
+       phys_addr_t *physicalAddress)
 {
-// TODO: physicalAddress should be a phys_addr_t*!
 #ifdef HAIKU_TARGET_PLATFORM_HAIKU
        if (debug_debugger_running()) {
                for (int32 i = 0; i < 64; i++) {
@@ -142,7 +139,7 @@ PhysicalMemoryAllocator::Allocate(size_t size, void 
**logicalAddress,
                                fDebugUseMap |= mask;
                                *logicalAddress = (void *)((uint8 
*)fLogicalBase + fDebugBase
                                        + i * fDebugChunkSize);
-                               *physicalAddress = (void *)(fPhysicalBase + 
fDebugBase
+                               *physicalAddress = (phys_addr_t)(fPhysicalBase 
+ fDebugBase
                                        + i * fDebugChunkSize);
                                return B_OK;
                        }
@@ -204,7 +201,7 @@ PhysicalMemoryAllocator::Allocate(size_t size, void 
**logicalAddress,
                                _Unlock();
                                size_t offset = fBlockSize[arrayToUse] * i;
                                *logicalAddress = (void *)((uint8 
*)fLogicalBase + offset);
-                               *physicalAddress = (void *)(fPhysicalBase + 
offset);
+                               *physicalAddress = (phys_addr_t)(fPhysicalBase 
+ offset);
                                return B_OK;
                        }
                }
@@ -234,9 +231,8 @@ PhysicalMemoryAllocator::Allocate(size_t size, void 
**logicalAddress,
 
 status_t
 PhysicalMemoryAllocator::Deallocate(size_t size, void *logicalAddress,
-       void *physicalAddress)
+       phys_addr_t physicalAddress)
 {
-// TODO: physicalAddress should be a phys_addr_t!
 #ifdef HAIKU_TARGET_PLATFORM_HAIKU
        if (debug_debugger_running()) {
                uint32 index = ((uint8 *)logicalAddress - (uint8 *)fLogicalBase
@@ -259,9 +255,9 @@ PhysicalMemoryAllocator::Deallocate(size_t size, void 
*logicalAddress,
                }
        }
 
-       uint32 offset;
+       phys_addr_t offset;
        if (logicalAddress)
-               offset = (uint32)logicalAddress - (uint32)fLogicalBase;
+               offset = (addr_t)logicalAddress - (addr_t)fLogicalBase;
        else if (physicalAddress)
                offset = (addr_t)physicalAddress - fPhysicalBase;
        else {
@@ -318,7 +314,7 @@ PhysicalMemoryAllocator::PrintToStream()
        dprintf("\tMin block size:\t\t\t%ld bytes\n", fBlockSize[0]);
        dprintf("\tMax block size:\t\t\t%ld bytes\n", fBlockSize[fArrayCount - 
1]);
        dprintf("\tMin count per block:\t%ld\n\n", fArrayLength[fArrayCount - 
1]);
-       dprintf("\tArray count:\t\t\t%ld\n", fArrayCount);
+       dprintf("\tArray count:\t\t\t%" B_PRId32 "\n", fArrayCount);
 
        dprintf("\tArray slots:\t\t\t% 8ld", fArrayLength[0]);
        for (int32 i = 1; i < fArrayCount; i++)
@@ -344,7 +340,7 @@ PhysicalMemoryAllocator::DumpArrays()
 {
        uint32 padding = 2;
        for (int32 i = 0; i < fArrayCount; i++) {
-               dprintf("\tArray(%ld):\t", i);
+               dprintf("\tArray(%" B_PRId32 "):\t", i);
                for (size_t j = 0; j < fArrayLength[i]; j++) {
                        if (padding > 2) {
                                for (uint32 k = 0; k < (padding - 2) / 4; k++)
@@ -393,9 +389,9 @@ PhysicalMemoryAllocator::DumpFreeSlots()
                }
 
                if (i > 0)
-                       dprintf(", % 8ld", freeSlots);
+                       dprintf(", %8" B_PRIu32, freeSlots);
                else
-                       dprintf("% 8ld", freeSlots);
+                       dprintf("%8" B_PRIu32, freeSlots);
        }
        dprintf("\n");
 }
diff --git a/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.h 
b/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.h
index 90207ce..ce12f24 100644
--- a/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.h
+++ b/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.h
@@ -26,12 +26,12 @@ public:
 
                status_t                                        Allocate(size_t 
size,
                                                                                
void **logicalAddress,
-                                                                               
void **physicalAddress);
+                                                                               
phys_addr_t *physicalAddress);
 
                // one of both addresses needs to be provided, the other may be 
NULL
                status_t                                        
Deallocate(size_t size,
                                                                                
void *logicalAddress,
-                                                                               
void *physicalAddress);
+                                                                               
phys_addr_t physicalAddress);
 
                void                                            PrintToStream();
                void                                            DumpArrays();
diff --git a/src/add-ons/kernel/bus_managers/usb/Stack.cpp 
b/src/add-ons/kernel/bus_managers/usb/Stack.cpp
index 049d6f0..6c81516 100644
--- a/src/add-ons/kernel/bus_managers/usb/Stack.cpp
+++ b/src/add-ons/kernel/bus_managers/usb/Stack.cpp
@@ -278,24 +278,25 @@ Stack::BusManagerAt(int32 index) const
 
 
 status_t
-Stack::AllocateChunk(void **logicalAddress, void **physicalAddress, size_t 
size)
+Stack::AllocateChunk(void **logicalAddress, phys_addr_t *physicalAddress,
+       size_t size)
 {
        return fAllocator->Allocate(size, logicalAddress, physicalAddress);
 }
 
 
 status_t
-Stack::FreeChunk(void *logicalAddress, void *physicalAddress, size_t size)
+Stack::FreeChunk(void *logicalAddress, phys_addr_t physicalAddress,
+       size_t size)
 {
        return fAllocator->Deallocate(size, logicalAddress, physicalAddress);
 }
 
 
 area_id
-Stack::AllocateArea(void **logicalAddress, void **physicalAddress, size_t size,
+Stack::AllocateArea(void **logicalAddress, phys_addr_t *physicalAddress, 
size_t size,
        const char *name)
 {
-// TODO: physicalAddress should be a phys_addr_t*!
        TRACE("allocating %ld bytes for %s\n", size, name);
 
        void *logAddress;
@@ -323,10 +324,10 @@ Stack::AllocateArea(void **logicalAddress, void 
**physicalAddress, size_t size,
                *logicalAddress = logAddress;
 
        if (physicalAddress)
-               *physicalAddress = (void*)(addr_t)physicalEntry.address;
+               *physicalAddress = (phys_addr_t)physicalEntry.address;
 
-       TRACE("area = %ld, size = %ld, log = %p, phy = %#" B_PRIxPHYSADDR "\n",
-               area, size, logAddress, physicalEntry.address);
+       TRACE("area = %" B_PRId32 ", size = %" B_PRIuSIZE ", log = %p, phy = %#"
+               B_PRIxPHYSADDR "\n", area, size, logAddress, 
physicalEntry.address);
        return area;
 }
 
diff --git a/src/add-ons/kernel/bus_managers/usb/usb.cpp 
b/src/add-ons/kernel/bus_managers/usb/usb.cpp
index 7887f2b..83cf8a9 100644
--- a/src/add-ons/kernel/bus_managers/usb/usb.cpp
+++ b/src/add-ons/kernel/bus_managers/usb/usb.cpp
@@ -145,7 +145,7 @@ uninstall_notify(const char *driverName)
 const usb_device_descriptor *
 get_device_descriptor(usb_device device)
 {
-       TRACE_MODULE("get_device_descriptor(%ld)\n", device);
+       TRACE_MODULE("get_device_descriptor(%" B_PRId32 ")\n", device);
        Object *object = gUSBStack->GetObject(device);
        if (!object || (object->Type() & USB_OBJECT_DEVICE) == 0)
                return NULL;
@@ -157,7 +157,8 @@ get_device_descriptor(usb_device device)
 const usb_configuration_info *
 get_nth_configuration(usb_device device, uint32 index)
 {
-       TRACE_MODULE("get_nth_configuration(%ld, %lu)\n", device, index);
+       TRACE_MODULE("get_nth_configuration(%" B_PRId32 ", %" B_PRIu32 ")\n",
+               device, index);
        Object *object = gUSBStack->GetObject(device);
        if (!object || (object->Type() & USB_OBJECT_DEVICE) == 0)
                return NULL;
@@ -169,7 +170,7 @@ get_nth_configuration(usb_device device, uint32 index)
 const usb_configuration_info *
 get_configuration(usb_device device)
 {
-       TRACE_MODULE("get_configuration(%ld)\n", device);
+       TRACE_MODULE("get_configuration(%" B_PRId32 ")\n", device);
        Object *object = gUSBStack->GetObject(device);
        if (!object || (object->Type() & USB_OBJECT_DEVICE) == 0)
                return NULL;
@@ -182,7 +183,8 @@ status_t
 set_configuration(usb_device device,
        const usb_configuration_info *configuration)
 {
-       TRACE_MODULE("set_configuration(%ld, %p)\n", device, configuration);
+       TRACE_MODULE("set_configuration(%" B_PRId32 ", %p)\n", device,
+               configuration);
        Object *object = gUSBStack->GetObject(device);
        if (!object || (object->Type() & USB_OBJECT_DEVICE) == 0)
                return B_DEV_INVALID_PIPE;
@@ -194,7 +196,7 @@ set_configuration(usb_device device,
 status_t
 set_alt_interface(usb_device device, const usb_interface_info *interface)
 {
-       TRACE_MODULE("set_alt_interface(%ld, %p)\n", device, interface);
+       TRACE_MODULE("set_alt_interface(%" B_PRId32 ", %p)\n", device, 
interface);
        Object *object = gUSBStack->GetObject(device);
        if (!object || (object->Type() & USB_OBJECT_DEVICE) == 0)
                return B_DEV_INVALID_PIPE;
@@ -206,7 +208,7 @@ set_alt_interface(usb_device device, const 
usb_interface_info *interface)
 status_t
 set_feature(usb_id handle, uint16 selector)
 {
-       TRACE_MODULE("set_feature(%ld, %d)\n", handle, selector);
+       TRACE_MODULE("set_feature(%" B_PRId32 ", %d)\n", handle, selector);
        Object *object = gUSBStack->GetObject(handle);
        if (!object)
                return B_DEV_INVALID_PIPE;
@@ -218,7 +220,7 @@ set_feature(usb_id handle, uint16 selector)
 status_t
 clear_feature(usb_id handle, uint16 selector)
 {
-       TRACE_MODULE("clear_feature(%ld, %d)\n", handle, selector);
+       TRACE_MODULE("clear_feature(%" B_PRId32 ", %d)\n", handle, selector);
        Object *object = gUSBStack->GetObject(handle);
        if (!object)
                return B_DEV_INVALID_PIPE;
@@ -230,7 +232,7 @@ clear_feature(usb_id handle, uint16 selector)
 status_t
 get_status(usb_id handle, uint16 *status)
 {
-       TRACE_MODULE("get_status(%ld, %p)\n", handle, status);
+       TRACE_MODULE("get_status(%" B_PRId32 ", %p)\n", handle, status);
        if (!status)
                return B_BAD_VALUE;
 
@@ -246,7 +248,8 @@ status_t
 get_descriptor(usb_device device, uint8 type, uint8 index, uint16 languageID,
        void *data, size_t dataLength, size_t *actualLength)
 {
-       TRACE_MODULE("get_descriptor(%ld, 0x%02x, 0x%02x, 0x%04x, %p, %ld, 
%p)\n",
+       TRACE_MODULE("get_descriptor(%" B_PRId32 ", 0x%02x, 0x%02x, 0x%04x, %p, 
"
+               "%" B_PRIuSIZE ", %p)\n",
                device, type, index, languageID, data, dataLength, 
actualLength);
        Object *object = gUSBStack->GetObject(device);
        if (!object || (object->Type() & USB_OBJECT_DEVICE) == 0)
@@ -261,8 +264,9 @@ status_t
 send_request(usb_device device, uint8 requestType, uint8 request,
        uint16 value, uint16 index, uint16 length, void *data, size_t 
*actualLength)
 {
-       TRACE_MODULE("send_request(%ld, 0x%02x, 0x%02x, 0x%04x, 0x%04x, %d, %p, 
%p)\n",
-               device, requestType, request, value, index, length, data, 
actualLength);
+       TRACE_MODULE("send_request(%" B_PRId32 ", 0x%02x, 0x%02x, 0x%04x, 
0x%04x, "
+               "%d, %p, %p)\n", device, requestType, request, value, index, 
length,
+               data, actualLength);
        Object *object = gUSBStack->GetObject(device);
        if (!object || (object->Type() & USB_OBJECT_DEVICE) == 0)
                return B_DEV_INVALID_PIPE;
@@ -277,9 +281,9 @@ queue_request(usb_device device, uint8 requestType, uint8 
request,
        uint16 value, uint16 index, uint16 length, void *data,
        usb_callback_func callback, void *callbackCookie)
 {
-       TRACE_MODULE("queue_request(%ld, 0x%02x, 0x%02x, 0x%04x, 0x%04x, %u, 
%p, %p, %p)\n",
-               device, requestType, request, value, index, length, data, 
callback,
-               callbackCookie);
+       TRACE_MODULE("queue_request(%" B_PRId32 ", 0x%02x, 0x%02x, 0x%04x, 
0x%04x,"
+               " %u, %p, %p, %p)\n", device, requestType, request, value, 
index,
+               length, data, callback, callbackCookie);
        Object *object = gUSBStack->GetObject(device);
        if (!object || (object->Type() & USB_OBJECT_DEVICE) == 0)
                return B_DEV_INVALID_PIPE;
@@ -293,7 +297,7 @@ status_t
 queue_interrupt(usb_pipe pipe, void *data, size_t dataLength,
        usb_callback_func callback, void *callbackCookie)
 {
-       TRACE_MODULE("queue_interrupt(%ld, %p, %ld, %p, %p)\n",
+       TRACE_MODULE("queue_interrupt(%" B_PRId32 ", %p, %ld, %p, %p)\n",
                pipe, data, dataLength, callback, callbackCookie);
        Object *object = gUSBStack->GetObject(pipe);
        if (!object || (object->Type() & USB_OBJECT_INTERRUPT_PIPE) == 0)
@@ -308,7 +312,7 @@ status_t
 queue_bulk(usb_pipe pipe, void *data, size_t dataLength,
        usb_callback_func callback, void *callbackCookie)
 {
-       TRACE_MODULE("queue_bulk(%ld, %p, %ld, %p, %p)\n",
+       TRACE_MODULE("queue_bulk(%"B_PRId32 ", %p, %" B_PRIuSIZE ", %p, %p)\n",
                pipe, data, dataLength, callback, callbackCookie);
        Object *object = gUSBStack->GetObject(pipe);
        if (!object || (object->Type() & USB_OBJECT_BULK_PIPE) == 0)
@@ -323,7 +327,7 @@ status_t
 queue_bulk_v(usb_pipe pipe, iovec *vector, size_t vectorCount,
        usb_callback_func callback, void *callbackCookie)
 {
-       TRACE_MODULE("queue_bulk_v(%ld, %p, %ld, %p, %p)\n",
+       TRACE_MODULE("queue_bulk_v(%" B_PRId32 ", %p, %" B_PRIuSIZE " %p, 
%p)\n",
                pipe, vector, vectorCount, callback, callbackCookie);
        Object *object = gUSBStack->GetObject(pipe);
        if (!object || (object->Type() & USB_OBJECT_BULK_PIPE) == 0)
@@ -338,8 +342,8 @@ status_t
 queue_bulk_v_physical(usb_pipe pipe, iovec *vector, size_t vectorCount,
        usb_callback_func callback, void *callbackCookie)
 {
-       TRACE_MODULE("queue_bulk_v_physical(%ld, %p, %ld, %p, %p)\n",
-               pipe, vector, vectorCount, callback, callbackCookie);
+       TRACE_MODULE("queue_bulk_v_physical(%" B_PRId32 ", %p, %" B_PRIuSIZE
+               ", %p, %p)\n", pipe, vector, vectorCount, callback, 
callbackCookie);
        Object *object = gUSBStack->GetObject(pipe);
        if (!object || (object->Type() & USB_OBJECT_BULK_PIPE) == 0)
                return B_DEV_INVALID_PIPE;
@@ -355,7 +359,8 @@ queue_isochronous(usb_pipe pipe, void *data, size_t 
dataLength,
        uint32 *startingFrameNumber, uint32 flags, usb_callback_func callback,
        void *callbackCookie)
 {
-       TRACE_MODULE("queue_isochronous(%ld, %p, %ld, %p, %ld, %p, 0x%08lx, %p, 
%p)\n",
+       TRACE_MODULE("queue_isochronous(%" B_PRId32 ", %p, %" B_PRIuSIZE ", %p, 
"
+               "%" B_PRId32 ", %p, 0x%08" B_PRIx32 ", %p, %p)\n",
                pipe, data, dataLength, packetDesc, packetCount, 
startingFrameNumber,
                flags, callback, callbackCookie);
        Object *object = gUSBStack->GetObject(pipe);
@@ -372,8 +377,8 @@ status_t
 set_pipe_policy(usb_pipe pipe, uint8 maxQueuedPackets,
        uint16 maxBufferDurationMS, uint16 sampleSize)
 {
-       TRACE_MODULE("set_pipe_policy(%ld, %d, %d, %d)\n", pipe, 
maxQueuedPackets,
-               maxBufferDurationMS, sampleSize);
+       TRACE_MODULE("set_pipe_policy(%" B_PRId32 ", %d, %d, %d)\n", pipe,
+               maxQueuedPackets, maxBufferDurationMS, sampleSize);
        Object *object = gUSBStack->GetObject(pipe);
        if (!object || (object->Type() & USB_OBJECT_ISO_PIPE) == 0)
                return B_DEV_INVALID_PIPE;
@@ -386,7 +391,7 @@ set_pipe_policy(usb_pipe pipe, uint8 maxQueuedPackets,
 status_t
 cancel_queued_transfers(usb_pipe pipe)
 {
-       TRACE_MODULE("cancel_queued_transfers(%ld)\n", pipe);
+       TRACE_MODULE("cancel_queued_transfers(%" B_PRId32 ")\n", pipe);
        Object *object = gUSBStack->GetObject(pipe);
        if (!object || (object->Type() & USB_OBJECT_PIPE) == 0)
                return B_DEV_INVALID_PIPE;
@@ -398,7 +403,8 @@ cancel_queued_transfers(usb_pipe pipe)
 status_t
 usb_ioctl(uint32 opcode, void *buffer, size_t bufferSize)
 {
-       TRACE_MODULE("usb_ioctl(%lu, %p, %ld)\n", opcode, buffer, bufferSize);
+       TRACE_MODULE("usb_ioctl(%" B_PRIu32 ", %p, %" B_PRIuSIZE ")\n", opcode,
+               buffer, bufferSize);
 
        switch (opcode) {
                case 'DNAM': {
@@ -564,21 +570,21 @@ struct usb_module_info gModuleInfoV3 = {
 const usb_device_descriptor *
 get_device_descriptor_v2(const void *device)
 {
-       return get_device_descriptor((usb_id)device);
+       return get_device_descriptor((usb_id)(ssize_t)device);
 }
 
 
 const usb_configuration_info *
 get_nth_configuration_v2(const void *device, uint index)
 {
-       return get_nth_configuration((usb_id)device, index);
+       return get_nth_configuration((usb_id)(ssize_t)device, index);
 }
 
 
 const usb_configuration_info *
 get_configuration_v2(const void *device)
 {
-       return get_configuration((usb_id)device);
+       return get_configuration((usb_id)(ssize_t)device);
 }
 
 
@@ -586,35 +592,35 @@ status_t
 set_configuration_v2(const void *device,
        const usb_configuration_info *configuration)
 {
-       return set_configuration((usb_id)device, configuration);
+       return set_configuration((usb_id)(ssize_t)device, configuration);
 }
 
 
 status_t
 set_alt_interface_v2(const void *device, const usb_interface_info *interface)
 {
-       return set_alt_interface((usb_id)device, interface);
+       return set_alt_interface((usb_id)(ssize_t)device, interface);
 }
 
 
 status_t
 set_feature_v2(const void *object, uint16 selector)
 {
-       return set_feature((usb_id)object, selector);
+       return set_feature((usb_id)(ssize_t)object, selector);
 }
 
 
 status_t
 clear_feature_v2(const void *object, uint16 selector)
 {
-       return clear_feature((usb_id)object, selector);
+       return clear_feature((usb_id)(ssize_t)object, selector);
 }
 
 
 status_t
 get_status_v2(const void *object, uint16 *status)
 {
-       return get_status((usb_id)object, status);
+       return get_status((usb_id)(ssize_t)object, status);
 }
 
 
@@ -622,7 +628,7 @@ status_t
 get_descriptor_v2(const void *device, uint8 type, uint8 index,
        uint16 languageID, void *data, size_t dataLength, size_t *actualLength)
 {
-       return get_descriptor((usb_id)device, type, index, languageID, data,
+       return get_descriptor((usb_id)(ssize_t)device, type, index, languageID, 
data,
                dataLength, actualLength);
 }
 
@@ -632,7 +638,7 @@ send_request_v2(const void *device, uint8 requestType, 
uint8 request,
        uint16 value, uint16 index, uint16 length, void *data,
        size_t /*dataLength*/, size_t *actualLength)
 {
-       return send_request((usb_id)device, requestType, request, value, index,
+       return send_request((usb_id)(ssize_t)device, requestType, request, 
value, index,
                length, data, actualLength);
 }
 
@@ -642,7 +648,7 @@ queue_request_v2(const void *device, uint8 requestType, 
uint8 request,
        uint16 value, uint16 index, uint16 length, void *data,
        size_t /*dataLength*/, usb_callback_func callback, void *callbackCookie)
 {
-       return queue_request((usb_id)device, requestType, request, value, index,
+       return queue_request((usb_id)(ssize_t)device, requestType, request, 
value, index,
                length, data, callback, callbackCookie);
 }
 
@@ -651,7 +657,7 @@ status_t
 queue_interrupt_v2(const void *pipe, void *data, size_t dataLength,
        usb_callback_func callback, void *callbackCookie)
 {
-       return queue_interrupt((usb_id)pipe, data, dataLength, callback,
+       return queue_interrupt((usb_id)(ssize_t)pipe, data, dataLength, 
callback,
                callbackCookie);
 }
 
@@ -660,7 +666,7 @@ status_t
 queue_bulk_v2(const void *pipe, void *data, size_t dataLength,
        usb_callback_func callback, void *callbackCookie)
 {
-       return queue_bulk((usb_id)pipe, data, dataLength, callback,
+       return queue_bulk((usb_id)(ssize_t)pipe, data, dataLength, callback,
                callbackCookie);
 }
 
@@ -673,7 +679,7 @@ queue_isochronous_v2(const void *pipe, void *data, size_t 
dataLength,
        // ToDo: convert rlea to usb_iso_packet_descriptor
        // ToDo: use a flag to indicate that the callback shall produce a rlea
        usb_iso_packet_descriptor *packetDesc = NULL;
-       return queue_isochronous((usb_id)pipe, data, dataLength, packetDesc, 0,
+       return queue_isochronous((usb_id)(ssize_t)pipe, data, dataLength, 
packetDesc, 0,
                NULL, 0, callback, callbackCookie);
 }
 
@@ -682,7 +688,7 @@ status_t
 set_pipe_policy_v2(const void *pipe, uint8 maxQueuedPackets,
        uint16 maxBufferDurationMS, uint16 sampleSize)
 {
-       return set_pipe_policy((usb_id)pipe, maxQueuedPackets, 
maxBufferDurationMS,
+       return set_pipe_policy((usb_id)(ssize_t)pipe, maxQueuedPackets, 
maxBufferDurationMS,
                sampleSize);
 }
 
@@ -690,7 +696,7 @@ set_pipe_policy_v2(const void *pipe, uint8 maxQueuedPackets,
 status_t
 cancel_queued_transfers_v2(const void *pipe)
 {
-       return cancel_queued_transfers((usb_id)pipe);
+       return cancel_queued_transfers((usb_id)(ssize_t)pipe);
 }
 
 
diff --git a/src/add-ons/kernel/bus_managers/usb/usb_private.h 
b/src/add-ons/kernel/bus_managers/usb/usb_private.h
index dbc3f04..be8b321 100644
--- a/src/add-ons/kernel/bus_managers/usb/usb_private.h
+++ b/src/add-ons/kernel/bus_managers/usb/usb_private.h
@@ -17,7 +17,7 @@
 
 #define TRACE_OUTPUT(x, y, z...) \
        { \
-               dprintf("usb %s%s %ld: ", y, (x)->TypeName(), (x)->USBID()); \
+               dprintf("usb %s%s %" B_PRId32 ": ", y, (x)->TypeName(), 
(x)->USBID()); \
                dprintf(z); \
        }
 
@@ -136,13 +136,14 @@ public:
                BusManager *                                    
BusManagerAt(int32 index) const;
 
                status_t                                                
AllocateChunk(void **logicalAddress,
-                                                                               
        void **physicalAddress,
+                                                                               
        phys_addr_t *physicalAddress,
                                                                                
        size_t size);
                status_t                                                
FreeChunk(void *logicalAddress,
-                                                                               
        void *physicalAddress, size_t size);
+                                                                               
        phys_addr_t physicalAddress,
+                                                                               
        size_t size);
 
                area_id                                                 
AllocateArea(void **logicalAddress,
-                                                                               
        void **physicalAddress,
+                                                                               
        phys_addr_t *physicalAddress,
                                                                                
        size_t size, const char *name);
 
                void                                                    
NotifyDeviceChange(Device *device,
diff --git a/src/add-ons/kernel/bus_managers/usb/usbspec_private.h 
b/src/add-ons/kernel/bus_managers/usb/usbspec_private.h
index 5e70ad2..2103994 100644
--- a/src/add-ons/kernel/bus_managers/usb/usbspec_private.h
+++ b/src/add-ons/kernel/bus_managers/usb/usbspec_private.h
@@ -39,8 +39,8 @@
 
 struct memory_chunk
 {
-       addr_t next_item;
-       addr_t physical;
+       uint32 next_item;
+       uint32 physical;
 };
 
 
diff --git a/src/add-ons/kernel/busses/usb/ehci.cpp 
b/src/add-ons/kernel/busses/usb/ehci.cpp
index 86ca326..4427448 100644
--- a/src/add-ons/kernel/busses/usb/ehci.cpp
+++ b/src/add-ons/kernel/busses/usb/ehci.cpp
@@ -65,7 +65,9 @@ void
 print_descriptor_chain(ehci_qtd *descriptor)
 {
        while (descriptor) {
-               dprintf(" %08lx n%08lx a%08lx t%08lx %08lx %08lx %08lx %08lx 
%08lx s%ld\n",
+               dprintf(" %08" B_PRIx32 " n%08" B_PRIx32 " a%08" B_PRIx32 " 
t%08" B_PRIx32
+                       " %08" B_PRIx32 " %08" B_PRIx32 " %08" B_PRIx32 " %08" 
B_PRIx32
+                       " %08" B_PRIx32 " s%"B_PRIuSIZE "\n",
                        descriptor->this_phy, descriptor->next_phy,
                        descriptor->alt_next_phy, descriptor->token,
                        descriptor->buffer_phy[0], descriptor->buffer_phy[1],
@@ -82,14 +84,17 @@ print_descriptor_chain(ehci_qtd *descriptor)
 void
 print_queue(ehci_qh *queueHead)
 {
-       dprintf("queue:    t%08lx n%08lx ch%08lx ca%08lx cu%08lx\n",
+       dprintf("queue:    t%08" B_PRIx32 " n%08" B_PRIx32 " ch%08" B_PRIx32
+               " ca%08" B_PRIx32 " cu%08" B_PRIx32 "\n",
                queueHead->this_phy, queueHead->next_phy, 
queueHead->endpoint_chars,
                queueHead->endpoint_caps, queueHead->current_qtd_phy);
-       dprintf("overlay:  n%08lx a%08lx t%08lx %08lx %08lx %08lx %08lx 
%08lx\n",
-               queueHead->overlay.next_phy, queueHead->overlay.alt_next_phy,
-               queueHead->overlay.token, queueHead->overlay.buffer_phy[0],
-               queueHead->overlay.buffer_phy[1], 
queueHead->overlay.buffer_phy[2],
-               queueHead->overlay.buffer_phy[3], 
queueHead->overlay.buffer_phy[4]);
+       dprintf("overlay:  n%08" B_PRIx32 " a%08" B_PRIx32 " t%08" B_PRIx32
+               " %08" B_PRIx32 " %08" B_PRIx32 " %08" B_PRIx32 " %08" B_PRIx32
+               " %08" B_PRIx32 "\n", queueHead->overlay.next_phy,
+               queueHead->overlay.alt_next_phy, queueHead->overlay.token,
+               queueHead->overlay.buffer_phy[0], 
queueHead->overlay.buffer_phy[1],
+               queueHead->overlay.buffer_phy[2], 
queueHead->overlay.buffer_phy[3],
+               queueHead->overlay.buffer_phy[4]);
        print_descriptor_chain(queueHead->element_log);
 }
 
@@ -201,11 +206,12 @@ EHCI::EHCI(pci_info *info, Stack *stack)
 
        // map the registers
        uint32 offset = fPCIInfo->u.h0.base_registers[0] & (B_PAGE_SIZE - 1);
-       addr_t physicalAddress = fPCIInfo->u.h0.base_registers[0] - offset;
+       phys_addr_t physicalAddress = fPCIInfo->u.h0.base_registers[0] - offset;
        size_t mapSize = (fPCIInfo->u.h0.base_register_sizes[0] + offset
                + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1);
 
-       TRACE("map physical memory 0x%08lx (base: 0x%08lx; offset: %lx); size: 
%ld\n",
+       TRACE("map physical memory 0x%08" B_PRIx32 " (base: 0x%08" 
B_PRIxPHYSADDR
+               "; offset: %" B_PRIx32 "); size: %" B_PRIu32 "\n",
                fPCIInfo->u.h0.base_registers[0], physicalAddress, offset,
                fPCIInfo->u.h0.base_register_sizes[0]);
 
@@ -220,11 +226,11 @@ EHCI::EHCI(pci_info *info, Stack *stack)
 
        fCapabilityRegisters += offset;
        fOperationalRegisters = fCapabilityRegisters + 
ReadCapReg8(EHCI_CAPLENGTH);
-       TRACE("mapped capability registers: 0x%08lx\n", 
(uint32)fCapabilityRegisters);
-       TRACE("mapped operational registers: 0x%08lx\n", 
(uint32)fOperationalRegisters);
+       TRACE("mapped capability registers: 0x%p\n", fCapabilityRegisters);
+       TRACE("mapped operational registers: 0x%p\n", fOperationalRegisters);
 
-       TRACE("structural parameters: 0x%08lx\n", ReadCapReg32(EHCI_HCSPARAMS));
-       TRACE("capability parameters: 0x%08lx\n", ReadCapReg32(EHCI_HCCPARAMS));
+       TRACE("structural parameters: 0x%08" B_PRIx32 "\n", 
ReadCapReg32(EHCI_HCSPARAMS));
+       TRACE("capability parameters: 0x%08" B_PRIx32 "\n", 
ReadCapReg32(EHCI_HCCPARAMS));
 
        if (EHCI_HCCPARAMS_FRAME_CACHE(ReadCapReg32(EHCI_HCCPARAMS)))
                fThreshold = 2 + 8;
@@ -237,7 +243,7 @@ EHCI::EHCI(pci_info *info, Stack *stack)
        uint32 extendedCapPointer = ReadCapReg32(EHCI_HCCPARAMS) >> 
EHCI_ECP_SHIFT;
        extendedCapPointer &= EHCI_ECP_MASK;
        if (extendedCapPointer > 0) {
-               TRACE("extended capabilities register at %ld\n", 
extendedCapPointer);
+               TRACE("extended capabilities register at %" B_PRIu32 "\n", 
extendedCapPointer);
 
                uint32 legacySupport = 
sPCIModule->read_pci_config(fPCIInfo->bus,
                        fPCIInfo->device, fPCIInfo->function, 
extendedCapPointer, 4);
@@ -376,7 +382,7 @@ EHCI::EHCI(pci_info *info, Stack *stack)
 
        // allocate the periodic frame list
        fPeriodicFrameListArea = fStack->AllocateArea((void 
**)&fPeriodicFrameList,
-               (void **)&physicalAddress, frameListSize, "USB EHCI Periodic 
Framelist");
+               &physicalAddress, frameListSize, "USB EHCI Periodic Framelist");
        if (fPeriodicFrameListArea < B_OK) {
                TRACE_ERROR("unable to allocate periodic framelist\n");
                return;
@@ -389,7 +395,7 @@ EHCI::EHCI(pci_info *info, Stack *stack)
 
        // create the interrupt entries to support different polling intervals
        TRACE("creating interrupt entries\n");
-       addr_t physicalBase = physicalAddress + B_PAGE_SIZE;
+       uint32_t physicalBase = physicalAddress + B_PAGE_SIZE;
        uint8 *logicalBase = (uint8 *)fPeriodicFrameList + B_PAGE_SIZE;
        memset(logicalBase, 0, B_PAGE_SIZE);
 
@@ -410,16 +416,21 @@ EHCI::EHCI(pci_info *info, Stack *stack)
                        | (0xff << EHCI_QH_CAPS_ISM_SHIFT);
 
                physicalBase += sizeof(interrupt_entry);
+               if ((physicalBase & 0x10) != 0) {
+                       panic("physical base for interrupt entry %" B_PRId32
+                               " not aligned on 32, interrupt entry structure 
size %lu\n",
+                                       i, sizeof(interrupt_entry));
+               }
        }
 
        // create the itd and sitd entries
        TRACE("build up iso entries\n");
-       addr_t itdPhysicalBase = physicalAddress + B_PAGE_SIZE + B_PAGE_SIZE;
+       uint32_t itdPhysicalBase = physicalAddress + B_PAGE_SIZE + B_PAGE_SIZE;
        itd_entry* itds = (itd_entry *)((uint8 *)fPeriodicFrameList + 
B_PAGE_SIZE
                + B_PAGE_SIZE);
        memset(itds, 0, itdListSize);
 
-       addr_t sitdPhysicalBase = itdPhysicalBase + itdListSize;
+       uint32_t sitdPhysicalBase = itdPhysicalBase + itdListSize;
        sitd_entry* sitds = (sitd_entry *)((uint8 *)fPeriodicFrameList + 
B_PAGE_SIZE
                + B_PAGE_SIZE + itdListSize);
        memset(sitds, 0, sitdListSize);
@@ -427,23 +438,25 @@ EHCI::EHCI(pci_info *info, Stack *stack)
        fItdEntries = new(std::nothrow) ehci_itd 
*[EHCI_VFRAMELIST_ENTRIES_COUNT];
        fSitdEntries = new(std::nothrow) ehci_sitd 
*[EHCI_VFRAMELIST_ENTRIES_COUNT];
 
+       dprintf("sitd entry size %lu, itd entry size %lu\n", 
sizeof(sitd_entry), sizeof(itd_entry));
        for (int32 i = 0; i < EHCI_VFRAMELIST_ENTRIES_COUNT; i++) {
                ehci_sitd *sitd = &sitds[i].sitd;
                sitd->this_phy = sitdPhysicalBase | EHCI_ITEM_TYPE_SITD;
                sitd->back_phy = EHCI_ITEM_TERMINATE;
                fSitdEntries[i] = sitd;
-               TRACE("sitd entry %ld %p 0x%lx\n", i, sitd, sitd->this_phy);
+               TRACE("sitd entry %" B_PRId32 " %p 0x%" B_PRIx32 "\n", i, sitd, 
sitd->this_phy);
 
                ehci_itd *itd = &itds[i].itd;
                itd->this_phy = itdPhysicalBase | EHCI_ITEM_TYPE_ITD;
                itd->next_phy = sitd->this_phy;
                fItdEntries[i] = itd;
-               TRACE("itd entry %ld %p 0x%lx\n", i, itd, itd->this_phy);
+               TRACE("itd entry %" B_PRId32 " %p 0x%" B_PRIx32 "\n", i, itd, 
itd->this_phy);
 
                sitdPhysicalBase += sizeof(sitd_entry);
                itdPhysicalBase += sizeof(itd_entry);
                if ((sitdPhysicalBase & 0x10) != 0 || (itdPhysicalBase & 0x10) 
!= 0)
-                       panic("physical base for entry %ld not aligned on 
32\n", i);
+                       panic("physical base for entry %" B_PRId32 " not 
aligned on 32\n",
+                               i);
        }
 
        // build flat interrupt tree
@@ -479,7 +492,7 @@ EHCI::EHCI(pci_info *info, Stack *stack)
        for (int32 i = 0; i < EHCI_FRAMELIST_ENTRIES_COUNT; i++) {
                fPeriodicFrameList[i] =
                        fItdEntries[i & (EHCI_VFRAMELIST_ENTRIES_COUNT - 
1)]->this_phy;
-               TRACE("periodic entry %ld linked to 0x%lx\n", i, 
fPeriodicFrameList[i]);
+               TRACE("periodic entry %" B_PRId32 " linked to 0x%" B_PRIx32 
"\n", i, fPeriodicFrameList[i]);
        }
 
        // Create the array that will keep bandwidth information
@@ -504,7 +517,7 @@ EHCI::EHCI(pci_info *info, Stack *stack)
        fAsyncQueueHead->overlay.next_phy = EHCI_ITEM_TERMINATE;
 
        WriteOpReg(EHCI_ASYNCLISTADDR, (uint32)fAsyncQueueHead->this_phy);
-       TRACE("set the async list addr to 0x%08lx\n", 
ReadOpReg(EHCI_ASYNCLISTADDR));
+       TRACE("set the async list addr to 0x%08" B_PRIx32 "\n", 
ReadOpReg(EHCI_ASYNCLISTADDR));
 
        fInitOK = true;
        TRACE("EHCI host controller driver constructed\n");
@@ -554,7 +567,7 @@ status_t
 EHCI::Start()
 {
        TRACE("starting EHCI host controller\n");
-       TRACE("usbcmd: 0x%08lx; usbsts: 0x%08lx\n", ReadOpReg(EHCI_USBCMD),
+       TRACE("usbcmd: 0x%08" B_PRIx32 "; usbsts: 0x%08" B_PRIx32 "\n", 
ReadOpReg(EHCI_USBCMD),
                ReadOpReg(EHCI_USBSTS));
 
        bool hasPerPortChangeEvent = (ReadCapReg32(EHCI_HCCPARAMS)
@@ -589,7 +602,7 @@ EHCI::Start()
        bool running = false;
        for (int32 i = 0; i < 10; i++) {
                uint32 status = ReadOpReg(EHCI_USBSTS);
-               TRACE("try %ld: status 0x%08lx\n", i, status);
+               TRACE("try %" B_PRId32 ": status 0x%08" B_PRIx32 "\n", i, 
status);
 
                if (status & EHCI_USBSTS_HCHALTED) {
                        snooze(10000);
@@ -729,9 +742,10 @@ EHCI::SubmitIsochronous(Transfer *transfer)
                return B_NO_MEMORY;
        }
 
-       TRACE("isochronous submitted size=%ld bytes, TDs=%ld, "
-               "maxPacketSize=%ld, packetSize=%ld, restSize=%ld\n", 
transfer->DataLength(),
-               isochronousData->packet_count, pipe->MaxPacketSize(), 
packetSize, restSize);
+       TRACE("isochronous submitted size=%" B_PRIuSIZE " bytes, TDs=%" 
B_PRIu32 ", "
+               "maxPacketSize=%" B_PRIuSIZE ", packetSize=%" B_PRIuSIZE ", 
restSize=%"
+               B_PRIuSIZE "\n", transfer->DataLength(), 
isochronousData->packet_count,
+               pipe->MaxPacketSize(), packetSize, restSize);
 
        // Find the entry where to start inserting the first Isochronous 
descriptor
        if (isochronousData->flags & USB_ISO_ASAP ||
@@ -741,7 +755,7 @@ EHCI::SubmitIsochronous(Transfer *transfer)
                        currentFrame = fNextStartingFrame;
                else {
                        uint32 threshold = fThreshold;
-                       TRACE("threshold: %ld\n", threshold);
+                       TRACE("threshold: %" B_PRIu32 "\n", threshold);
 
                        // find the first available frame with enough bandwidth.
                        // This should always be the case, as defining the 
starting frame
@@ -768,8 +782,8 @@ EHCI::SubmitIsochronous(Transfer *transfer)
        uint16 itdIndex = 0;
        size_t dataLength = transfer->DataLength();
        void* bufferLog;
-       addr_t bufferPhy;
-       if (fStack->AllocateChunk(&bufferLog, (void**)&bufferPhy, dataLength) < 
B_OK) {
+       phys_addr_t bufferPhy;
+       if (fStack->AllocateChunk(&bufferLog, &bufferPhy, dataLength) < B_OK) {
                TRACE_ERROR("unable to allocate itd buffer\n");
                delete[] isoRequest;
                return B_NO_MEMORY;
@@ -777,7 +791,7 @@ EHCI::SubmitIsochronous(Transfer *transfer)
 
        memset(bufferLog, 0, dataLength);
 
-       addr_t currentPhy = bufferPhy;
+       phys_addr_t currentPhy = bufferPhy;
        uint32 frameCount = 0;
        while (dataLength > 0) {
                ehci_itd* itd = CreateItdDescriptor();
@@ -792,7 +806,7 @@ EHCI::SubmitIsochronous(Transfer *transfer)
                                | (length << EHCI_ITD_TLENGTH_SHIFT) | (pg << 
EHCI_ITD_PG_SHIFT)
                                | (offset << EHCI_ITD_TOFFSET_SHIFT);
                        itd->last_token = i;
-                       TRACE("isochronous filled slot %ld 0x%lx\n", i, 
itd->token[i]);
+                       TRACE("isochronous filled slot %" B_PRId32 " 0x%" 
B_PRIx32 "\n", i, itd->token[i]);
                        dataLength -= length;
                        offset += length;
                        if (dataLength > 0 && offset > 0xfff) {
@@ -815,7 +829,8 @@ EHCI::SubmitIsochronous(Transfer *transfer)
                        ((((pipe->MaxPacketSize() >> 
EHCI_ITD_MAXPACKETSIZE_LENGTH) + 1)
                        & EHCI_ITD_MUL_MASK) << EHCI_ITD_MUL_SHIFT);
 
-               TRACE("isochronous filled itd buffer_phy[0,1,2] 0x%lx, 0x%lx 
0x%lx\n",
+               TRACE("isochronous filled itd buffer_phy[0,1,2] 0x%" B_PRIx32 
", 0x%"
+                       B_PRIx32 " 0x%" B_PRIx32 "\n",
                        itd->buffer_phy[0], itd->buffer_phy[1], 
itd->buffer_phy[2]);
 
                if (!LockIsochronous())
@@ -905,7 +920,8 @@ EHCI::AddTo(Stack *stack)
        if (!sPCIModule) {
                status_t status = get_module(B_PCI_MODULE_NAME, (module_info 
**)&sPCIModule);
                if (status < B_OK) {
-                       TRACE_MODULE_ERROR("getting pci module failed! 
0x%08lx\n", status);
+                       TRACE_MODULE_ERROR("getting pci module failed! 0x%08" 
B_PRIx32
+                               "\n", status);
                        return status;
                }
        }
@@ -1178,7 +1194,7 @@ EHCI::Interrupt()
        uint32 status = ReadOpReg(EHCI_USBSTS) & EHCI_USBSTS_INTMASK;
        if ((status & fEnabledInterrupts) == 0) {
                if (status != 0) {
-                       TRACE("discarding not enabled interrupts 0x%08lx\n", 
status);
+                       TRACE("discarding not enabled interrupts 0x%08" 
B_PRIx32 "\n", status);
                        WriteOpReg(EHCI_USBSTS, status);
                }
 
@@ -1480,13 +1496,14 @@ EHCI::FinishTransfers()
                                uint32 status = descriptor->token;
                                if (status & EHCI_QTD_STATUS_ACTIVE) {
                                        // still in progress
-                                       TRACE("qtd (0x%08lx) still active\n", 
descriptor->this_phy);
+                                       TRACE("qtd (0x%08" B_PRIx32 ") still 
active\n", descriptor->this_phy);
                                        break;
                                }
 
                                if (status & EHCI_QTD_STATUS_ERRMASK) {
                                        // a transfer error occured
-                                       TRACE_ERROR("qtd (0x%08lx) error: 
0x%08lx\n", descriptor->this_phy, status);
+                                       TRACE_ERROR("qtd (0x%" B_PRIx32 ") 
error: 0x%08" B_PRIx32
+                                               "\n", descriptor->this_phy, 
status);
 
                                        uint8 errorCount = status >> 
EHCI_QTD_ERRCOUNT_SHIFT;
                                        errorCount &= EHCI_QTD_ERRCOUNT_MASK;
@@ -1535,7 +1552,7 @@ EHCI::FinishTransfers()
 
                                if (descriptor->next_phy & EHCI_ITEM_TERMINATE) 
{
                                        // we arrived at the last (stray) 
descriptor, we're done
-                                       TRACE("qtd (0x%08lx) done\n", 
descriptor->this_phy);
+                                       TRACE("qtd (0x%08" B_PRIx32 ") done\n", 
descriptor->this_phy);
                                        callbackStatus = B_OK;
                                        transferDone = true;
                                        break;
@@ -1718,9 +1735,10 @@ EHCI::FinishIsochronousTransfers()
 
                        ehci_itd *itd = fItdEntries[currentFrame];
 
-                       TRACE("FinishIsochronousTransfers itd %p phy 0x%lx prev 
(%p/0x%lx)"
-                               " at frame %ld\n", itd, itd->this_phy, 
itd->prev,
-                               itd->prev != NULL ? itd->prev->this_phy : 0, 
currentFrame);
+                       TRACE("FinishIsochronousTransfers itd %p phy 0x%" 
B_PRIx32
+                               " prev (%p/0x%" B_PRIx32 ") at frame %" 
B_PRId32 "\n", itd,
+                               itd->this_phy, itd->prev, itd->prev != NULL
+                                       ? itd->prev->this_phy : 0, 
currentFrame);
 
                        if (!LockIsochronous())
                                continue;
@@ -1728,9 +1746,10 @@ EHCI::FinishIsochronousTransfers()
                        // Process the frame till it has isochronous 
descriptors in it.
                        while (!(itd->next_phy & EHCI_ITEM_TERMINATE) && 
itd->prev != NULL) {
                                TRACE("FinishIsochronousTransfers checking itd 
%p last_token"
-                                       " %ld\n", itd, itd->last_token);
-                               TRACE("FinishIsochronousTransfers tokens 0x%lx 
0x%lx 0x%lx "
-                                       "0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n",
+                                       " %" B_PRId32 "\n", itd, 
itd->last_token);
+                               TRACE("FinishIsochronousTransfers tokens 0x%" 
B_PRIx32 " 0x%"
+                                       B_PRIx32 " 0x%" B_PRIx32 " 0x%" 
B_PRIx32 " 0x%" B_PRIx32
+                                       " 0x%" B_PRIx32 " 0x%" B_PRIx32 " 0x%" 
B_PRIx32 "\n",
                                        itd->token[0], itd->token[1], 
itd->token[2], itd->token[3],
                                        itd->token[4], itd->token[5], 
itd->token[6], itd->token[7]);
                                if (((itd->token[itd->last_token] >> 
EHCI_ITD_STATUS_SHIFT)
@@ -1784,7 +1803,7 @@ EHCI::FinishIsochronousTransfers()
                                        delete [] transfer->descriptors;
                                        delete transfer->transfer;
                                        fStack->FreeChunk(transfer->buffer_log,
-                                               (void *)transfer->buffer_phy, 
transfer->buffer_size);
+                                               
(phys_addr_t)transfer->buffer_phy, transfer->buffer_size);
                                        delete transfer;
                                        transferDone = true;
                                } else {
@@ -1809,7 +1828,7 @@ ehci_qh *
 EHCI::CreateQueueHead()
 {
        ehci_qh *result;
-       void *physicalAddress;
+       phys_addr_t physicalAddress;
        if (fStack->AllocateChunk((void **)&result, &physicalAddress,
                sizeof(ehci_qh)) < B_OK) {
                TRACE_ERROR("failed to allocate queue head\n");
@@ -1889,7 +1908,7 @@ EHCI::FreeQueueHead(ehci_qh *queueHead)
 
        FreeDescriptorChain(queueHead->element_log);
        FreeDescriptor(queueHead->stray_log);
-       fStack->FreeChunk(queueHead, (void *)queueHead->this_phy, 
sizeof(ehci_qh));
+       fStack->FreeChunk(queueHead, (phys_addr_t)queueHead->this_phy, 
sizeof(ehci_qh));
 }
 
 
@@ -2088,7 +2107,7 @@ ehci_qtd *
 EHCI::CreateDescriptor(size_t bufferSize, uint8 pid)
 {
        ehci_qtd *result;
-       void *physicalAddress;
+       phys_addr_t physicalAddress;
        if (fStack->AllocateChunk((void **)&result, &physicalAddress,
                sizeof(ehci_qtd)) < B_OK) {
                TRACE_ERROR("failed to allocate a qtd\n");
@@ -2118,7 +2137,7 @@ EHCI::CreateDescriptor(size_t bufferSize, uint8 pid)
        if (fStack->AllocateChunk(&result->buffer_log, &physicalAddress,
                bufferSize) < B_OK) {
                TRACE_ERROR("unable to allocate qtd buffer\n");
-               fStack->FreeChunk(result, (void *)result->this_phy, 
sizeof(ehci_qtd));
+               fStack->FreeChunk(result, (phys_addr_t)result->this_phy, 
sizeof(ehci_qtd));
                return NULL;
        }
 
@@ -2181,10 +2200,10 @@ EHCI::FreeDescriptor(ehci_qtd *descriptor)
 
        if (descriptor->buffer_log) {
                fStack->FreeChunk(descriptor->buffer_log,
-                       (void *)descriptor->buffer_phy[0], 
descriptor->buffer_size);
+                       (phys_addr_t)descriptor->buffer_phy[0], 
descriptor->buffer_size);
        }
 
-       fStack->FreeChunk(descriptor, (void *)descriptor->this_phy,
+       fStack->FreeChunk(descriptor, (phys_addr_t)descriptor->this_phy,
                sizeof(ehci_qtd));
 }
 
@@ -2207,7 +2226,7 @@ ehci_itd *
 EHCI::CreateItdDescriptor()
 {
        ehci_itd *result;
-       void *physicalAddress;
+       phys_addr_t physicalAddress;
        if (fStack->AllocateChunk((void **)&result, &physicalAddress,
                sizeof(ehci_itd)) < B_OK) {
                TRACE_ERROR("failed to allocate a itd\n");
@@ -2226,7 +2245,7 @@ ehci_sitd *
 EHCI::CreateSitdDescriptor()
 {
        ehci_sitd *result;
-       void *physicalAddress;
+       phys_addr_t physicalAddress;
        if (fStack->AllocateChunk((void **)&result, &physicalAddress,
                sizeof(ehci_sitd)) < B_OK) {
                TRACE_ERROR("failed to allocate a sitd\n");
@@ -2247,7 +2266,7 @@ EHCI::FreeDescriptor(ehci_itd *descriptor)
        if (!descriptor)
                return;
 
-       fStack->FreeChunk(descriptor, (void *)descriptor->this_phy,
+       fStack->FreeChunk(descriptor, (phys_addr_t)descriptor->this_phy,
                sizeof(ehci_itd));
 }
 
@@ -2258,7 +2277,7 @@ EHCI::FreeDescriptor(ehci_sitd *descriptor)
        if (!descriptor)
                return;
 
-       fStack->FreeChunk(descriptor, (void *)descriptor->this_phy,
+       fStack->FreeChunk(descriptor, (phys_addr_t)descriptor->this_phy,
                sizeof(ehci_sitd));
 }
 
@@ -2558,7 +2577,8 @@ 
EHCI::ReadIsochronousDescriptorChain(isochronous_transfer_data *transfer)
                }
        }
 
-       TRACE("ReadIsochronousDescriptorChain packet count %ld\n", packet);
+       TRACE("ReadIsochronousDescriptorChain packet count %" B_PRId32 "\n",
+               packet);
 
        return totalLength;
 }
diff --git a/src/add-ons/kernel/busses/usb/ehci.h 
b/src/add-ons/kernel/busses/usb/ehci.h
index 8692939..4680e2b 100644
--- a/src/add-ons/kernel/busses/usb/ehci.h
+++ b/src/add-ons/kernel/busses/usb/ehci.h
@@ -199,7 +199,7 @@ static      pci_module_info *                       
sPCIModule;
 
                // Periodic transfer framelist and interrupt entries
                area_id                                         
fPeriodicFrameListArea;
-               addr_t *                                        
fPeriodicFrameList;
+               uint32 *                                        
fPeriodicFrameList;
                interrupt_entry *                       fInterruptEntries;
                ehci_itd **                                     fItdEntries;
                ehci_sitd **                            fSitdEntries;
diff --git a/src/add-ons/kernel/busses/usb/ehci_hardware.h 
b/src/add-ons/kernel/busses/usb/ehci_hardware.h
index 876414d..90579f6 100644
--- a/src/add-ons/kernel/busses/usb/ehci_hardware.h
+++ b/src/add-ons/kernel/busses/usb/ehci_hardware.h
@@ -130,13 +130,13 @@
 // Isochronous (High-Speed) Transfer Descriptors (iTD, EHCI Spec 3.2)
 typedef struct ehci_itd {
        // Hardware Part
-       addr_t          next_phy;
+       uint32          next_phy;
        uint32          token[8];
-       addr_t          buffer_phy[7];
-       addr_t          ext_buffer_phy[7];
+       uint32          buffer_phy[7];
+       uint32          ext_buffer_phy[7];
 
        // Software Part
-       addr_t          this_phy;
+       uint32          this_phy;
        struct ehci_itd *next;
        struct ehci_itd *prev;
        uint32          last_token;
@@ -172,7 +172,7 @@ typedef struct ehci_itd {
 // Split Transaction Isochronous Transfer Descriptors (siTD, EHCI Spec 3.3)
 typedef struct ehci_sitd {
        // Hardware Part
-       addr_t          next_phy;
+       uint32          next_phy;
        uint8           port_number;
        uint8           hub_address;
        uint8           endpoint;
@@ -183,34 +183,34 @@ typedef struct ehci_sitd {
        uint16          transfer_length;
        uint8           cprogmask;
        uint8           status;
-       addr_t          buffer_phy[2];
-       addr_t          back_phy;
-       addr_t          ext_buffer_phy[2];
+       uint32          buffer_phy[2];
+       uint32          back_phy;
+       uint32          ext_buffer_phy[2];
 
        // Software Part
-       addr_t          this_phy;
+       uint32          this_phy;
        struct ehci_sitd *next;
        struct ehci_sitd *prev;
        size_t          buffer_size;
        void            *buffer_log;
-} ehci_sitd;
+} _PACKED ehci_sitd;
 
 // Queue Element Transfer Descriptors (qTD, EHCI Spec 3.5)
 typedef struct ehci_qtd {
        // Hardware Part
-       addr_t          next_phy;
-       addr_t          alt_next_phy;
+       uint32          next_phy;
+       uint32          alt_next_phy;
        uint32          token;
-       addr_t          buffer_phy[5];
-       addr_t          ext_buffer_phy[5];
+       uint32          buffer_phy[5];
+       uint32          ext_buffer_phy[5];
 
        // Software Part
-       addr_t          this_phy;
+       uint32          this_phy;
        struct ehci_qtd *next_log;
        void            *alt_next_log;
        size_t          buffer_size;
        void            *buffer_log;
-} ehci_qtd;
+} _PACKED ehci_qtd;
 
 
 #define EHCI_QTD_DATA_TOGGLE   (1 << 31)
@@ -244,21 +244,21 @@ typedef struct ehci_qtd {
 // Queue Head (QH, EHCI Spec 3.6)
 typedef struct ehci_qh {
        // Hardware Part
-       addr_t          next_phy;
+       uint32          next_phy;
        uint32          endpoint_chars;
        uint32          endpoint_caps;
-       addr_t          current_qtd_phy;
+       uint32          current_qtd_phy;
 
        struct {
-               addr_t          next_phy;
-               addr_t          alt_next_phy;
+               uint32          next_phy;
+               uint32          alt_next_phy;
                uint32          token;
-               addr_t          buffer_phy[5];
-               addr_t          ext_buffer_phy[5];
+               uint32          buffer_phy[5];
+               uint32          ext_buffer_phy[5];
        } overlay;
 
        // Software Part
-       addr_t          this_phy;
+       uint32          this_phy;
        struct ehci_qh *next_log;
        struct ehci_qh *prev_log;
        ehci_qtd        *stray_log;
@@ -268,17 +268,30 @@ typedef struct ehci_qh {
 
 typedef struct {
        ehci_qh         queue_head;
+#ifdef B_HAIKU_64_BIT
+       uint32          padding[6];
+#else
        uint32          padding[2];
+#endif
 } interrupt_entry;
 
 typedef struct {
        ehci_itd        itd;
+#ifdef B_HAIKU_64_BIT
+       uint32          padding[1]; // align on 128
+#else
        uint32          padding[5]; // align on 128
+#endif
 } itd_entry;
 
 typedef struct {
        ehci_sitd       sitd;
-       uint32          padding[2]; // align on 64
+
+#ifdef B_HAIKU_64_BIT
+       uint32          padding[14]; // align on 64
+#else
+       uint32          padding[2]; // align on 64
+#endif
 } sitd_entry;
 
 #define EHCI_INTERRUPT_ENTRIES_COUNT   (7 + 1)         // (log 128 / log 2) + 1
diff --git a/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp 
b/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp
index 70236c5..28b0ec4 100644
--- a/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp
+++ b/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp
@@ -18,7 +18,7 @@
 
 #define DRIVER_NAME                    "usb_disk"
 #define DEVICE_NAME_BASE       "disk/usb/"
-#define DEVICE_NAME                    DEVICE_NAME_BASE"%ld/%d/raw"
+#define DEVICE_NAME                    DEVICE_NAME_BASE"%" B_PRIu32 "/%d/raw"
 
 
 //#define TRACE_USB_DISK
@@ -130,7 +130,7 @@ status_t    usb_disk_receive_csw(disk_device *device,
                                command_status_wrapper *status);
 status_t       usb_disk_operation(device_lun *lun, uint8 operation,
                                uint8 opLength, uint32 logicalBlockAddress,
-                               uint16 transferLength, void *data, uint32 
*dataLength,
+                               uint16 transferLength, void *data, size_t 
*dataLength,
                                bool directionIn);
 
 status_t       usb_disk_request_sense(device_lun *lun);
@@ -259,7 +259,7 @@ usb_disk_receive_csw(disk_device *device, 
command_status_wrapper *status)
 status_t
 usb_disk_operation(device_lun *lun, uint8 operation, uint8 opLength,
        uint32 logicalBlockAddress, uint16 transferLength, void *data,
-       uint32 *dataLength, bool directionIn)
+       size_t *dataLength, bool directionIn)
 {
        TRACE("operation: lun: %u; op: %u; oplen: %u; lba: %lu; tlen: %u; data: 
"
                "%p; dlen: %p (%lu); in: %c\n",
@@ -427,7 +427,7 @@ usb_disk_operation(device_lun *lun, uint8 operation, uint8 
opLength,
 status_t
 usb_disk_request_sense(device_lun *lun)
 {
-       uint32 dataLength = sizeof(scsi_request_sense_6_parameter);
+       size_t dataLength = sizeof(scsi_request_sense_6_parameter);
        scsi_request_sense_6_parameter parameter;
        status_t result = usb_disk_operation(lun, SCSI_REQUEST_SENSE_6, 6, 0,
                dataLength, &parameter, &dataLength, true);
@@ -463,7 +463,7 @@ usb_disk_request_sense(device_lun *lun)
                                TRACE_ALWAYS("request_sense: media changed\n");
                                lun->media_changed = true;
                                lun->media_present = true;
-                               
+
                                return B_DEV_MEDIA_CHANGED;
                        }
                        // fall through
@@ -492,7 +492,7 @@ usb_disk_request_sense(device_lun *lun)
 status_t
 usb_disk_mode_sense(device_lun *lun)
 {
-       uint32 dataLength = sizeof(scsi_mode_sense_6_parameter);
+       size_t dataLength = sizeof(scsi_mode_sense_6_parameter);
        scsi_mode_sense_6_parameter parameter;
        status_t result = usb_disk_operation(lun, SCSI_MODE_SENSE_6, 6,
                SCSI_MODE_PAGE_DEVICE_CONFIGURATION, dataLength, &parameter,
@@ -538,7 +538,7 @@ usb_disk_test_unit_ready(device_lun *lun)
 status_t
 usb_disk_inquiry(device_lun *lun)
 {
-       uint32 dataLength = sizeof(scsi_inquiry_6_parameter);
+       size_t dataLength = sizeof(scsi_inquiry_6_parameter);
        scsi_inquiry_6_parameter parameter;
        status_t result = B_ERROR;
        for (uint32 tries = 0; tries < 3; tries++) {
@@ -586,7 +586,7 @@ usb_disk_reset_capacity(device_lun *lun)
 status_t
 usb_disk_update_capacity(device_lun *lun)
 {
-       uint32 dataLength = sizeof(scsi_read_capacity_10_parameter);
+       size_t dataLength = sizeof(scsi_read_capacity_10_parameter);
        scsi_read_capacity_10_parameter parameter;
        status_t result = B_ERROR;
 
@@ -1126,7 +1126,7 @@ usb_disk_ioctl(void *cookie, uint32 op, void *buffer, 
size_t length)
 #endif
 
                default:
-                       TRACE_ALWAYS("unhandled ioctl %ld\n", op);
+                       TRACE_ALWAYS("unhandled ioctl %" B_PRId32 "\n", op);
                        break;
        }
 
@@ -1177,7 +1177,7 @@ usb_disk_read(void *cookie, off_t position, void *buffer, 
size_t *length)
        }
 
        *length = 0;
-       TRACE_ALWAYS("read fails with 0x%08lx\n", result);
+       TRACE_ALWAYS("read fails with 0x%08" B_PRIx32 "\n", result);
        return result;
 }
 
@@ -1228,7 +1228,7 @@ usb_disk_write(void *cookie, off_t position, const void 
*buffer,
        }
 
        *length = 0;
-       TRACE_ALWAYS("write fails with 0x%08lx\n", result);
+       TRACE_ALWAYS("write fails with 0x%08" B_PRIx32 "\n", result);
        return result;
 }
 
@@ -1270,7 +1270,7 @@ init_driver()
        status_t result = get_module(B_USB_MODULE_NAME,
                (module_info **)&gUSBModule);
        if (result < B_OK) {
-               TRACE_ALWAYS("getting module failed 0x%08lx\n", result);
+               TRACE_ALWAYS("getting module failed 0x%08" B_PRIx32 "\n", 
result);
                mutex_destroy(&gDeviceListLock);
                return result;
        }

############################################################################

Commit:      abfb41a2ab657d91903615a269c2fb80eba80f31

Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Aug  6 08:47:12 2012 UTC

Added USB modules to image.

----------------------------------------------------------------------------

diff --git a/build/jam/Haiku64Image b/build/jam/Haiku64Image
index a763014..924b6e3 100644
--- a/build/jam/Haiku64Image
+++ b/build/jam/Haiku64Image
@@ -55,7 +55,8 @@ SYSTEM_ADD_ONS_ACCELERANTS = vesa.accelerant ;
 
 SYSTEM_ADD_ONS_DRIVERS_GRAPHICS = vesa ;
 
-SYSTEM_ADD_ONS_BUS_MANAGERS =  $(ATA_ONLY)ata pci ps2 isa scsi config_manager ;
+SYSTEM_ADD_ONS_BUS_MANAGERS =  $(ATA_ONLY)ata pci ps2 isa scsi config_manager
+       usb ;
 SYSTEM_ADD_ONS_FILE_SYSTEMS = bfs iso9660 attribute_overlay write_overlay ;
 
 # modules
@@ -69,6 +70,8 @@ if $(HAIKU_ATA_STACK) = 1 {
 
 AddFilesToHaikuImage system add-ons kernel busses scsi
        : ahci ;
+AddFilesToHaikuImage system add-ons kernel busses usb
+       : <usb>ehci ;
 AddFilesToHaikuImage system add-ons kernel debugger
        : <kdebug>demangle ;
 AddFilesToHaikuImage system add-ons kernel file_systems
@@ -87,6 +90,7 @@ AddNewDriversToHaikuImage disk scsi   : scsi_cd scsi_disk ;
 AddDriversToHaikuImage                         : console dprintf null
                                                                          
random <driver>tty zero ;
 AddDriversToHaikuImage graphics                : 
$(SYSTEM_ADD_ONS_DRIVERS_GRAPHICS) ;
+AddDriversToHaikuImage disk usb                : usb_disk ;
 AddDriversToHaikuImage input           : ps2_hid ;
 
 # kernel
@@ -227,8 +231,10 @@ AddFilesToHaikuImage system : haiku_loader ;
 
 # boot module links
 AddBootModuleSymlinksToHaikuImage
-       $(ATA_ONLY)ata pci config_manager dpc scsi $(ATA_ONLY)ata_adapter
-       locked_pool scsi_periph ahci generic_ide_pci scsi_cd scsi_disk intel
+       $(ATA_ONLY)ata pci config_manager dpc scsi usb $(ATA_ONLY)ata_adapter
+       locked_pool scsi_periph ahci generic_ide_pci <usb>ehci
+       scsi_cd scsi_disk usb_disk
+       intel
        bfs
 ;
 

############################################################################

Commit:      44672ada83568d55e0bc5bdf60ad932161e13e2c

Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Sun Aug  5 02:53:45 2012 UTC
Committer:   Alex Smith <alex@xxxxxxxxxxxxxxxx>
Commit-Date: Mon Aug  6 08:54:18 2012 UTC

Add usb_hid to image and get it building/working.

----------------------------------------------------------------------------

diff --git a/build/jam/Haiku64Image b/build/jam/Haiku64Image
index 924b6e3..054da41 100644
--- a/build/jam/Haiku64Image
+++ b/build/jam/Haiku64Image
@@ -21,7 +21,7 @@ if $(HAIKU_ATA_STACK) = 1 {
 
 SYSTEM_BIN = "[" addattr base64 basename bash beep cal cat catattr chgrp chmod
        chown chroot cksum clear clockconfig cmp collectcatkeys comm compress
-       copyattr cp csplit cut date dd diff diff3 dircolors dirname du
+       copyattr cp csplit cut date dd diff diff3 dircolors dirname df du
        dumpcatalog echo eject env error expand expr factor false find finddir
        fmt fold fortune gawk gzip gzexe getlimits groups head hostname id
        <bin>install isvolume join kernel_debugger kill less lessecho lesskey 
link
@@ -91,7 +91,7 @@ AddDriversToHaikuImage                                : 
console dprintf null
                                                                          
random <driver>tty zero ;
 AddDriversToHaikuImage graphics                : 
$(SYSTEM_ADD_ONS_DRIVERS_GRAPHICS) ;
 AddDriversToHaikuImage disk usb                : usb_disk ;
-AddDriversToHaikuImage input           : ps2_hid ;
+AddDriversToHaikuImage input           : ps2_hid usb_hid ;
 
 # kernel
 AddFilesToHaikuImage system : kernel_$(TARGET_ARCH) ;
diff --git a/src/add-ons/kernel/drivers/input/usb_hid/Driver.cpp 
b/src/add-ons/kernel/drivers/input/usb_hid/Driver.cpp
index 657b7f5..51ca81f 100644
--- a/src/add-ons/kernel/drivers/input/usb_hid/Driver.cpp
+++ b/src/add-ons/kernel/drivers/input/usb_hid/Driver.cpp
@@ -62,7 +62,7 @@ usb_hid_device_added(usb_device device, void **cookie)
        // ensure default configuration is set
        status_t result = gUSBModule->set_configuration(device, config);
        if (result != B_OK) {
-               TRACE_ALWAYS("set_configuration() failed 0x%08lx\n", result);
+               TRACE_ALWAYS("set_configuration() failed 0x%08" B_PRIx32 "\n", 
result);
                return result;
        }
 
@@ -78,8 +78,8 @@ usb_hid_device_added(usb_device device, void **cookie)
        for (size_t i = 0; i < config->interface_count; i++) {
                const usb_interface_info *interface = 
config->interface[i].active;
                uint8 interfaceClass = interface->descr->interface_class;
-               TRACE("interface %lu: class: %u; subclass: %u; protocol: %u\n",
-                       i, interfaceClass, interface->descr->interface_subclass,
+               TRACE("interface %" B_PRIuSIZE ": class: %u; subclass: %u; 
protocol: "
+                       "%u\n", i, interfaceClass, 
interface->descr->interface_subclass,
                        interface->descr->interface_protocol);
 
                // check for quirky devices first
@@ -128,7 +128,7 @@ usb_hid_device_added(usb_device device, void **cookie)
                                        char pathBuffer[128];
                                        const char *basePath = 
handler->BasePath();
                                        while (true) {
-                                               sprintf(pathBuffer, "%s%ld", 
basePath, index++);
+                                               sprintf(pathBuffer, "%s%" 
B_PRId32, basePath, index++);
                                                if 
(gDeviceList->FindDevice(pathBuffer) == NULL) {
                                                        // this name is still 
free, use it
                                                        
handler->SetPublishPath(strdup(pathBuffer));
@@ -149,7 +149,7 @@ usb_hid_device_added(usb_device device, void **cookie)
        if (!devicesFound)
                return B_ERROR;
 
-       *cookie = (void *)parentCookie;
+       *cookie = (void *)(addr_t)parentCookie;
        return B_OK;
 }
 
@@ -158,8 +158,8 @@ status_t
 usb_hid_device_removed(void *cookie)
 {
        mutex_lock(&sDriverLock);
-       int32 parentCookie = (int32)cookie;
-       TRACE("device_removed(%ld)\n", parentCookie);
+       int32 parentCookie = (int32)(addr_t)cookie;
+       TRACE("device_removed(%" B_PRId32 ")\n", parentCookie);
 
        for (int32 i = 0; i < gDeviceList->CountDevices(); i++) {
                ProtocolHandler *handler = (ProtocolHandler 
*)gDeviceList->DeviceAt(i);


Other related posts:

  • » [haiku-commits] BRANCH xyzzy-github.x86_64 - src/add-ons/kernel/bus_managers/usb src/add-ons/kernel/busses/usb src/add-ons/kernel/drivers/disk/usb/usb_disk src/add-ons/kernel/drivers/input/usb_hid build/jam - xyzzy-github . x86_64