Changeset 53097 in vbox
- Timestamp:
- Oct 20, 2014 5:37:27 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmusb.h
r53062 r53097 121 121 * a host device. */ 122 122 #define PDM_USBREG_EMULATED_DEVICE RT_BIT(1) 123 /** A SuperSpeed USB 3.0 device. */ 124 #define PDM_USBREG_SUPERSPEED_CAPABLE RT_BIT(2) 123 125 /** @} */ 124 126 -
trunk/src/VBox/Devices/Storage/UsbMsd.cpp
r49814 r53097 143 143 USBMSDREQSTATE enmState; 144 144 /** The size of the data buffer. */ 145 size_tcbBuf;145 uint32_t cbBuf; 146 146 /** Pointer to the data buffer. */ 147 147 uint8_t *pbBuf; … … 342 342 }; 343 343 344 static const VUSBDESCENDPOINTEX g_aUsbMsdEndpointDescsSS[2] = 345 { 346 { 347 { 348 /* .bLength = */ sizeof(VUSBDESCENDPOINT), 349 /* .bDescriptorType = */ VUSB_DT_ENDPOINT, 350 /* .bEndpointAddress = */ 0x81 /* ep=1, in */, 351 /* .bmAttributes = */ 2 /* bulk */, 352 /* .wMaxPacketSize = */ 1024 /* SS bulk packet size */, 353 /* .bInterval = */ 0 /* no NAKs */ 354 }, 355 /* .pvMore = */ NULL, 356 /* .pvClass = */ NULL, 357 /* .cbClass = */ 0 358 }, 359 { 360 { 361 /* .bLength = */ sizeof(VUSBDESCENDPOINT), 362 /* .bDescriptorType = */ VUSB_DT_ENDPOINT, 363 /* .bEndpointAddress = */ 0x02 /* ep=2, out */, 364 /* .bmAttributes = */ 2 /* bulk */, 365 /* .wMaxPacketSize = */ 1024 /* SS bulk packet size */, 366 /* .bInterval = */ 0 /* no NAKs */ 367 }, 368 /* .pvMore = */ NULL, 369 /* .pvClass = */ NULL, 370 /* .cbClass = */ 0 371 } 372 }; 373 344 374 static const VUSBDESCINTERFACEEX g_UsbMsdInterfaceDescFS = 345 375 { … … 384 414 }; 385 415 416 static const VUSBDESCINTERFACEEX g_UsbMsdInterfaceDescSS = 417 { 418 { 419 /* .bLength = */ sizeof(VUSBDESCINTERFACE), 420 /* .bDescriptorType = */ VUSB_DT_INTERFACE, 421 /* .bInterfaceNumber = */ 0, 422 /* .bAlternateSetting = */ 0, 423 /* .bNumEndpoints = */ 2, 424 /* .bInterfaceClass = */ 8 /* Mass Storage */, 425 /* .bInterfaceSubClass = */ 6 /* SCSI transparent command set */, 426 /* .bInterfaceProtocol = */ 0x50 /* Bulk-Only Transport */, 427 /* .iInterface = */ 0 428 }, 429 /* .pvMore = */ NULL, 430 /* .pvClass = */ NULL, 431 /* .cbClass = */ 0, 432 &g_aUsbMsdEndpointDescsSS[0], 433 /* .pIAD = */ NULL, 434 /* .cbIAD = */ 0 435 }; 436 386 437 static const VUSBINTERFACE g_aUsbMsdInterfacesFS[] = 387 438 { … … 392 443 { 393 444 { &g_UsbMsdInterfaceDescHS, /* .cSettings = */ 1 }, 445 }; 446 447 static const VUSBINTERFACE g_aUsbMsdInterfacesSS[] = 448 { 449 { &g_UsbMsdInterfaceDescSS, /* .cSettings = */ 1 }, 394 450 }; 395 451 … … 428 484 }; 429 485 430 static const VUSBDESCDEVICE g_UsbMsdDeviceDesc = 431 { 432 /* .bLength = */ sizeof(g_UsbMsdDeviceDesc), 486 static const VUSBDESCCONFIGEX g_UsbMsdConfigDescSS = 487 { 488 { 489 /* .bLength = */ sizeof(VUSBDESCCONFIG), 490 /* .bDescriptorType = */ VUSB_DT_CONFIG, 491 /* .wTotalLength = */ 0 /* recalculated on read */, 492 /* .bNumInterfaces = */ RT_ELEMENTS(g_aUsbMsdInterfacesSS), 493 /* .bConfigurationValue =*/ 1, 494 /* .iConfiguration = */ 0, 495 /* .bmAttributes = */ RT_BIT(7), 496 /* .MaxPower = */ 50 /* 100mA */ 497 }, 498 NULL, /* pvMore */ 499 &g_aUsbMsdInterfacesSS[0], 500 NULL /* pvOriginal */ 501 }; 502 503 static const VUSBDESCDEVICE g_UsbMsdDeviceDesc20 = 504 { 505 /* .bLength = */ sizeof(g_UsbMsdDeviceDesc20), 433 506 /* .bDescriptorType = */ VUSB_DT_DEVICE, 434 507 /* .bcdUsb = */ 0x200, /* USB 2.0 */ … … 446 519 }; 447 520 521 static const VUSBDESCDEVICE g_UsbMsdDeviceDesc30 = 522 { 523 /* .bLength = */ sizeof(g_UsbMsdDeviceDesc30), 524 /* .bDescriptorType = */ VUSB_DT_DEVICE, 525 /* .bcdUsb = */ 0x300, /* USB 2.0 */ 526 /* .bDeviceClass = */ 0 /* Class specified in the interface desc. */, 527 /* .bDeviceSubClass = */ 0 /* Subclass specified in the interface desc. */, 528 /* .bDeviceProtocol = */ 0 /* Protocol specified in the interface desc. */, 529 /* .bMaxPacketSize0 = */ 9 /* 512, the only option for USB3. */, 530 /* .idVendor = */ VBOX_USB_VENDOR, 531 /* .idProduct = */ USBMSD_PID_HD, 532 /* .bcdDevice = */ 0x0110, /* 1.10 */ 533 /* .iManufacturer = */ USBMSD_STR_ID_MANUFACTURER, 534 /* .iProduct = */ USBMSD_STR_ID_PRODUCT_HD, 535 /* .iSerialNumber = */ 0, 536 /* .bNumConfigurations = */ 1 537 }; 538 448 539 static const VUSBDEVICEQUALIFIER g_UsbMsdDeviceQualifier = 449 540 { … … 461 552 static const PDMUSBDESCCACHE g_UsbMsdDescCacheFS = 462 553 { 463 /* .pDevice = */ &g_UsbMsdDeviceDesc ,554 /* .pDevice = */ &g_UsbMsdDeviceDesc20, 464 555 /* .paConfigs = */ &g_UsbMsdConfigDescFS, 465 556 /* .paLanguages = */ g_aUsbMsdLanguages, … … 471 562 static const PDMUSBDESCCACHE g_UsbMsdDescCacheHS = 472 563 { 473 /* .pDevice = */ &g_UsbMsdDeviceDesc ,564 /* .pDevice = */ &g_UsbMsdDeviceDesc20, 474 565 /* .paConfigs = */ &g_UsbMsdConfigDescHS, 475 566 /* .paLanguages = */ g_aUsbMsdLanguages, … … 479 570 }; 480 571 572 static const PDMUSBDESCCACHE g_UsbMsdDescCacheSS = 573 { 574 /* .pDevice = */ &g_UsbMsdDeviceDesc30, 575 /* .paConfigs = */ &g_UsbMsdConfigDescSS, 576 /* .paLanguages = */ g_aUsbMsdLanguages, 577 /* .cLanguages = */ RT_ELEMENTS(g_aUsbMsdLanguages), 578 /* .fUseCachedDescriptors = */ true, 579 /* .fUseCachedStringsDescriptors = */ true 580 }; 481 581 482 582 /******************************************************************************* … … 702 802 * @param cbBuf The required buffer space. 703 803 */ 704 static int usbMsdReqEnsureBuffer(PUSBMSDREQ pReq, size_t cbBuf)804 static int usbMsdReqEnsureBuffer(PUSBMSDREQ pReq, uint32_t cbBuf) 705 805 { 706 806 if (RT_LIKELY(pReq->cbBuf >= cbBuf)) … … 1053 1153 { 1054 1154 PUSBMSD pThis = PDMINS_2_DATA(pUsbIns, PUSBMSD); 1055 uint32_t i;1056 1155 int rc; 1057 1156 … … 1142 1241 { 1143 1242 AssertPtr(pReq->pbBuf); 1144 Assert(cbBuf = pReq->cbBuf);1243 Assert(cbBuf == pReq->cbBuf); 1145 1244 SSMR3GetMem(pSSM, pReq->pbBuf, pReq->cbBuf); 1146 1245 } … … 1874 1973 PUSBMSD pThis = PDMINS_2_DATA(pUsbIns, PUSBMSD); 1875 1974 LogFlow(("usbMsdUsbGetDescriptorCache/#%u:\n", pUsbIns->iInstance)); 1876 if (pThis->pUsbIns->iUsbHubVersion & VUSB_STDVER_20) 1975 if (pThis->pUsbIns->iUsbHubVersion & VUSB_STDVER_30) 1976 return &g_UsbMsdDescCacheSS; 1977 else if (pThis->pUsbIns->iUsbHubVersion & VUSB_STDVER_20) 1877 1978 return &g_UsbMsdDescCacheHS; 1878 1979 else … … 2125 2226 "USB Mass Storage Device, one LUN.", 2126 2227 /* fFlags */ 2127 PDM_USBREG_HIGHSPEED_CAPABLE | PDM_USBREG_ EMULATED_DEVICE,2228 PDM_USBREG_HIGHSPEED_CAPABLE | PDM_USBREG_SUPERSPEED_CAPABLE | PDM_USBREG_EMULATED_DEVICE, 2128 2229 /* cMaxInstances */ 2129 2230 ~0U, -
trunk/src/VBox/VMM/VMMR3/PDMUsb.cpp
r53062 r53097 227 227 ("Invalid name '%.s'\n", sizeof(pReg->szName), pReg->szName), 228 228 VERR_PDM_INVALID_USB_REGISTRATION); 229 AssertMsgReturn((pReg->fFlags & ~(PDM_USBREG_HIGHSPEED_CAPABLE | PDM_USBREG_ EMULATED_DEVICE)) == 0,229 AssertMsgReturn((pReg->fFlags & ~(PDM_USBREG_HIGHSPEED_CAPABLE | PDM_USBREG_SUPERSPEED_CAPABLE | PDM_USBREG_EMULATED_DEVICE)) == 0, 230 230 ("fFlags=%#x\n", pReg->fFlags), VERR_PDM_INVALID_USB_REGISTRATION); 231 231 AssertMsgReturn(pReg->cMaxInstances > 0, … … 440 440 441 441 for (PPDMUSBHUB pCur = pVM->pdm.s.pUsbHubs; pCur; pCur = pCur->pNext) 442 if ( pCur->cAvailablePorts > 0 443 && ( (pCur->fVersions & iUsbVersion) 444 || pCur->fVersions == VUSB_STDVER_11)) 445 { 446 *ppHub = pCur; 442 if (pCur->cAvailablePorts > 0) 443 { 444 /* First check for an exact match. */ 447 445 if (pCur->fVersions & iUsbVersion) 446 { 447 *ppHub = pCur; 448 448 break; 449 } 450 /* For high-speed USB 2.0 devices only, allow USB 1.1 fallback. */ 451 if ((iUsbVersion & VUSB_STDVER_20) && (pCur->fVersions == VUSB_STDVER_11)) 452 *ppHub = pCur; 449 453 } 450 454 if (*ppHub) … … 828 832 829 833 /* 830 * Every device must support USB 1.x hubs; optionally, high-speed USB 2.0 hubs834 * Every emulated device must support USB 1.x hubs; optionally, high-speed USB 2.0 hubs 831 835 * might be also supported. This determines where to attach the device. 832 836 */ … … 835 839 if (paUsbDevs[i].pUsbDev->pReg->fFlags & PDM_USBREG_HIGHSPEED_CAPABLE) 836 840 iUsbVersion |= VUSB_STDVER_20; 841 if (paUsbDevs[i].pUsbDev->pReg->fFlags & PDM_USBREG_SUPERSPEED_CAPABLE) 842 iUsbVersion |= VUSB_STDVER_30; 837 843 838 844 /* … … 911 917 if (pUsbDev->pReg->fFlags & PDM_USBREG_HIGHSPEED_CAPABLE) 912 918 iUsbVersion |= VUSB_STDVER_20; 919 if (pUsbDev->pReg->fFlags & PDM_USBREG_SUPERSPEED_CAPABLE) 920 iUsbVersion |= VUSB_STDVER_30; 913 921 914 922 /*
Note:
See TracChangeset
for help on using the changeset viewer.