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
|
b
|
Device::Device(Object *parent, int8 hubAddress, uint8 hubPort,
|
81 | 81 | &actualLength); |
82 | 82 | |
83 | 83 | if (status < B_OK || actualLength != sizeof(usb_configuration_descriptor)) { |
84 | | TRACE_ERROR("error fetching configuration %ld\n", i); |
| 84 | TRACE_ERROR("error fetching configuration %" B_PRId32 "\n", i); |
85 | 85 | return; |
86 | 86 | } |
87 | 87 | |
88 | | TRACE("configuration %ld\n", i); |
| 88 | TRACE("configuration %" B_PRId32 "\n", i); |
89 | 89 | TRACE("\tlength:..............%d\n", configDescriptor.length); |
90 | 90 | TRACE("\tdescriptor_type:.....0x%02x\n", configDescriptor.descriptor_type); |
91 | 91 | TRACE("\ttotal_length:........%d\n", configDescriptor.total_length); |
… |
… |
Device::Device(Object *parent, int8 hubAddress, uint8 hubPort,
|
106 | 106 | |
107 | 107 | if (status < B_OK || actualLength != configDescriptor.total_length) { |
108 | 108 | TRACE_ERROR("error fetching full configuration" |
109 | | " descriptor %ld got %lu expected %u\n", i, |
110 | | actualLength, configDescriptor.total_length); |
| 109 | " descriptor %" B_PRId32 " got %" B_PRIuSIZE " expected %" |
| 110 | B_PRIu16 "\n", i, actualLength, configDescriptor.total_length); |
111 | 111 | free(configData); |
112 | 112 | return; |
113 | 113 | } |
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
|
b
|
Hub::Hub(Object *parent, int8 hubAddress, uint8 hubPort,
|
87 | 87 | USB_REQUEST_SET_FEATURE, PORT_POWER, i + 1, 0, NULL, 0, NULL); |
88 | 88 | |
89 | 89 | if (status < B_OK) |
90 | | TRACE_ERROR("power up failed on port %ld\n", i); |
| 90 | TRACE_ERROR("power up failed on port %" B_PRId32 "\n", i); |
91 | 91 | } |
92 | 92 | |
93 | 93 | // Wait for power to stabilize |
… |
… |
Hub::Explore(change_item **changeList)
|
201 | 201 | |
202 | 202 | #ifdef TRACE_USB |
203 | 203 | if (fPortStatus[i].change) { |
204 | | TRACE("port %ld: status: 0x%04x; change: 0x%04x\n", i, |
| 204 | TRACE("port %" B_PRId32 ": status: 0x%04x; change: 0x%04x\n", i, |
205 | 205 | fPortStatus[i].status, fPortStatus[i].change); |
206 | | TRACE("device at port %ld: %p (%ld)\n", i, fChildren[i], |
207 | | fChildren[i] != NULL ? fChildren[i]->USBID() : 0); |
| 206 | TRACE("device at port %" B_PRId32 ": %p (%" B_PRId32 ")\n", i, |
| 207 | fChildren[i], fChildren[i] != NULL |
| 208 | ? fChildren[i]->USBID() : 0); |
208 | 209 | } |
209 | 210 | #endif |
210 | 211 | |
… |
… |
Hub::Explore(change_item **changeList)
|
216 | 217 | |
217 | 218 | if (fPortStatus[i].status & PORT_STATUS_CONNECTION) { |
218 | 219 | // new device attached! |
219 | | TRACE_ALWAYS("port %ld: new device connected\n", i); |
| 220 | TRACE_ALWAYS("port %" B_PRId32 ": new device connected\n", i); |
220 | 221 | |
221 | 222 | int32 retry = 2; |
222 | 223 | while (retry--) { |
… |
… |
Hub::Explore(change_item **changeList)
|
226 | 227 | // reset the port, this will also enable it |
227 | 228 | result = ResetPort(i); |
228 | 229 | if (result < B_OK) { |
229 | | TRACE_ERROR("resetting port %ld failed\n", i); |
| 230 | TRACE_ERROR("resetting port %" B_PRId32 " failed\n", |
| 231 | i); |
230 | 232 | break; |
231 | 233 | } |
232 | 234 | |
… |
… |
Hub::Explore(change_item **changeList)
|
282 | 284 | } |
283 | 285 | } else { |
284 | 286 | // Device removed... |
285 | | TRACE_ALWAYS("port %ld: device removed\n", i); |
| 287 | TRACE_ALWAYS("port %" B_PRId32 ": device removed\n", i); |
286 | 288 | if (fChildren[i] != NULL) { |
287 | 289 | TRACE("removing device %p\n", fChildren[i]); |
288 | 290 | fChildren[i]->Changed(changeList, false); |
… |
… |
Hub::Explore(change_item **changeList)
|
293 | 295 | |
294 | 296 | // other port changes we do not really handle, report and clear them |
295 | 297 | if (fPortStatus[i].change & PORT_STATUS_ENABLE) { |
296 | | TRACE_ALWAYS("port %ld %sabled\n", i, (fPortStatus[i].status & PORT_STATUS_ENABLE) ? "en" : "dis"); |
| 298 | TRACE_ALWAYS("port %" B_PRId32 " %sabled\n", i, |
| 299 | (fPortStatus[i].status & PORT_STATUS_ENABLE) ? "en" : "dis"); |
297 | 300 | DefaultPipe()->SendRequest(USB_REQTYPE_CLASS | USB_REQTYPE_OTHER_OUT, |
298 | 301 | USB_REQUEST_CLEAR_FEATURE, C_PORT_ENABLE, i + 1, |
299 | 302 | 0, NULL, 0, NULL); |
300 | 303 | } |
301 | 304 | |
302 | 305 | if (fPortStatus[i].change & PORT_STATUS_SUSPEND) { |
303 | | TRACE_ALWAYS("port %ld is %ssuspended\n", i, (fPortStatus[i].status & PORT_STATUS_SUSPEND) ? "" : "not "); |
| 306 | TRACE_ALWAYS("port %" B_PRId32 " is %ssuspended\n", i, |
| 307 | (fPortStatus[i].status & PORT_STATUS_SUSPEND) ? "" : "not "); |
304 | 308 | DefaultPipe()->SendRequest(USB_REQTYPE_CLASS | USB_REQTYPE_OTHER_OUT, |
305 | 309 | USB_REQUEST_CLEAR_FEATURE, C_PORT_SUSPEND, i + 1, |
306 | 310 | 0, NULL, 0, NULL); |
307 | 311 | } |
308 | 312 | |
309 | 313 | if (fPortStatus[i].change & PORT_STATUS_OVER_CURRENT) { |
310 | | TRACE_ALWAYS("port %ld is %sin an over current state\n", i, (fPortStatus[i].status & PORT_STATUS_OVER_CURRENT) ? "" : "not "); |
| 314 | TRACE_ALWAYS("port %" B_PRId32 " is %sin an over current state\n", |
| 315 | i, (fPortStatus[i].status & PORT_STATUS_OVER_CURRENT) ? "" : "not "); |
311 | 316 | DefaultPipe()->SendRequest(USB_REQTYPE_CLASS | USB_REQTYPE_OTHER_OUT, |
312 | 317 | USB_REQUEST_CLEAR_FEATURE, C_PORT_OVER_CURRENT, i + 1, |
313 | 318 | 0, NULL, 0, NULL); |
314 | 319 | } |
315 | 320 | |
316 | 321 | if (fPortStatus[i].change & PORT_STATUS_RESET) { |
317 | | TRACE_ALWAYS("port %ld was reset\n", i); |
| 322 | TRACE_ALWAYS("port %" B_PRId32 "was reset\n", i); |
318 | 323 | DefaultPipe()->SendRequest(USB_REQTYPE_CLASS | USB_REQTYPE_OTHER_OUT, |
319 | 324 | USB_REQUEST_CLEAR_FEATURE, C_PORT_RESET, i + 1, |
320 | 325 | 0, NULL, 0, NULL); |
… |
… |
Hub::BuildDeviceName(char *string, uint32 *index, size_t bufferSize,
|
400 | 405 | if (*index < bufferSize) { |
401 | 406 | int32 managerIndex = GetStack()->IndexOfBusManager(GetBusManager()); |
402 | 407 | size_t totalBytes = snprintf(string + *index, bufferSize - *index, |
403 | | "%ld", managerIndex); |
| 408 | "%" B_PRId32, managerIndex); |
404 | 409 | *index += std::min(totalBytes, bufferSize - *index - 1); |
405 | 410 | } |
406 | 411 | } |
… |
… |
Hub::BuildDeviceName(char *string, uint32 *index, size_t bufferSize,
|
418 | 423 | if (fChildren[i] == device) { |
419 | 424 | if (*index < bufferSize) { |
420 | 425 | size_t totalBytes = snprintf(string + *index, |
421 | | bufferSize - *index, "/%ld", i); |
| 426 | bufferSize - *index, "/%" B_PRId32, i); |
422 | 427 | *index += std::min(totalBytes, bufferSize - *index - 1); |
423 | 428 | } |
424 | 429 | break; |
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
|
b
|
PhysicalMemoryAllocator::PhysicalMemoryAllocator(const char *name,
|
77 | 77 | |
78 | 78 | fArea = create_area(fName, &fLogicalBase, B_ANY_KERNEL_ADDRESS, |
79 | 79 | roundedSize, B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA); |
80 | | // TODO: Use B_CONTIGUOUS when the TODOs regarding 64 bit physical |
81 | | // addresses are fixed (if possible). |
82 | 80 | if (fArea < B_OK) { |
83 | 81 | TRACE_ERROR(("PMA: failed to create memory area\n")); |
84 | 82 | return; |
… |
… |
PhysicalMemoryAllocator::_Unlock()
|
131 | 129 | |
132 | 130 | status_t |
133 | 131 | PhysicalMemoryAllocator::Allocate(size_t size, void **logicalAddress, |
134 | | void **physicalAddress) |
| 132 | phys_addr_t *physicalAddress) |
135 | 133 | { |
136 | | // TODO: physicalAddress should be a phys_addr_t*! |
137 | 134 | #ifdef HAIKU_TARGET_PLATFORM_HAIKU |
138 | 135 | if (debug_debugger_running()) { |
139 | 136 | for (int32 i = 0; i < 64; i++) { |
… |
… |
PhysicalMemoryAllocator::Allocate(size_t size, void **logicalAddress,
|
142 | 139 | fDebugUseMap |= mask; |
143 | 140 | *logicalAddress = (void *)((uint8 *)fLogicalBase + fDebugBase |
144 | 141 | + i * fDebugChunkSize); |
145 | | *physicalAddress = (void *)(fPhysicalBase + fDebugBase |
| 142 | *physicalAddress = (phys_addr_t)(fPhysicalBase + fDebugBase |
146 | 143 | + i * fDebugChunkSize); |
147 | 144 | return B_OK; |
148 | 145 | } |
… |
… |
PhysicalMemoryAllocator::Allocate(size_t size, void **logicalAddress,
|
204 | 201 | _Unlock(); |
205 | 202 | size_t offset = fBlockSize[arrayToUse] * i; |
206 | 203 | *logicalAddress = (void *)((uint8 *)fLogicalBase + offset); |
207 | | *physicalAddress = (void *)(fPhysicalBase + offset); |
| 204 | *physicalAddress = (phys_addr_t)(fPhysicalBase + offset); |
208 | 205 | return B_OK; |
209 | 206 | } |
210 | 207 | } |
… |
… |
PhysicalMemoryAllocator::Allocate(size_t size, void **logicalAddress,
|
234 | 231 | |
235 | 232 | status_t |
236 | 233 | PhysicalMemoryAllocator::Deallocate(size_t size, void *logicalAddress, |
237 | | void *physicalAddress) |
| 234 | phys_addr_t physicalAddress) |
238 | 235 | { |
239 | | // TODO: physicalAddress should be a phys_addr_t! |
240 | 236 | #ifdef HAIKU_TARGET_PLATFORM_HAIKU |
241 | 237 | if (debug_debugger_running()) { |
242 | 238 | uint32 index = ((uint8 *)logicalAddress - (uint8 *)fLogicalBase |
… |
… |
PhysicalMemoryAllocator::Deallocate(size_t size, void *logicalAddress,
|
259 | 255 | } |
260 | 256 | } |
261 | 257 | |
262 | | uint32 offset; |
| 258 | phys_addr_t offset; |
263 | 259 | if (logicalAddress) |
264 | | offset = (uint32)logicalAddress - (uint32)fLogicalBase; |
| 260 | offset = (addr_t)logicalAddress - (addr_t)fLogicalBase; |
265 | 261 | else if (physicalAddress) |
266 | 262 | offset = (addr_t)physicalAddress - fPhysicalBase; |
267 | 263 | else { |
… |
… |
PhysicalMemoryAllocator::PrintToStream()
|
318 | 314 | dprintf("\tMin block size:\t\t\t%ld bytes\n", fBlockSize[0]); |
319 | 315 | dprintf("\tMax block size:\t\t\t%ld bytes\n", fBlockSize[fArrayCount - 1]); |
320 | 316 | dprintf("\tMin count per block:\t%ld\n\n", fArrayLength[fArrayCount - 1]); |
321 | | dprintf("\tArray count:\t\t\t%ld\n", fArrayCount); |
| 317 | dprintf("\tArray count:\t\t\t%" B_PRId32 "\n", fArrayCount); |
322 | 318 | |
323 | 319 | dprintf("\tArray slots:\t\t\t% 8ld", fArrayLength[0]); |
324 | 320 | for (int32 i = 1; i < fArrayCount; i++) |
… |
… |
PhysicalMemoryAllocator::DumpArrays()
|
344 | 340 | { |
345 | 341 | uint32 padding = 2; |
346 | 342 | for (int32 i = 0; i < fArrayCount; i++) { |
347 | | dprintf("\tArray(%ld):\t", i); |
| 343 | dprintf("\tArray(%" B_PRId32 "):\t", i); |
348 | 344 | for (size_t j = 0; j < fArrayLength[i]; j++) { |
349 | 345 | if (padding > 2) { |
350 | 346 | for (uint32 k = 0; k < (padding - 2) / 4; k++) |
… |
… |
PhysicalMemoryAllocator::DumpFreeSlots()
|
393 | 389 | } |
394 | 390 | |
395 | 391 | if (i > 0) |
396 | | dprintf(", % 8ld", freeSlots); |
| 392 | dprintf(", %8" B_PRIu32, freeSlots); |
397 | 393 | else |
398 | | dprintf("% 8ld", freeSlots); |
| 394 | dprintf("%8" B_PRIu32, freeSlots); |
399 | 395 | } |
400 | 396 | dprintf("\n"); |
401 | 397 | } |
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
|
b
|
public:
|
26 | 26 | |
27 | 27 | status_t Allocate(size_t size, |
28 | 28 | void **logicalAddress, |
29 | | void **physicalAddress); |
| 29 | phys_addr_t *physicalAddress); |
30 | 30 | |
31 | 31 | // one of both addresses needs to be provided, the other may be NULL |
32 | 32 | status_t Deallocate(size_t size, |
33 | 33 | void *logicalAddress, |
34 | | void *physicalAddress); |
| 34 | phys_addr_t physicalAddress); |
35 | 35 | |
36 | 36 | void PrintToStream(); |
37 | 37 | 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
|
b
|
Stack::BusManagerAt(int32 index) const
|
278 | 278 | |
279 | 279 | |
280 | 280 | status_t |
281 | | Stack::AllocateChunk(void **logicalAddress, void **physicalAddress, size_t size) |
| 281 | Stack::AllocateChunk(void **logicalAddress, phys_addr_t *physicalAddress, |
| 282 | size_t size) |
282 | 283 | { |
283 | 284 | return fAllocator->Allocate(size, logicalAddress, physicalAddress); |
284 | 285 | } |
285 | 286 | |
286 | 287 | |
287 | 288 | status_t |
288 | | Stack::FreeChunk(void *logicalAddress, void *physicalAddress, size_t size) |
| 289 | Stack::FreeChunk(void *logicalAddress, phys_addr_t physicalAddress, |
| 290 | size_t size) |
289 | 291 | { |
290 | 292 | return fAllocator->Deallocate(size, logicalAddress, physicalAddress); |
291 | 293 | } |
292 | 294 | |
293 | 295 | |
294 | 296 | area_id |
295 | | Stack::AllocateArea(void **logicalAddress, void **physicalAddress, size_t size, |
| 297 | Stack::AllocateArea(void **logicalAddress, phys_addr_t *physicalAddress, size_t size, |
296 | 298 | const char *name) |
297 | 299 | { |
298 | | // TODO: physicalAddress should be a phys_addr_t*! |
299 | 300 | TRACE("allocating %ld bytes for %s\n", size, name); |
300 | 301 | |
301 | 302 | void *logAddress; |
… |
… |
Stack::AllocateArea(void **logicalAddress, void **physicalAddress, size_t size,
|
323 | 324 | *logicalAddress = logAddress; |
324 | 325 | |
325 | 326 | if (physicalAddress) |
326 | | *physicalAddress = (void*)(addr_t)physicalEntry.address; |
| 327 | *physicalAddress = (phys_addr_t)physicalEntry.address; |
327 | 328 | |
328 | | TRACE("area = %ld, size = %ld, log = %p, phy = %#" B_PRIxPHYSADDR "\n", |
329 | | area, size, logAddress, physicalEntry.address); |
| 329 | TRACE("area = %" B_PRId32 ", size = %" B_PRIuSIZE ", log = %p, phy = %#" |
| 330 | B_PRIxPHYSADDR "\n", area, size, logAddress, physicalEntry.address); |
330 | 331 | return area; |
331 | 332 | } |
332 | 333 | |
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
|
b
|
uninstall_notify(const char *driverName)
|
145 | 145 | const usb_device_descriptor * |
146 | 146 | get_device_descriptor(usb_device device) |
147 | 147 | { |
148 | | TRACE_MODULE("get_device_descriptor(%ld)\n", device); |
| 148 | TRACE_MODULE("get_device_descriptor(%" B_PRId32 ")\n", device); |
149 | 149 | Object *object = gUSBStack->GetObject(device); |
150 | 150 | if (!object || (object->Type() & USB_OBJECT_DEVICE) == 0) |
151 | 151 | return NULL; |
… |
… |
get_device_descriptor(usb_device device)
|
157 | 157 | const usb_configuration_info * |
158 | 158 | get_nth_configuration(usb_device device, uint32 index) |
159 | 159 | { |
160 | | TRACE_MODULE("get_nth_configuration(%ld, %lu)\n", device, index); |
| 160 | TRACE_MODULE("get_nth_configuration(%" B_PRId32 ", %" B_PRIu32 ")\n", |
| 161 | device, index); |
161 | 162 | Object *object = gUSBStack->GetObject(device); |
162 | 163 | if (!object || (object->Type() & USB_OBJECT_DEVICE) == 0) |
163 | 164 | return NULL; |
… |
… |
get_nth_configuration(usb_device device, uint32 index)
|
169 | 170 | const usb_configuration_info * |
170 | 171 | get_configuration(usb_device device) |
171 | 172 | { |
172 | | TRACE_MODULE("get_configuration(%ld)\n", device); |
| 173 | TRACE_MODULE("get_configuration(%" B_PRId32 ")\n", device); |
173 | 174 | Object *object = gUSBStack->GetObject(device); |
174 | 175 | if (!object || (object->Type() & USB_OBJECT_DEVICE) == 0) |
175 | 176 | return NULL; |
… |
… |
status_t
|
182 | 183 | set_configuration(usb_device device, |
183 | 184 | const usb_configuration_info *configuration) |
184 | 185 | { |
185 | | TRACE_MODULE("set_configuration(%ld, %p)\n", device, configuration); |
| 186 | TRACE_MODULE("set_configuration(%" B_PRId32 ", %p)\n", device, |
| 187 | configuration); |
186 | 188 | Object *object = gUSBStack->GetObject(device); |
187 | 189 | if (!object || (object->Type() & USB_OBJECT_DEVICE) == 0) |
188 | 190 | return B_DEV_INVALID_PIPE; |
… |
… |
set_configuration(usb_device device,
|
194 | 196 | status_t |
195 | 197 | set_alt_interface(usb_device device, const usb_interface_info *interface) |
196 | 198 | { |
197 | | TRACE_MODULE("set_alt_interface(%ld, %p)\n", device, interface); |
| 199 | TRACE_MODULE("set_alt_interface(%" B_PRId32 ", %p)\n", device, interface); |
198 | 200 | Object *object = gUSBStack->GetObject(device); |
199 | 201 | if (!object || (object->Type() & USB_OBJECT_DEVICE) == 0) |
200 | 202 | return B_DEV_INVALID_PIPE; |
… |
… |
set_alt_interface(usb_device device, const usb_interface_info *interface)
|
206 | 208 | status_t |
207 | 209 | set_feature(usb_id handle, uint16 selector) |
208 | 210 | { |
209 | | TRACE_MODULE("set_feature(%ld, %d)\n", handle, selector); |
| 211 | TRACE_MODULE("set_feature(%" B_PRId32 ", %d)\n", handle, selector); |
210 | 212 | Object *object = gUSBStack->GetObject(handle); |
211 | 213 | if (!object) |
212 | 214 | return B_DEV_INVALID_PIPE; |
… |
… |
set_feature(usb_id handle, uint16 selector)
|
218 | 220 | status_t |
219 | 221 | clear_feature(usb_id handle, uint16 selector) |
220 | 222 | { |
221 | | TRACE_MODULE("clear_feature(%ld, %d)\n", handle, selector); |
| 223 | TRACE_MODULE("clear_feature(%" B_PRId32 ", %d)\n", handle, selector); |
222 | 224 | Object *object = gUSBStack->GetObject(handle); |
223 | 225 | if (!object) |
224 | 226 | return B_DEV_INVALID_PIPE; |
… |
… |
clear_feature(usb_id handle, uint16 selector)
|
230 | 232 | status_t |
231 | 233 | get_status(usb_id handle, uint16 *status) |
232 | 234 | { |
233 | | TRACE_MODULE("get_status(%ld, %p)\n", handle, status); |
| 235 | TRACE_MODULE("get_status(%" B_PRId32 ", %p)\n", handle, status); |
234 | 236 | if (!status) |
235 | 237 | return B_BAD_VALUE; |
236 | 238 | |
… |
… |
status_t
|
246 | 248 | get_descriptor(usb_device device, uint8 type, uint8 index, uint16 languageID, |
247 | 249 | void *data, size_t dataLength, size_t *actualLength) |
248 | 250 | { |
249 | | TRACE_MODULE("get_descriptor(%ld, 0x%02x, 0x%02x, 0x%04x, %p, %ld, %p)\n", |
| 251 | TRACE_MODULE("get_descriptor(%" B_PRId32 ", 0x%02x, 0x%02x, 0x%04x, %p, " |
| 252 | "%" B_PRIuSIZE ", %p)\n", |
250 | 253 | device, type, index, languageID, data, dataLength, actualLength); |
251 | 254 | Object *object = gUSBStack->GetObject(device); |
252 | 255 | if (!object || (object->Type() & USB_OBJECT_DEVICE) == 0) |
… |
… |
status_t
|
261 | 264 | send_request(usb_device device, uint8 requestType, uint8 request, |
262 | 265 | uint16 value, uint16 index, uint16 length, void *data, size_t *actualLength) |
263 | 266 | { |
264 | | TRACE_MODULE("send_request(%ld, 0x%02x, 0x%02x, 0x%04x, 0x%04x, %d, %p, %p)\n", |
265 | | device, requestType, request, value, index, length, data, actualLength); |
| 267 | TRACE_MODULE("send_request(%" B_PRId32 ", 0x%02x, 0x%02x, 0x%04x, 0x%04x, " |
| 268 | "%d, %p, %p)\n", device, requestType, request, value, index, length, |
| 269 | data, actualLength); |
266 | 270 | Object *object = gUSBStack->GetObject(device); |
267 | 271 | if (!object || (object->Type() & USB_OBJECT_DEVICE) == 0) |
268 | 272 | return B_DEV_INVALID_PIPE; |
… |
… |
queue_request(usb_device device, uint8 requestType, uint8 request,
|
277 | 281 | uint16 value, uint16 index, uint16 length, void *data, |
278 | 282 | usb_callback_func callback, void *callbackCookie) |
279 | 283 | { |
280 | | TRACE_MODULE("queue_request(%ld, 0x%02x, 0x%02x, 0x%04x, 0x%04x, %u, %p, %p, %p)\n", |
281 | | device, requestType, request, value, index, length, data, callback, |
282 | | callbackCookie); |
| 284 | TRACE_MODULE("queue_request(%" B_PRId32 ", 0x%02x, 0x%02x, 0x%04x, 0x%04x," |
| 285 | " %u, %p, %p, %p)\n", device, requestType, request, value, index, |
| 286 | length, data, callback, callbackCookie); |
283 | 287 | Object *object = gUSBStack->GetObject(device); |
284 | 288 | if (!object || (object->Type() & USB_OBJECT_DEVICE) == 0) |
285 | 289 | return B_DEV_INVALID_PIPE; |
… |
… |
status_t
|
293 | 297 | queue_interrupt(usb_pipe pipe, void *data, size_t dataLength, |
294 | 298 | usb_callback_func callback, void *callbackCookie) |
295 | 299 | { |
296 | | TRACE_MODULE("queue_interrupt(%ld, %p, %ld, %p, %p)\n", |
| 300 | TRACE_MODULE("queue_interrupt(%" B_PRId32 ", %p, %ld, %p, %p)\n", |
297 | 301 | pipe, data, dataLength, callback, callbackCookie); |
298 | 302 | Object *object = gUSBStack->GetObject(pipe); |
299 | 303 | if (!object || (object->Type() & USB_OBJECT_INTERRUPT_PIPE) == 0) |
… |
… |
status_t
|
308 | 312 | queue_bulk(usb_pipe pipe, void *data, size_t dataLength, |
309 | 313 | usb_callback_func callback, void *callbackCookie) |
310 | 314 | { |
311 | | TRACE_MODULE("queue_bulk(%ld, %p, %ld, %p, %p)\n", |
| 315 | TRACE_MODULE("queue_bulk(%"B_PRId32 ", %p, %" B_PRIuSIZE ", %p, %p)\n", |
312 | 316 | pipe, data, dataLength, callback, callbackCookie); |
313 | 317 | Object *object = gUSBStack->GetObject(pipe); |
314 | 318 | if (!object || (object->Type() & USB_OBJECT_BULK_PIPE) == 0) |
… |
… |
status_t
|
323 | 327 | queue_bulk_v(usb_pipe pipe, iovec *vector, size_t vectorCount, |
324 | 328 | usb_callback_func callback, void *callbackCookie) |
325 | 329 | { |
326 | | TRACE_MODULE("queue_bulk_v(%ld, %p, %ld, %p, %p)\n", |
| 330 | TRACE_MODULE("queue_bulk_v(%" B_PRId32 ", %p, %" B_PRIuSIZE " %p, %p)\n", |
327 | 331 | pipe, vector, vectorCount, callback, callbackCookie); |
328 | 332 | Object *object = gUSBStack->GetObject(pipe); |
329 | 333 | if (!object || (object->Type() & USB_OBJECT_BULK_PIPE) == 0) |
… |
… |
status_t
|
338 | 342 | queue_bulk_v_physical(usb_pipe pipe, iovec *vector, size_t vectorCount, |
339 | 343 | usb_callback_func callback, void *callbackCookie) |
340 | 344 | { |
341 | | TRACE_MODULE("queue_bulk_v_physical(%ld, %p, %ld, %p, %p)\n", |
342 | | pipe, vector, vectorCount, callback, callbackCookie); |
| 345 | TRACE_MODULE("queue_bulk_v_physical(%" B_PRId32 ", %p, %" B_PRIuSIZE |
| 346 | ", %p, %p)\n", pipe, vector, vectorCount, callback, callbackCookie); |
343 | 347 | Object *object = gUSBStack->GetObject(pipe); |
344 | 348 | if (!object || (object->Type() & USB_OBJECT_BULK_PIPE) == 0) |
345 | 349 | return B_DEV_INVALID_PIPE; |
… |
… |
queue_isochronous(usb_pipe pipe, void *data, size_t dataLength,
|
355 | 359 | uint32 *startingFrameNumber, uint32 flags, usb_callback_func callback, |
356 | 360 | void *callbackCookie) |
357 | 361 | { |
358 | | TRACE_MODULE("queue_isochronous(%ld, %p, %ld, %p, %ld, %p, 0x%08lx, %p, %p)\n", |
| 362 | TRACE_MODULE("queue_isochronous(%" B_PRId32 ", %p, %" B_PRIuSIZE ", %p, " |
| 363 | "%" B_PRId32 ", %p, 0x%08" B_PRIx32 ", %p, %p)\n", |
359 | 364 | pipe, data, dataLength, packetDesc, packetCount, startingFrameNumber, |
360 | 365 | flags, callback, callbackCookie); |
361 | 366 | Object *object = gUSBStack->GetObject(pipe); |
… |
… |
status_t
|
372 | 377 | set_pipe_policy(usb_pipe pipe, uint8 maxQueuedPackets, |
373 | 378 | uint16 maxBufferDurationMS, uint16 sampleSize) |
374 | 379 | { |
375 | | TRACE_MODULE("set_pipe_policy(%ld, %d, %d, %d)\n", pipe, maxQueuedPackets, |
376 | | maxBufferDurationMS, sampleSize); |
| 380 | TRACE_MODULE("set_pipe_policy(%" B_PRId32 ", %d, %d, %d)\n", pipe, |
| 381 | maxQueuedPackets, maxBufferDurationMS, sampleSize); |
377 | 382 | Object *object = gUSBStack->GetObject(pipe); |
378 | 383 | if (!object || (object->Type() & USB_OBJECT_ISO_PIPE) == 0) |
379 | 384 | return B_DEV_INVALID_PIPE; |
… |
… |
set_pipe_policy(usb_pipe pipe, uint8 maxQueuedPackets,
|
386 | 391 | status_t |
387 | 392 | cancel_queued_transfers(usb_pipe pipe) |
388 | 393 | { |
389 | | TRACE_MODULE("cancel_queued_transfers(%ld)\n", pipe); |
| 394 | TRACE_MODULE("cancel_queued_transfers(%" B_PRId32 ")\n", pipe); |
390 | 395 | Object *object = gUSBStack->GetObject(pipe); |
391 | 396 | if (!object || (object->Type() & USB_OBJECT_PIPE) == 0) |
392 | 397 | return B_DEV_INVALID_PIPE; |
… |
… |
cancel_queued_transfers(usb_pipe pipe)
|
398 | 403 | status_t |
399 | 404 | usb_ioctl(uint32 opcode, void *buffer, size_t bufferSize) |
400 | 405 | { |
401 | | TRACE_MODULE("usb_ioctl(%lu, %p, %ld)\n", opcode, buffer, bufferSize); |
| 406 | TRACE_MODULE("usb_ioctl(%" B_PRIu32 ", %p, %" B_PRIuSIZE ")\n", opcode, |
| 407 | buffer, bufferSize); |
402 | 408 | |
403 | 409 | switch (opcode) { |
404 | 410 | case 'DNAM': { |
… |
… |
struct usb_module_info gModuleInfoV3 = {
|
564 | 570 | const usb_device_descriptor * |
565 | 571 | get_device_descriptor_v2(const void *device) |
566 | 572 | { |
567 | | return get_device_descriptor((usb_id)device); |
| 573 | return get_device_descriptor((usb_id)(ssize_t)device); |
568 | 574 | } |
569 | 575 | |
570 | 576 | |
571 | 577 | const usb_configuration_info * |
572 | 578 | get_nth_configuration_v2(const void *device, uint index) |
573 | 579 | { |
574 | | return get_nth_configuration((usb_id)device, index); |
| 580 | return get_nth_configuration((usb_id)(ssize_t)device, index); |
575 | 581 | } |
576 | 582 | |
577 | 583 | |
578 | 584 | const usb_configuration_info * |
579 | 585 | get_configuration_v2(const void *device) |
580 | 586 | { |
581 | | return get_configuration((usb_id)device); |
| 587 | return get_configuration((usb_id)(ssize_t)device); |
582 | 588 | } |
583 | 589 | |
584 | 590 | |
… |
… |
status_t
|
586 | 592 | set_configuration_v2(const void *device, |
587 | 593 | const usb_configuration_info *configuration) |
588 | 594 | { |
589 | | return set_configuration((usb_id)device, configuration); |
| 595 | return set_configuration((usb_id)(ssize_t)device, configuration); |
590 | 596 | } |
591 | 597 | |
592 | 598 | |
593 | 599 | status_t |
594 | 600 | set_alt_interface_v2(const void *device, const usb_interface_info *interface) |
595 | 601 | { |
596 | | return set_alt_interface((usb_id)device, interface); |
| 602 | return set_alt_interface((usb_id)(ssize_t)device, interface); |
597 | 603 | } |
598 | 604 | |
599 | 605 | |
600 | 606 | status_t |
601 | 607 | set_feature_v2(const void *object, uint16 selector) |
602 | 608 | { |
603 | | return set_feature((usb_id)object, selector); |
| 609 | return set_feature((usb_id)(ssize_t)object, selector); |
604 | 610 | } |
605 | 611 | |
606 | 612 | |
607 | 613 | status_t |
608 | 614 | clear_feature_v2(const void *object, uint16 selector) |
609 | 615 | { |
610 | | return clear_feature((usb_id)object, selector); |
| 616 | return clear_feature((usb_id)(ssize_t)object, selector); |
611 | 617 | } |
612 | 618 | |
613 | 619 | |
614 | 620 | status_t |
615 | 621 | get_status_v2(const void *object, uint16 *status) |
616 | 622 | { |
617 | | return get_status((usb_id)object, status); |
| 623 | return get_status((usb_id)(ssize_t)object, status); |
618 | 624 | } |
619 | 625 | |
620 | 626 | |
… |
… |
status_t
|
622 | 628 | get_descriptor_v2(const void *device, uint8 type, uint8 index, |
623 | 629 | uint16 languageID, void *data, size_t dataLength, size_t *actualLength) |
624 | 630 | { |
625 | | return get_descriptor((usb_id)device, type, index, languageID, data, |
| 631 | return get_descriptor((usb_id)(ssize_t)device, type, index, languageID, data, |
626 | 632 | dataLength, actualLength); |
627 | 633 | } |
628 | 634 | |
… |
… |
send_request_v2(const void *device, uint8 requestType, uint8 request,
|
632 | 638 | uint16 value, uint16 index, uint16 length, void *data, |
633 | 639 | size_t /*dataLength*/, size_t *actualLength) |
634 | 640 | { |
635 | | return send_request((usb_id)device, requestType, request, value, index, |
| 641 | return send_request((usb_id)(ssize_t)device, requestType, request, value, index, |
636 | 642 | length, data, actualLength); |
637 | 643 | } |
638 | 644 | |
… |
… |
queue_request_v2(const void *device, uint8 requestType, uint8 request,
|
642 | 648 | uint16 value, uint16 index, uint16 length, void *data, |
643 | 649 | size_t /*dataLength*/, usb_callback_func callback, void *callbackCookie) |
644 | 650 | { |
645 | | return queue_request((usb_id)device, requestType, request, value, index, |
| 651 | return queue_request((usb_id)(ssize_t)device, requestType, request, value, index, |
646 | 652 | length, data, callback, callbackCookie); |
647 | 653 | } |
648 | 654 | |
… |
… |
status_t
|
651 | 657 | queue_interrupt_v2(const void *pipe, void *data, size_t dataLength, |
652 | 658 | usb_callback_func callback, void *callbackCookie) |
653 | 659 | { |
654 | | return queue_interrupt((usb_id)pipe, data, dataLength, callback, |
| 660 | return queue_interrupt((usb_id)(ssize_t)pipe, data, dataLength, callback, |
655 | 661 | callbackCookie); |
656 | 662 | } |
657 | 663 | |
… |
… |
status_t
|
660 | 666 | queue_bulk_v2(const void *pipe, void *data, size_t dataLength, |
661 | 667 | usb_callback_func callback, void *callbackCookie) |
662 | 668 | { |
663 | | return queue_bulk((usb_id)pipe, data, dataLength, callback, |
| 669 | return queue_bulk((usb_id)(ssize_t)pipe, data, dataLength, callback, |
664 | 670 | callbackCookie); |
665 | 671 | } |
666 | 672 | |
… |
… |
queue_isochronous_v2(const void *pipe, void *data, size_t dataLength,
|
673 | 679 | // ToDo: convert rlea to usb_iso_packet_descriptor |
674 | 680 | // ToDo: use a flag to indicate that the callback shall produce a rlea |
675 | 681 | usb_iso_packet_descriptor *packetDesc = NULL; |
676 | | return queue_isochronous((usb_id)pipe, data, dataLength, packetDesc, 0, |
| 682 | return queue_isochronous((usb_id)(ssize_t)pipe, data, dataLength, packetDesc, 0, |
677 | 683 | NULL, 0, callback, callbackCookie); |
678 | 684 | } |
679 | 685 | |
… |
… |
status_t
|
682 | 688 | set_pipe_policy_v2(const void *pipe, uint8 maxQueuedPackets, |
683 | 689 | uint16 maxBufferDurationMS, uint16 sampleSize) |
684 | 690 | { |
685 | | return set_pipe_policy((usb_id)pipe, maxQueuedPackets, maxBufferDurationMS, |
| 691 | return set_pipe_policy((usb_id)(ssize_t)pipe, maxQueuedPackets, maxBufferDurationMS, |
686 | 692 | sampleSize); |
687 | 693 | } |
688 | 694 | |
… |
… |
set_pipe_policy_v2(const void *pipe, uint8 maxQueuedPackets,
|
690 | 696 | status_t |
691 | 697 | cancel_queued_transfers_v2(const void *pipe) |
692 | 698 | { |
693 | | return cancel_queued_transfers((usb_id)pipe); |
| 699 | return cancel_queued_transfers((usb_id)(ssize_t)pipe); |
694 | 700 | } |
695 | 701 | |
696 | 702 | |
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
|
b
|
|
17 | 17 | |
18 | 18 | #define TRACE_OUTPUT(x, y, z...) \ |
19 | 19 | { \ |
20 | | dprintf("usb %s%s %ld: ", y, (x)->TypeName(), (x)->USBID()); \ |
| 20 | dprintf("usb %s%s %" B_PRId32 ": ", y, (x)->TypeName(), (x)->USBID()); \ |
21 | 21 | dprintf(z); \ |
22 | 22 | } |
23 | 23 | |
… |
… |
public:
|
136 | 136 | BusManager * BusManagerAt(int32 index) const; |
137 | 137 | |
138 | 138 | status_t AllocateChunk(void **logicalAddress, |
139 | | void **physicalAddress, |
| 139 | phys_addr_t *physicalAddress, |
140 | 140 | size_t size); |
141 | 141 | status_t FreeChunk(void *logicalAddress, |
142 | | void *physicalAddress, size_t size); |
| 142 | phys_addr_t physicalAddress, |
| 143 | size_t size); |
143 | 144 | |
144 | 145 | area_id AllocateArea(void **logicalAddress, |
145 | | void **physicalAddress, |
| 146 | phys_addr_t *physicalAddress, |
146 | 147 | size_t size, const char *name); |
147 | 148 | |
148 | 149 | 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
|
b
|
|
39 | 39 | |
40 | 40 | struct memory_chunk |
41 | 41 | { |
42 | | addr_t next_item; |
43 | | addr_t physical; |
| 42 | uint32 next_item; |
| 43 | uint32 physical; |
44 | 44 | }; |
45 | 45 | |
46 | 46 | |
diff --git a/src/add-ons/kernel/busses/usb/ehci.cpp b/src/add-ons/kernel/busses/usb/ehci.cpp
index 86ca326..56a2ffd 100644
a
|
b
|
void
|
65 | 65 | print_descriptor_chain(ehci_qtd *descriptor) |
66 | 66 | { |
67 | 67 | while (descriptor) { |
68 | | dprintf(" %08lx n%08lx a%08lx t%08lx %08lx %08lx %08lx %08lx %08lx s%ld\n", |
| 68 | dprintf(" %08" B_PRIx32 " n%08" B_PRIx32 " a%08" B_PRIx32 " t%08" B_PRIx32 |
| 69 | " %08" B_PRIx32 " %08" B_PRIx32 " %08" B_PRIx32 " %08" B_PRIx32 |
| 70 | " %08" B_PRIx32 " s%"B_PRIuSIZE "\n", |
69 | 71 | descriptor->this_phy, descriptor->next_phy, |
70 | 72 | descriptor->alt_next_phy, descriptor->token, |
71 | 73 | descriptor->buffer_phy[0], descriptor->buffer_phy[1], |
… |
… |
print_descriptor_chain(ehci_qtd *descriptor)
|
82 | 84 | void |
83 | 85 | print_queue(ehci_qh *queueHead) |
84 | 86 | { |
85 | | dprintf("queue: t%08lx n%08lx ch%08lx ca%08lx cu%08lx\n", |
| 87 | dprintf("queue: t%08" B_PRIx32 " n%08" B_PRIx32 " ch%08" B_PRIx32 |
| 88 | " ca%08" B_PRIx32 " cu%08" B_PRIx32 "\n", |
86 | 89 | queueHead->this_phy, queueHead->next_phy, queueHead->endpoint_chars, |
87 | 90 | queueHead->endpoint_caps, queueHead->current_qtd_phy); |
88 | | dprintf("overlay: n%08lx a%08lx t%08lx %08lx %08lx %08lx %08lx %08lx\n", |
89 | | queueHead->overlay.next_phy, queueHead->overlay.alt_next_phy, |
90 | | queueHead->overlay.token, queueHead->overlay.buffer_phy[0], |
91 | | queueHead->overlay.buffer_phy[1], queueHead->overlay.buffer_phy[2], |
92 | | queueHead->overlay.buffer_phy[3], queueHead->overlay.buffer_phy[4]); |
| 91 | dprintf("overlay: n%08" B_PRIx32 " a%08" B_PRIx32 " t%08" B_PRIx32 |
| 92 | " %08" B_PRIx32 " %08" B_PRIx32 " %08" B_PRIx32 " %08" B_PRIx32 |
| 93 | " %08" B_PRIx32 "\n", queueHead->overlay.next_phy, |
| 94 | queueHead->overlay.alt_next_phy, queueHead->overlay.token, |
| 95 | queueHead->overlay.buffer_phy[0], queueHead->overlay.buffer_phy[1], |
| 96 | queueHead->overlay.buffer_phy[2], queueHead->overlay.buffer_phy[3], |
| 97 | queueHead->overlay.buffer_phy[4]); |
93 | 98 | print_descriptor_chain(queueHead->element_log); |
94 | 99 | } |
95 | 100 | |
… |
… |
EHCI::EHCI(pci_info *info, Stack *stack)
|
201 | 206 | |
202 | 207 | // map the registers |
203 | 208 | uint32 offset = fPCIInfo->u.h0.base_registers[0] & (B_PAGE_SIZE - 1); |
204 | | addr_t physicalAddress = fPCIInfo->u.h0.base_registers[0] - offset; |
| 209 | phys_addr_t physicalAddress = fPCIInfo->u.h0.base_registers[0] - offset; |
205 | 210 | size_t mapSize = (fPCIInfo->u.h0.base_register_sizes[0] + offset |
206 | 211 | + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1); |
207 | 212 | |
208 | | TRACE("map physical memory 0x%08lx (base: 0x%08lx; offset: %lx); size: %ld\n", |
| 213 | TRACE("map physical memory 0x%08" B_PRIx32 " (base: 0x%08" B_PRIxPHYSADDR |
| 214 | "; offset: %" B_PRIx32 "); size: %" B_PRIu32 "\n", |
209 | 215 | fPCIInfo->u.h0.base_registers[0], physicalAddress, offset, |
210 | 216 | fPCIInfo->u.h0.base_register_sizes[0]); |
211 | 217 | |
… |
… |
EHCI::EHCI(pci_info *info, Stack *stack)
|
220 | 226 | |
221 | 227 | fCapabilityRegisters += offset; |
222 | 228 | fOperationalRegisters = fCapabilityRegisters + ReadCapReg8(EHCI_CAPLENGTH); |
223 | | TRACE("mapped capability registers: 0x%08lx\n", (uint32)fCapabilityRegisters); |
224 | | TRACE("mapped operational registers: 0x%08lx\n", (uint32)fOperationalRegisters); |
| 229 | TRACE("mapped capability registers: 0x%p\n", fCapabilityRegisters); |
| 230 | TRACE("mapped operational registers: 0x%p\n", fOperationalRegisters); |
225 | 231 | |
226 | | TRACE("structural parameters: 0x%08lx\n", ReadCapReg32(EHCI_HCSPARAMS)); |
227 | | TRACE("capability parameters: 0x%08lx\n", ReadCapReg32(EHCI_HCCPARAMS)); |
| 232 | TRACE("structural parameters: 0x%08" B_PRIx32 "\n", ReadCapReg32(EHCI_HCSPARAMS)); |
| 233 | TRACE("capability parameters: 0x%08" B_PRIx32 "\n", ReadCapReg32(EHCI_HCCPARAMS)); |
228 | 234 | |
229 | 235 | if (EHCI_HCCPARAMS_FRAME_CACHE(ReadCapReg32(EHCI_HCCPARAMS))) |
230 | 236 | fThreshold = 2 + 8; |
… |
… |
EHCI::EHCI(pci_info *info, Stack *stack)
|
237 | 243 | uint32 extendedCapPointer = ReadCapReg32(EHCI_HCCPARAMS) >> EHCI_ECP_SHIFT; |
238 | 244 | extendedCapPointer &= EHCI_ECP_MASK; |
239 | 245 | if (extendedCapPointer > 0) { |
240 | | TRACE("extended capabilities register at %ld\n", extendedCapPointer); |
| 246 | TRACE("extended capabilities register at %" B_PRIu32 "\n", extendedCapPointer); |
241 | 247 | |
242 | 248 | uint32 legacySupport = sPCIModule->read_pci_config(fPCIInfo->bus, |
243 | 249 | fPCIInfo->device, fPCIInfo->function, extendedCapPointer, 4); |
… |
… |
EHCI::EHCI(pci_info *info, Stack *stack)
|
376 | 382 | |
377 | 383 | // allocate the periodic frame list |
378 | 384 | fPeriodicFrameListArea = fStack->AllocateArea((void **)&fPeriodicFrameList, |
379 | | (void **)&physicalAddress, frameListSize, "USB EHCI Periodic Framelist"); |
| 385 | &physicalAddress, frameListSize, "USB EHCI Periodic Framelist"); |
380 | 386 | if (fPeriodicFrameListArea < B_OK) { |
381 | 387 | TRACE_ERROR("unable to allocate periodic framelist\n"); |
382 | 388 | return; |
383 | 389 | } |
384 | 390 | |
385 | | if ((physicalAddress & 0xfff) != 0) |
386 | | panic("EHCI_PERIODICLISTBASE not aligned on 4k: 0x%lx\n", physicalAddress); |
| 391 | if ((physicalAddress & 0xfff) != 0) { |
| 392 | panic("EHCI_PERIODICLISTBASE not aligned on 4k: 0x%" B_PRIxPHYSADDR |
| 393 | "\n", physicalAddress); |
| 394 | } |
387 | 395 | // set the periodic frame list base on the controller |
388 | 396 | WriteOpReg(EHCI_PERIODICLISTBASE, (uint32)physicalAddress); |
389 | 397 | |
390 | 398 | // create the interrupt entries to support different polling intervals |
391 | 399 | TRACE("creating interrupt entries\n"); |
392 | | addr_t physicalBase = physicalAddress + B_PAGE_SIZE; |
| 400 | uint32_t physicalBase = physicalAddress + B_PAGE_SIZE; |
393 | 401 | uint8 *logicalBase = (uint8 *)fPeriodicFrameList + B_PAGE_SIZE; |
394 | 402 | memset(logicalBase, 0, B_PAGE_SIZE); |
395 | 403 | |
… |
… |
EHCI::EHCI(pci_info *info, Stack *stack)
|
414 | 422 | |
415 | 423 | // create the itd and sitd entries |
416 | 424 | TRACE("build up iso entries\n"); |
417 | | addr_t itdPhysicalBase = physicalAddress + B_PAGE_SIZE + B_PAGE_SIZE; |
| 425 | uint32_t itdPhysicalBase = physicalAddress + B_PAGE_SIZE + B_PAGE_SIZE; |
418 | 426 | itd_entry* itds = (itd_entry *)((uint8 *)fPeriodicFrameList + B_PAGE_SIZE |
419 | 427 | + B_PAGE_SIZE); |
420 | 428 | memset(itds, 0, itdListSize); |
421 | 429 | |
422 | | addr_t sitdPhysicalBase = itdPhysicalBase + itdListSize; |
| 430 | uint32_t sitdPhysicalBase = itdPhysicalBase + itdListSize; |
423 | 431 | sitd_entry* sitds = (sitd_entry *)((uint8 *)fPeriodicFrameList + B_PAGE_SIZE |
424 | 432 | + B_PAGE_SIZE + itdListSize); |
425 | 433 | memset(sitds, 0, sitdListSize); |
… |
… |
EHCI::EHCI(pci_info *info, Stack *stack)
|
427 | 435 | fItdEntries = new(std::nothrow) ehci_itd *[EHCI_VFRAMELIST_ENTRIES_COUNT]; |
428 | 436 | fSitdEntries = new(std::nothrow) ehci_sitd *[EHCI_VFRAMELIST_ENTRIES_COUNT]; |
429 | 437 | |
| 438 | dprintf("sitd entry size %lu, itd entry size %lu\n", sizeof(sitd_entry), sizeof(itd_entry)); |
430 | 439 | for (int32 i = 0; i < EHCI_VFRAMELIST_ENTRIES_COUNT; i++) { |
431 | 440 | ehci_sitd *sitd = &sitds[i].sitd; |
432 | 441 | sitd->this_phy = sitdPhysicalBase | EHCI_ITEM_TYPE_SITD; |
433 | 442 | sitd->back_phy = EHCI_ITEM_TERMINATE; |
434 | 443 | fSitdEntries[i] = sitd; |
435 | | TRACE("sitd entry %ld %p 0x%lx\n", i, sitd, sitd->this_phy); |
| 444 | TRACE("sitd entry %" B_PRId32 " %p 0x%" B_PRIx32 "\n", i, sitd, sitd->this_phy); |
436 | 445 | |
437 | 446 | ehci_itd *itd = &itds[i].itd; |
438 | 447 | itd->this_phy = itdPhysicalBase | EHCI_ITEM_TYPE_ITD; |
439 | 448 | itd->next_phy = sitd->this_phy; |
440 | 449 | fItdEntries[i] = itd; |
441 | | TRACE("itd entry %ld %p 0x%lx\n", i, itd, itd->this_phy); |
| 450 | TRACE("itd entry %" B_PRId32 " %p 0x%" B_PRIx32 "\n", i, itd, itd->this_phy); |
442 | 451 | |
443 | 452 | sitdPhysicalBase += sizeof(sitd_entry); |
444 | 453 | itdPhysicalBase += sizeof(itd_entry); |
445 | 454 | if ((sitdPhysicalBase & 0x10) != 0 || (itdPhysicalBase & 0x10) != 0) |
446 | | panic("physical base for entry %ld not aligned on 32\n", i); |
| 455 | panic("physical base for entry %" B_PRId32 " not aligned on 32\n", |
| 456 | i); |
447 | 457 | } |
448 | 458 | |
449 | 459 | // build flat interrupt tree |
… |
… |
EHCI::EHCI(pci_info *info, Stack *stack)
|
479 | 489 | for (int32 i = 0; i < EHCI_FRAMELIST_ENTRIES_COUNT; i++) { |
480 | 490 | fPeriodicFrameList[i] = |
481 | 491 | fItdEntries[i & (EHCI_VFRAMELIST_ENTRIES_COUNT - 1)]->this_phy; |
482 | | TRACE("periodic entry %ld linked to 0x%lx\n", i, fPeriodicFrameList[i]); |
| 492 | TRACE("periodic entry %" B_PRId32 " linked to 0x%" B_PRIx32 "\n", i, fPeriodicFrameList[i]); |
483 | 493 | } |
484 | 494 | |
485 | 495 | // Create the array that will keep bandwidth information |
… |
… |
EHCI::EHCI(pci_info *info, Stack *stack)
|
504 | 514 | fAsyncQueueHead->overlay.next_phy = EHCI_ITEM_TERMINATE; |
505 | 515 | |
506 | 516 | WriteOpReg(EHCI_ASYNCLISTADDR, (uint32)fAsyncQueueHead->this_phy); |
507 | | TRACE("set the async list addr to 0x%08lx\n", ReadOpReg(EHCI_ASYNCLISTADDR)); |
| 517 | TRACE("set the async list addr to 0x%08" B_PRIx32 "\n", ReadOpReg(EHCI_ASYNCLISTADDR)); |
508 | 518 | |
509 | 519 | fInitOK = true; |
510 | 520 | TRACE("EHCI host controller driver constructed\n"); |
… |
… |
status_t
|
554 | 564 | EHCI::Start() |
555 | 565 | { |
556 | 566 | TRACE("starting EHCI host controller\n"); |
557 | | TRACE("usbcmd: 0x%08lx; usbsts: 0x%08lx\n", ReadOpReg(EHCI_USBCMD), |
| 567 | TRACE("usbcmd: 0x%08" B_PRIx32 "; usbsts: 0x%08" B_PRIx32 "\n", ReadOpReg(EHCI_USBCMD), |
558 | 568 | ReadOpReg(EHCI_USBSTS)); |
559 | 569 | |
560 | 570 | bool hasPerPortChangeEvent = (ReadCapReg32(EHCI_HCCPARAMS) |
… |
… |
EHCI::Start()
|
589 | 599 | bool running = false; |
590 | 600 | for (int32 i = 0; i < 10; i++) { |
591 | 601 | uint32 status = ReadOpReg(EHCI_USBSTS); |
592 | | TRACE("try %ld: status 0x%08lx\n", i, status); |
| 602 | TRACE("try %" B_PRId32 ": status 0x%08" B_PRIx32 "\n", i, status); |
593 | 603 | |
594 | 604 | if (status & EHCI_USBSTS_HCHALTED) { |
595 | 605 | snooze(10000); |
… |
… |
EHCI::SubmitIsochronous(Transfer *transfer)
|
729 | 739 | return B_NO_MEMORY; |
730 | 740 | } |
731 | 741 | |
732 | | TRACE("isochronous submitted size=%ld bytes, TDs=%ld, " |
733 | | "maxPacketSize=%ld, packetSize=%ld, restSize=%ld\n", transfer->DataLength(), |
734 | | isochronousData->packet_count, pipe->MaxPacketSize(), packetSize, restSize); |
| 742 | TRACE("isochronous submitted size=%" B_PRIuSIZE " bytes, TDs=%" B_PRIu32 ", " |
| 743 | "maxPacketSize=%" B_PRIuSIZE ", packetSize=%" B_PRIuSIZE ", restSize=%" |
| 744 | B_PRIuSIZE "\n", transfer->DataLength(), isochronousData->packet_count, |
| 745 | pipe->MaxPacketSize(), packetSize, restSize); |
735 | 746 | |
736 | 747 | // Find the entry where to start inserting the first Isochronous descriptor |
737 | 748 | if (isochronousData->flags & USB_ISO_ASAP || |
… |
… |
EHCI::SubmitIsochronous(Transfer *transfer)
|
741 | 752 | currentFrame = fNextStartingFrame; |
742 | 753 | else { |
743 | 754 | uint32 threshold = fThreshold; |
744 | | TRACE("threshold: %ld\n", threshold); |
| 755 | TRACE("threshold: %" B_PRIu32 "\n", threshold); |
745 | 756 | |
746 | 757 | // find the first available frame with enough bandwidth. |
747 | 758 | // This should always be the case, as defining the starting frame |
… |
… |
EHCI::SubmitIsochronous(Transfer *transfer)
|
768 | 779 | uint16 itdIndex = 0; |
769 | 780 | size_t dataLength = transfer->DataLength(); |
770 | 781 | void* bufferLog; |
771 | | addr_t bufferPhy; |
772 | | if (fStack->AllocateChunk(&bufferLog, (void**)&bufferPhy, dataLength) < B_OK) { |
| 782 | phys_addr_t bufferPhy; |
| 783 | if (fStack->AllocateChunk(&bufferLog, &bufferPhy, dataLength) < B_OK) { |
773 | 784 | TRACE_ERROR("unable to allocate itd buffer\n"); |
774 | 785 | delete[] isoRequest; |
775 | 786 | return B_NO_MEMORY; |
… |
… |
EHCI::SubmitIsochronous(Transfer *transfer)
|
777 | 788 | |
778 | 789 | memset(bufferLog, 0, dataLength); |
779 | 790 | |
780 | | addr_t currentPhy = bufferPhy; |
| 791 | phys_addr_t currentPhy = bufferPhy; |
781 | 792 | uint32 frameCount = 0; |
782 | 793 | while (dataLength > 0) { |
783 | 794 | ehci_itd* itd = CreateItdDescriptor(); |
… |
… |
EHCI::SubmitIsochronous(Transfer *transfer)
|
792 | 803 | | (length << EHCI_ITD_TLENGTH_SHIFT) | (pg << EHCI_ITD_PG_SHIFT) |
793 | 804 | | (offset << EHCI_ITD_TOFFSET_SHIFT); |
794 | 805 | itd->last_token = i; |
795 | | TRACE("isochronous filled slot %ld 0x%lx\n", i, itd->token[i]); |
| 806 | TRACE("isochronous filled slot %" B_PRId32 " 0x%" B_PRIx32 "\n", i, itd->token[i]); |
796 | 807 | dataLength -= length; |
797 | 808 | offset += length; |
798 | 809 | if (dataLength > 0 && offset > 0xfff) { |
… |
… |
EHCI::SubmitIsochronous(Transfer *transfer)
|
815 | 826 | ((((pipe->MaxPacketSize() >> EHCI_ITD_MAXPACKETSIZE_LENGTH) + 1) |
816 | 827 | & EHCI_ITD_MUL_MASK) << EHCI_ITD_MUL_SHIFT); |
817 | 828 | |
818 | | TRACE("isochronous filled itd buffer_phy[0,1,2] 0x%lx, 0x%lx 0x%lx\n", |
| 829 | TRACE("isochronous filled itd buffer_phy[0,1,2] 0x%" B_PRIx32 ", 0x%" |
| 830 | B_PRIx32 " 0x%" B_PRIx32 "\n", |
819 | 831 | itd->buffer_phy[0], itd->buffer_phy[1], itd->buffer_phy[2]); |
820 | 832 | |
821 | 833 | if (!LockIsochronous()) |
… |
… |
EHCI::AddTo(Stack *stack)
|
905 | 917 | if (!sPCIModule) { |
906 | 918 | status_t status = get_module(B_PCI_MODULE_NAME, (module_info **)&sPCIModule); |
907 | 919 | if (status < B_OK) { |
908 | | TRACE_MODULE_ERROR("getting pci module failed! 0x%08lx\n", status); |
| 920 | TRACE_MODULE_ERROR("getting pci module failed! 0x%08" B_PRIx32 |
| 921 | "\n", status); |
909 | 922 | return status; |
910 | 923 | } |
911 | 924 | } |
… |
… |
EHCI::Interrupt()
|
1178 | 1191 | uint32 status = ReadOpReg(EHCI_USBSTS) & EHCI_USBSTS_INTMASK; |
1179 | 1192 | if ((status & fEnabledInterrupts) == 0) { |
1180 | 1193 | if (status != 0) { |
1181 | | TRACE("discarding not enabled interrupts 0x%08lx\n", status); |
| 1194 | TRACE("discarding not enabled interrupts 0x%08" B_PRIx32 "\n", status); |
1182 | 1195 | WriteOpReg(EHCI_USBSTS, status); |
1183 | 1196 | } |
1184 | 1197 | |
… |
… |
EHCI::FinishTransfers()
|
1480 | 1493 | uint32 status = descriptor->token; |
1481 | 1494 | if (status & EHCI_QTD_STATUS_ACTIVE) { |
1482 | 1495 | // still in progress |
1483 | | TRACE("qtd (0x%08lx) still active\n", descriptor->this_phy); |
| 1496 | TRACE("qtd (0x%08" B_PRIx32 ") still active\n", descriptor->this_phy); |
1484 | 1497 | break; |
1485 | 1498 | } |
1486 | 1499 | |
1487 | 1500 | if (status & EHCI_QTD_STATUS_ERRMASK) { |
1488 | 1501 | // a transfer error occured |
1489 | | TRACE_ERROR("qtd (0x%08lx) error: 0x%08lx\n", descriptor->this_phy, status); |
| 1502 | TRACE_ERROR("qtd (0x%" B_PRIx32 ") error: 0x%08" B_PRIx32 |
| 1503 | "\n", descriptor->this_phy, status); |
1490 | 1504 | |
1491 | 1505 | uint8 errorCount = status >> EHCI_QTD_ERRCOUNT_SHIFT; |
1492 | 1506 | errorCount &= EHCI_QTD_ERRCOUNT_MASK; |
… |
… |
EHCI::FinishTransfers()
|
1535 | 1549 | |
1536 | 1550 | if (descriptor->next_phy & EHCI_ITEM_TERMINATE) { |
1537 | 1551 | // we arrived at the last (stray) descriptor, we're done |
1538 | | TRACE("qtd (0x%08lx) done\n", descriptor->this_phy); |
| 1552 | TRACE("qtd (0x%08" B_PRIx32 ") done\n", descriptor->this_phy); |
1539 | 1553 | callbackStatus = B_OK; |
1540 | 1554 | transferDone = true; |
1541 | 1555 | break; |
… |
… |
EHCI::FinishIsochronousTransfers()
|
1718 | 1732 | |
1719 | 1733 | ehci_itd *itd = fItdEntries[currentFrame]; |
1720 | 1734 | |
1721 | | TRACE("FinishIsochronousTransfers itd %p phy 0x%lx prev (%p/0x%lx)" |
1722 | | " at frame %ld\n", itd, itd->this_phy, itd->prev, |
1723 | | itd->prev != NULL ? itd->prev->this_phy : 0, currentFrame); |
| 1735 | TRACE("FinishIsochronousTransfers itd %p phy 0x%" B_PRIx32 |
| 1736 | " prev (%p/0x%" B_PRIx32 ") at frame %" B_PRId32 "\n", itd, |
| 1737 | itd->this_phy, itd->prev, itd->prev != NULL |
| 1738 | ? itd->prev->this_phy : 0, currentFrame); |
1724 | 1739 | |
1725 | 1740 | if (!LockIsochronous()) |
1726 | 1741 | continue; |
… |
… |
EHCI::FinishIsochronousTransfers()
|
1728 | 1743 | // Process the frame till it has isochronous descriptors in it. |
1729 | 1744 | while (!(itd->next_phy & EHCI_ITEM_TERMINATE) && itd->prev != NULL) { |
1730 | 1745 | TRACE("FinishIsochronousTransfers checking itd %p last_token" |
1731 | | " %ld\n", itd, itd->last_token); |
1732 | | TRACE("FinishIsochronousTransfers tokens 0x%lx 0x%lx 0x%lx " |
1733 | | "0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n", |
| 1746 | " %" B_PRId32 "\n", itd, itd->last_token); |
| 1747 | TRACE("FinishIsochronousTransfers tokens 0x%" B_PRIx32 " 0x%" |
| 1748 | B_PRIx32 " 0x%" B_PRIx32 " 0x%" B_PRIx32 " 0x%" B_PRIx32 |
| 1749 | " 0x%" B_PRIx32 " 0x%" B_PRIx32 " 0x%" B_PRIx32 "\n", |
1734 | 1750 | itd->token[0], itd->token[1], itd->token[2], itd->token[3], |
1735 | 1751 | itd->token[4], itd->token[5], itd->token[6], itd->token[7]); |
1736 | 1752 | if (((itd->token[itd->last_token] >> EHCI_ITD_STATUS_SHIFT) |
… |
… |
EHCI::FinishIsochronousTransfers()
|
1784 | 1800 | delete [] transfer->descriptors; |
1785 | 1801 | delete transfer->transfer; |
1786 | 1802 | fStack->FreeChunk(transfer->buffer_log, |
1787 | | (void *)transfer->buffer_phy, transfer->buffer_size); |
| 1803 | (phys_addr_t)transfer->buffer_phy, transfer->buffer_size); |
1788 | 1804 | delete transfer; |
1789 | 1805 | transferDone = true; |
1790 | 1806 | } else { |
… |
… |
ehci_qh *
|
1809 | 1825 | EHCI::CreateQueueHead() |
1810 | 1826 | { |
1811 | 1827 | ehci_qh *result; |
1812 | | void *physicalAddress; |
| 1828 | phys_addr_t physicalAddress; |
1813 | 1829 | if (fStack->AllocateChunk((void **)&result, &physicalAddress, |
1814 | 1830 | sizeof(ehci_qh)) < B_OK) { |
1815 | 1831 | TRACE_ERROR("failed to allocate queue head\n"); |
… |
… |
EHCI::FreeQueueHead(ehci_qh *queueHead)
|
1889 | 1905 | |
1890 | 1906 | FreeDescriptorChain(queueHead->element_log); |
1891 | 1907 | FreeDescriptor(queueHead->stray_log); |
1892 | | fStack->FreeChunk(queueHead, (void *)queueHead->this_phy, sizeof(ehci_qh)); |
| 1908 | fStack->FreeChunk(queueHead, (phys_addr_t)queueHead->this_phy, sizeof(ehci_qh)); |
1893 | 1909 | } |
1894 | 1910 | |
1895 | 1911 | |
… |
… |
ehci_qtd *
|
2088 | 2104 | EHCI::CreateDescriptor(size_t bufferSize, uint8 pid) |
2089 | 2105 | { |
2090 | 2106 | ehci_qtd *result; |
2091 | | void *physicalAddress; |
| 2107 | phys_addr_t physicalAddress; |
2092 | 2108 | if (fStack->AllocateChunk((void **)&result, &physicalAddress, |
2093 | 2109 | sizeof(ehci_qtd)) < B_OK) { |
2094 | 2110 | TRACE_ERROR("failed to allocate a qtd\n"); |
… |
… |
EHCI::CreateDescriptor(size_t bufferSize, uint8 pid)
|
2118 | 2134 | if (fStack->AllocateChunk(&result->buffer_log, &physicalAddress, |
2119 | 2135 | bufferSize) < B_OK) { |
2120 | 2136 | TRACE_ERROR("unable to allocate qtd buffer\n"); |
2121 | | fStack->FreeChunk(result, (void *)result->this_phy, sizeof(ehci_qtd)); |
| 2137 | fStack->FreeChunk(result, (phys_addr_t)result->this_phy, sizeof(ehci_qtd)); |
2122 | 2138 | return NULL; |
2123 | 2139 | } |
2124 | 2140 | |
… |
… |
EHCI::FreeDescriptor(ehci_qtd *descriptor)
|
2181 | 2197 | |
2182 | 2198 | if (descriptor->buffer_log) { |
2183 | 2199 | fStack->FreeChunk(descriptor->buffer_log, |
2184 | | (void *)descriptor->buffer_phy[0], descriptor->buffer_size); |
| 2200 | (phys_addr_t)descriptor->buffer_phy[0], descriptor->buffer_size); |
2185 | 2201 | } |
2186 | 2202 | |
2187 | | fStack->FreeChunk(descriptor, (void *)descriptor->this_phy, |
| 2203 | fStack->FreeChunk(descriptor, (phys_addr_t)descriptor->this_phy, |
2188 | 2204 | sizeof(ehci_qtd)); |
2189 | 2205 | } |
2190 | 2206 | |
… |
… |
ehci_itd *
|
2207 | 2223 | EHCI::CreateItdDescriptor() |
2208 | 2224 | { |
2209 | 2225 | ehci_itd *result; |
2210 | | void *physicalAddress; |
| 2226 | phys_addr_t physicalAddress; |
2211 | 2227 | if (fStack->AllocateChunk((void **)&result, &physicalAddress, |
2212 | 2228 | sizeof(ehci_itd)) < B_OK) { |
2213 | 2229 | TRACE_ERROR("failed to allocate a itd\n"); |
… |
… |
ehci_sitd *
|
2226 | 2242 | EHCI::CreateSitdDescriptor() |
2227 | 2243 | { |
2228 | 2244 | ehci_sitd *result; |
2229 | | void *physicalAddress; |
| 2245 | phys_addr_t physicalAddress; |
2230 | 2246 | if (fStack->AllocateChunk((void **)&result, &physicalAddress, |
2231 | 2247 | sizeof(ehci_sitd)) < B_OK) { |
2232 | 2248 | TRACE_ERROR("failed to allocate a sitd\n"); |
… |
… |
EHCI::FreeDescriptor(ehci_itd *descriptor)
|
2247 | 2263 | if (!descriptor) |
2248 | 2264 | return; |
2249 | 2265 | |
2250 | | fStack->FreeChunk(descriptor, (void *)descriptor->this_phy, |
| 2266 | fStack->FreeChunk(descriptor, (phys_addr_t)descriptor->this_phy, |
2251 | 2267 | sizeof(ehci_itd)); |
2252 | 2268 | } |
2253 | 2269 | |
… |
… |
EHCI::FreeDescriptor(ehci_sitd *descriptor)
|
2258 | 2274 | if (!descriptor) |
2259 | 2275 | return; |
2260 | 2276 | |
2261 | | fStack->FreeChunk(descriptor, (void *)descriptor->this_phy, |
| 2277 | fStack->FreeChunk(descriptor, (phys_addr_t)descriptor->this_phy, |
2262 | 2278 | sizeof(ehci_sitd)); |
2263 | 2279 | } |
2264 | 2280 | |
… |
… |
EHCI::ReadIsochronousDescriptorChain(isochronous_transfer_data *transfer)
|
2558 | 2574 | } |
2559 | 2575 | } |
2560 | 2576 | |
2561 | | TRACE("ReadIsochronousDescriptorChain packet count %ld\n", packet); |
| 2577 | TRACE("ReadIsochronousDescriptorChain packet count %" B_PRId32 "\n", |
| 2578 | packet); |
2562 | 2579 | |
2563 | 2580 | return totalLength; |
2564 | 2581 | } |
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
|
b
|
static pci_module_info * sPCIModule;
|
199 | 199 | |
200 | 200 | // Periodic transfer framelist and interrupt entries |
201 | 201 | area_id fPeriodicFrameListArea; |
202 | | addr_t * fPeriodicFrameList; |
| 202 | uint32 * fPeriodicFrameList; |
203 | 203 | interrupt_entry * fInterruptEntries; |
204 | 204 | ehci_itd ** fItdEntries; |
205 | 205 | 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
|
b
|
|
130 | 130 | // Isochronous (High-Speed) Transfer Descriptors (iTD, EHCI Spec 3.2) |
131 | 131 | typedef struct ehci_itd { |
132 | 132 | // Hardware Part |
133 | | addr_t next_phy; |
| 133 | uint32 next_phy; |
134 | 134 | uint32 token[8]; |
135 | | addr_t buffer_phy[7]; |
136 | | addr_t ext_buffer_phy[7]; |
| 135 | uint32 buffer_phy[7]; |
| 136 | uint32 ext_buffer_phy[7]; |
137 | 137 | |
138 | 138 | // Software Part |
139 | | addr_t this_phy; |
| 139 | uint32 this_phy; |
140 | 140 | struct ehci_itd *next; |
141 | 141 | struct ehci_itd *prev; |
142 | 142 | uint32 last_token; |
… |
… |
typedef struct ehci_itd {
|
172 | 172 | // Split Transaction Isochronous Transfer Descriptors (siTD, EHCI Spec 3.3) |
173 | 173 | typedef struct ehci_sitd { |
174 | 174 | // Hardware Part |
175 | | addr_t next_phy; |
| 175 | uint32 next_phy; |
176 | 176 | uint8 port_number; |
177 | 177 | uint8 hub_address; |
178 | 178 | uint8 endpoint; |
… |
… |
typedef struct ehci_sitd {
|
183 | 183 | uint16 transfer_length; |
184 | 184 | uint8 cprogmask; |
185 | 185 | uint8 status; |
186 | | addr_t buffer_phy[2]; |
187 | | addr_t back_phy; |
188 | | addr_t ext_buffer_phy[2]; |
| 186 | uint32 buffer_phy[2]; |
| 187 | uint32 back_phy; |
| 188 | uint32 ext_buffer_phy[2]; |
189 | 189 | |
190 | 190 | // Software Part |
191 | | addr_t this_phy; |
| 191 | uint32 this_phy; |
192 | 192 | struct ehci_sitd *next; |
193 | 193 | struct ehci_sitd *prev; |
194 | 194 | size_t buffer_size; |
195 | 195 | void *buffer_log; |
196 | | } ehci_sitd; |
| 196 | } _PACKED ehci_sitd; |
197 | 197 | |
198 | 198 | // Queue Element Transfer Descriptors (qTD, EHCI Spec 3.5) |
199 | 199 | typedef struct ehci_qtd { |
200 | 200 | // Hardware Part |
201 | | addr_t next_phy; |
202 | | addr_t alt_next_phy; |
| 201 | uint32 next_phy; |
| 202 | uint32 alt_next_phy; |
203 | 203 | uint32 token; |
204 | | addr_t buffer_phy[5]; |
205 | | addr_t ext_buffer_phy[5]; |
| 204 | uint32 buffer_phy[5]; |
| 205 | uint32 ext_buffer_phy[5]; |
206 | 206 | |
207 | 207 | // Software Part |
208 | | addr_t this_phy; |
| 208 | uint32 this_phy; |
209 | 209 | struct ehci_qtd *next_log; |
210 | 210 | void *alt_next_log; |
211 | 211 | size_t buffer_size; |
212 | 212 | void *buffer_log; |
213 | | } ehci_qtd; |
| 213 | } _PACKED ehci_qtd; |
214 | 214 | |
215 | 215 | |
216 | 216 | #define EHCI_QTD_DATA_TOGGLE (1 << 31) |
… |
… |
typedef struct ehci_qtd {
|
244 | 244 | // Queue Head (QH, EHCI Spec 3.6) |
245 | 245 | typedef struct ehci_qh { |
246 | 246 | // Hardware Part |
247 | | addr_t next_phy; |
| 247 | uint32 next_phy; |
248 | 248 | uint32 endpoint_chars; |
249 | 249 | uint32 endpoint_caps; |
250 | | addr_t current_qtd_phy; |
| 250 | uint32 current_qtd_phy; |
251 | 251 | |
252 | 252 | struct { |
253 | | addr_t next_phy; |
254 | | addr_t alt_next_phy; |
| 253 | uint32 next_phy; |
| 254 | uint32 alt_next_phy; |
255 | 255 | uint32 token; |
256 | | addr_t buffer_phy[5]; |
257 | | addr_t ext_buffer_phy[5]; |
| 256 | uint32 buffer_phy[5]; |
| 257 | uint32 ext_buffer_phy[5]; |
258 | 258 | } overlay; |
259 | 259 | |
260 | 260 | // Software Part |
261 | | addr_t this_phy; |
| 261 | uint32 this_phy; |
262 | 262 | struct ehci_qh *next_log; |
263 | 263 | struct ehci_qh *prev_log; |
264 | 264 | ehci_qtd *stray_log; |
… |
… |
typedef struct ehci_qh {
|
268 | 268 | |
269 | 269 | typedef struct { |
270 | 270 | ehci_qh queue_head; |
| 271 | #ifdef B_HAIKU_64_BIT |
| 272 | uint32 padding[6]; |
| 273 | #else |
271 | 274 | uint32 padding[2]; |
| 275 | #endif |
272 | 276 | } interrupt_entry; |
273 | 277 | |
274 | 278 | typedef struct { |
275 | 279 | ehci_itd itd; |
| 280 | #ifdef B_HAIKU_64_BIT |
| 281 | uint32 padding[1]; // align on 128 |
| 282 | #else |
276 | 283 | uint32 padding[5]; // align on 128 |
| 284 | #endif |
277 | 285 | } itd_entry; |
278 | 286 | |
279 | 287 | typedef struct { |
280 | 288 | ehci_sitd sitd; |
281 | | uint32 padding[2]; // align on 64 |
| 289 | |
| 290 | #ifdef B_HAIKU_64_BIT |
| 291 | uint32 padding[14]; // align on 64 |
| 292 | #else |
| 293 | uint32 padding[2]; // align on 64 |
| 294 | #endif |
282 | 295 | } sitd_entry; |
283 | 296 | |
284 | 297 | #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..4154151 100644
a
|
b
|
|
18 | 18 | |
19 | 19 | #define DRIVER_NAME "usb_disk" |
20 | 20 | #define DEVICE_NAME_BASE "disk/usb/" |
21 | | #define DEVICE_NAME DEVICE_NAME_BASE"%ld/%d/raw" |
| 21 | #define DEVICE_NAME DEVICE_NAME_BASE"%" B_PRIu32 "/%d/raw" |
22 | 22 | |
23 | 23 | |
24 | 24 | //#define TRACE_USB_DISK |
… |
… |
status_t usb_disk_receive_csw(disk_device *device,
|
130 | 130 | command_status_wrapper *status); |
131 | 131 | status_t usb_disk_operation(device_lun *lun, uint8 operation, |
132 | 132 | uint8 opLength, uint32 logicalBlockAddress, |
133 | | uint16 transferLength, void *data, uint32 *dataLength, |
| 133 | uint16 transferLength, void *data, size_t *dataLength, |
134 | 134 | bool directionIn); |
135 | 135 | |
136 | 136 | status_t usb_disk_request_sense(device_lun *lun); |
… |
… |
usb_disk_receive_csw(disk_device *device, command_status_wrapper *status)
|
259 | 259 | status_t |
260 | 260 | usb_disk_operation(device_lun *lun, uint8 operation, uint8 opLength, |
261 | 261 | uint32 logicalBlockAddress, uint16 transferLength, void *data, |
262 | | uint32 *dataLength, bool directionIn) |
| 262 | size_t *dataLength, bool directionIn) |
263 | 263 | { |
264 | 264 | TRACE("operation: lun: %u; op: %u; oplen: %u; lba: %lu; tlen: %u; data: " |
265 | 265 | "%p; dlen: %p (%lu); in: %c\n", |
… |
… |
usb_disk_operation(device_lun *lun, uint8 operation, uint8 opLength,
|
427 | 427 | status_t |
428 | 428 | usb_disk_request_sense(device_lun *lun) |
429 | 429 | { |
430 | | uint32 dataLength = sizeof(scsi_request_sense_6_parameter); |
| 430 | size_t dataLength = sizeof(scsi_request_sense_6_parameter); |
431 | 431 | scsi_request_sense_6_parameter parameter; |
432 | 432 | status_t result = usb_disk_operation(lun, SCSI_REQUEST_SENSE_6, 6, 0, |
433 | 433 | dataLength, ¶meter, &dataLength, true); |
… |
… |
usb_disk_request_sense(device_lun *lun)
|
492 | 492 | status_t |
493 | 493 | usb_disk_mode_sense(device_lun *lun) |
494 | 494 | { |
495 | | uint32 dataLength = sizeof(scsi_mode_sense_6_parameter); |
| 495 | size_t dataLength = sizeof(scsi_mode_sense_6_parameter); |
496 | 496 | scsi_mode_sense_6_parameter parameter; |
497 | 497 | status_t result = usb_disk_operation(lun, SCSI_MODE_SENSE_6, 6, |
498 | 498 | SCSI_MODE_PAGE_DEVICE_CONFIGURATION, dataLength, ¶meter, |
… |
… |
usb_disk_test_unit_ready(device_lun *lun)
|
538 | 538 | status_t |
539 | 539 | usb_disk_inquiry(device_lun *lun) |
540 | 540 | { |
541 | | uint32 dataLength = sizeof(scsi_inquiry_6_parameter); |
| 541 | size_t dataLength = sizeof(scsi_inquiry_6_parameter); |
542 | 542 | scsi_inquiry_6_parameter parameter; |
543 | 543 | status_t result = B_ERROR; |
544 | 544 | for (uint32 tries = 0; tries < 3; tries++) { |
… |
… |
usb_disk_reset_capacity(device_lun *lun)
|
586 | 586 | status_t |
587 | 587 | usb_disk_update_capacity(device_lun *lun) |
588 | 588 | { |
589 | | uint32 dataLength = sizeof(scsi_read_capacity_10_parameter); |
| 589 | size_t dataLength = sizeof(scsi_read_capacity_10_parameter); |
590 | 590 | scsi_read_capacity_10_parameter parameter; |
591 | 591 | status_t result = B_ERROR; |
592 | 592 | |
… |
… |
usb_disk_ioctl(void *cookie, uint32 op, void *buffer, size_t length)
|
1126 | 1126 | #endif |
1127 | 1127 | |
1128 | 1128 | default: |
1129 | | TRACE_ALWAYS("unhandled ioctl %ld\n", op); |
| 1129 | TRACE_ALWAYS("unhandled ioctl %" B_PRId32 "\n", op); |
1130 | 1130 | break; |
1131 | 1131 | } |
1132 | 1132 | |
… |
… |
usb_disk_read(void *cookie, off_t position, void *buffer, size_t *length)
|
1177 | 1177 | } |
1178 | 1178 | |
1179 | 1179 | *length = 0; |
1180 | | TRACE_ALWAYS("read fails with 0x%08lx\n", result); |
| 1180 | TRACE_ALWAYS("read fails with 0x%08" B_PRIx32 "\n", result); |
1181 | 1181 | return result; |
1182 | 1182 | } |
1183 | 1183 | |
… |
… |
usb_disk_write(void *cookie, off_t position, const void *buffer,
|
1228 | 1228 | } |
1229 | 1229 | |
1230 | 1230 | *length = 0; |
1231 | | TRACE_ALWAYS("write fails with 0x%08lx\n", result); |
| 1231 | TRACE_ALWAYS("write fails with 0x%08" B_PRIx32 "\n", result); |
1232 | 1232 | return result; |
1233 | 1233 | } |
1234 | 1234 | |
… |
… |
init_driver()
|
1270 | 1270 | status_t result = get_module(B_USB_MODULE_NAME, |
1271 | 1271 | (module_info **)&gUSBModule); |
1272 | 1272 | if (result < B_OK) { |
1273 | | TRACE_ALWAYS("getting module failed 0x%08lx\n", result); |
| 1273 | TRACE_ALWAYS("getting module failed 0x%08" B_PRIx32 "\n", result); |
1274 | 1274 | mutex_destroy(&gDeviceListLock); |
1275 | 1275 | return result; |
1276 | 1276 | } |