Changeset 70685 in vbox
- Timestamp:
- Jan 22, 2018 7:27:21 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 120421
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmstorageifs.h
r69475 r70685 227 227 uint32_t *piInstance, uint32_t *piLUN)); 228 228 229 230 /** 231 * Queries the vendor and product ID and revision to report for INQUIRY commands in underlying devices. 232 * 233 * @returns VBox status code. 234 * @param pInterface Pointer to this interface. 235 * @param ppszVendorId Where to store the pointer to the vendor ID string to report. 236 * @param ppszProductId Where to store the pointer to the product ID string to report. 237 * @param ppszRevision Where to store the pointer to the revision string to report. 238 * 239 * @note The strings for the inquiry data are stored in the storage controller rather than in the device 240 * because if device attachments change (virtual CD/DVD drive versus host drive) there is currently no 241 * way to keep the INQUIRY data in extradata keys without causing trouble when the attachment is changed. 242 * Also Main currently doesn't has any settings for the attachment to store such information in the settings 243 * properly. Last reason (but not the most important one) is to stay compatible with older versions 244 * where the drive emulation was in AHCI but it now uses VSCSI and the settings overwrite should still work. 245 */ 246 DECLR3CALLBACKMEMBER(int, pfnQueryScsiInqStrings, (PPDMIMEDIAPORT pInterface, const char **ppszVendorId, 247 const char **ppszProductId, const char **ppszRevision)); 248 229 249 } PDMIMEDIAPORT; 230 250 /** PDMIMEDIAPORT interface ID. */ 231 #define PDMIMEDIAPORT_IID " 9f7e8c9e-6d35-4453-bbef-1f78033174d6"251 #define PDMIMEDIAPORT_IID "77180ab8-6485-454f-b440-efca322b7bd7" 232 252 233 253 /** Pointer to a media interface. */ -
trunk/src/VBox/Devices/Storage/DevAHCI.cpp
r69500 r70685 128 128 #define AHCI_FIRMWARE_REVISION_LENGTH 8 129 129 #define AHCI_MODEL_NUMBER_LENGTH 40 130 #define AHCI_ATAPI_INQUIRY_VENDOR_ID_LENGTH 8 131 #define AHCI_ATAPI_INQUIRY_PRODUCT_ID_LENGTH 16 132 #define AHCI_ATAPI_INQUIRY_REVISION_LENGTH 4 130 133 131 134 /** ATAPI sense info size. */ … … 431 434 /** The model number to use for IDENTIFY DEVICE commands. */ 432 435 char szModelNumber[AHCI_MODEL_NUMBER_LENGTH+1]; /** < one extra byte for termination */ 436 /** The vendor identification string for SCSI INQUIRY commands. */ 437 char szInquiryVendorId[AHCI_ATAPI_INQUIRY_VENDOR_ID_LENGTH+1]; 438 /** The product identification string for SCSI INQUIRY commands. */ 439 char szInquiryProductId[AHCI_ATAPI_INQUIRY_PRODUCT_ID_LENGTH+1]; 440 /** The revision string for SCSI INQUIRY commands. */ 441 char szInquiryRevision[AHCI_ATAPI_INQUIRY_REVISION_LENGTH+1]; 433 442 /** Error counter */ 434 443 uint32_t cErrors; … … 2615 2624 *piLUN = pAhciPort->iLUN; 2616 2625 2626 return VINF_SUCCESS; 2627 } 2628 2629 /** 2630 * @interface_method_impl{PDMIMEDIAPORT,pfnQueryScsiInqStrings} 2631 */ 2632 static DECLCALLBACK(int) ahciR3PortQueryScsiInqStrings(PPDMIMEDIAPORT pInterface, const char **ppszVendorId, 2633 const char **ppszProductId, const char **ppszRevision) 2634 { 2635 PAHCIPort pAhciPort = PDMIMEDIAPORT_2_PAHCIPORT(pInterface); 2636 2637 if (ppszVendorId) 2638 *ppszVendorId = &pAhciPort->szInquiryVendorId[0]; 2639 if (ppszProductId) 2640 *ppszProductId = &pAhciPort->szInquiryProductId[0]; 2641 if (ppszRevision) 2642 *ppszRevision = &pAhciPort->szInquiryRevision[0]; 2617 2643 return VINF_SUCCESS; 2618 2644 } … … 5510 5536 N_("AHCI configuration error: \"LogicalSectorsPerPhysical\" must be between 0 and 15")); 5511 5537 5538 /* There are three other identification strings for CD drives used for INQUIRY */ 5539 if (pAhciPort->fATAPI) 5540 { 5541 rc = CFGMR3QueryStringDef(pCfgNode, "ATAPIVendorId", pAhciPort->szInquiryVendorId, sizeof(pAhciPort->szInquiryVendorId), 5542 "VBOX"); 5543 if (RT_FAILURE(rc)) 5544 { 5545 if (rc == VERR_CFGM_NOT_ENOUGH_SPACE) 5546 return PDMDEV_SET_ERROR(pDevIns, VERR_INVALID_PARAMETER, 5547 N_("AHCI configuration error: \"ATAPIVendorId\" is longer than 16 bytes")); 5548 return PDMDEV_SET_ERROR(pDevIns, rc, 5549 N_("AHCI configuration error: failed to read \"ATAPIVendorId\" as string")); 5550 } 5551 5552 rc = CFGMR3QueryStringDef(pCfgNode, "ATAPIProductId", pAhciPort->szInquiryProductId, sizeof(pAhciPort->szInquiryProductId), 5553 "CD-ROM"); 5554 if (RT_FAILURE(rc)) 5555 { 5556 if (rc == VERR_CFGM_NOT_ENOUGH_SPACE) 5557 return PDMDEV_SET_ERROR(pDevIns, VERR_INVALID_PARAMETER, 5558 N_("AHCI configuration error: \"ATAPIProductId\" is longer than 16 bytes")); 5559 return PDMDEV_SET_ERROR(pDevIns, rc, 5560 N_("AHCI configuration error: failed to read \"ATAPIProductId\" as string")); 5561 } 5562 5563 rc = CFGMR3QueryStringDef(pCfgNode, "ATAPIRevision", pAhciPort->szInquiryRevision, sizeof(pAhciPort->szInquiryRevision), 5564 "1.0"); 5565 if (RT_FAILURE(rc)) 5566 { 5567 if (rc == VERR_CFGM_NOT_ENOUGH_SPACE) 5568 return PDMDEV_SET_ERROR(pDevIns, VERR_INVALID_PARAMETER, 5569 N_("AHCI configuration error: \"ATAPIRevision\" is longer than 4 bytes")); 5570 return PDMDEV_SET_ERROR(pDevIns, rc, 5571 N_("AHCI configuration error: failed to read \"ATAPIRevision\" as string")); 5572 } 5573 } 5574 5512 5575 return rc; 5513 5576 } … … 6052 6115 pAhciPort->IMediaExPort.pfnMediumEjected = ahciR3MediumEjected; 6053 6116 pAhciPort->IPort.pfnQueryDeviceLocation = ahciR3PortQueryDeviceLocation; 6117 pAhciPort->IPort.pfnQueryScsiInqStrings = ahciR3PortQueryScsiInqStrings; 6054 6118 pAhciPort->fWrkThreadSleeping = true; 6055 6119 -
trunk/src/VBox/Devices/Storage/DrvHostDVD.cpp
r69500 r70685 53 53 /** ATAPI sense data. */ 54 54 uint8_t abATAPISense[ATAPI_SENSE_SIZE]; 55 /** Flag whether to overwrite the inquiry data with our emulated settings. */ 56 bool fInquiryOverwrite; 55 57 } DRVHOSTDVD; 56 58 /** Pointer to the host DVD driver instance data. */ … … 347 349 Assert(cbXferCur <= cbXfer); 348 350 349 if (pbCdb[0] == SCSI_INQUIRY) 351 if ( pbCdb[0] == SCSI_INQUIRY 352 && pThis->fInquiryOverwrite) 350 353 { 354 const char *pszInqVendorId = "VBOX"; 355 const char *pszInqProductId = "CD-ROM"; 356 const char *pszInqRevision = "1.0"; 357 358 if (pThis->Core.pDrvMediaPort->pfnQueryScsiInqStrings) 359 { 360 rc = pThis->Core.pDrvMediaPort->pfnQueryScsiInqStrings(pThis->Core.pDrvMediaPort, &pszInqVendorId, 361 &pszInqProductId, &pszInqRevision); 362 AssertRC(rc); 363 } 351 364 /* Make sure that the real drive cannot be identified. 352 365 * Motivation: changing the VM configuration should be as 353 366 * invisible as possible to the guest. */ 354 367 if (cbXferCur >= 8 + 8) 355 scsiPadStr((uint8_t *)pvBuf + 8, "VBOX", 8);368 scsiPadStr((uint8_t *)pvBuf + 8, pszInqVendorId, 8); 356 369 if (cbXferCur >= 16 + 16) 357 scsiPadStr((uint8_t *)pvBuf + 16, "CD-ROM", 16);370 scsiPadStr((uint8_t *)pvBuf + 16, pszInqProductId, 16); 358 371 if (cbXferCur >= 32 + 4) 359 scsiPadStr((uint8_t *)pvBuf + 32, "1.0", 4);372 scsiPadStr((uint8_t *)pvBuf + 32, pszInqRevision, 4); 360 373 } 361 374 … … 433 446 LogFlow(("drvHostDvdConstruct: iInstance=%d\n", pDrvIns->iInstance)); 434 447 448 int rc = CFGMR3QueryBoolDef(pCfg, "InquiryOverwrite", &pThis->fInquiryOverwrite, true); 449 if (RT_FAILURE(rc)) 450 return PDMDRV_SET_ERROR(pDrvIns, rc, 451 N_("HostDVD configuration error: failed to read \"InquiryOverwrite\" as boolean")); 452 435 453 bool fPassthrough; 436 intrc = CFGMR3QueryBool(pCfg, "Passthrough", &fPassthrough);454 rc = CFGMR3QueryBool(pCfg, "Passthrough", &fPassthrough); 437 455 if (RT_SUCCESS(rc) && fPassthrough) 438 456 { … … 448 466 * Init instance data. 449 467 */ 450 rc = DRVHostBaseInit(pDrvIns, pCfg, "Path\0Interval\0Locked\0BIOSVisible\0AttachFailError\0Passthrough\0 ",468 rc = DRVHostBaseInit(pDrvIns, pCfg, "Path\0Interval\0Locked\0BIOSVisible\0AttachFailError\0Passthrough\0InquiryOverwrite\0", 451 469 PDMMEDIATYPE_DVD); 452 470 LogFlow(("drvHostDvdConstruct: returns %Rrc\n", rc));
Note:
See TracChangeset
for help on using the changeset viewer.