VirtualBox

Changeset 81804 in vbox


Ignore:
Timestamp:
Nov 12, 2019 2:43:17 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134595
Message:

DevBusLogic.cpp: Converting it to the new PDM device style - eliminated the wake-up queue. Simplifed/fixed device naming. bugref:9218

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevBusLogic.cpp

    r81803 r81804  
    127127    /** Number of outstanding tasks on the port. */
    128128    volatile uint32_t               cOutstandingRequests;
    129 
    130 #if HC_ARCH_BITS == 64
    131     uint32_t                        u32Alignment1;
    132 #endif
     129    /** The device name. */
     130    char                            szName[12];
    133131} BUSLOGICDEVICE, *PBUSLOGICDEVICE;
    134132
     
    437435    /** Whether the extended LUN CCB format is enabled for 32 possible logical units. */
    438436    bool                            fExtendedLunCCBFormat;
    439 
    440     /** Queue to send tasks to R3. - HC ptr */
    441     R3PTRTYPE(PPDMQUEUE)            pNotifierQueueR3;
    442     /** Queue to send tasks to R3. - HC ptr */
    443     R0PTRTYPE(PPDMQUEUE)            pNotifierQueueR0;
    444     /** Queue to send tasks to R3. - RC ptr */
    445     RCPTRTYPE(PPDMQUEUE)            pNotifierQueueRC;
    446 
    447     uint32_t                        Alignment2;
     437    bool                            afAlignment2[2];
    448438
    449439    /** Critical section protecting access to the interrupt status register. */
     
    24792469                    if (!ASMAtomicXchgBool(&pBusLogic->fNotificationSent, true))
    24802470                    {
    2481                         /* Send new notification to the queue. */
    2482                         PPDMQUEUEITEMCORE pItem = PDMQueueAlloc(pBusLogic->CTX_SUFF(pNotifierQueue));
    2483                         AssertMsg(pItem, ("Allocating item for queue failed\n"));
    2484                         PDMQueueInsert(pBusLogic->CTX_SUFF(pNotifierQueue), (PPDMQUEUEITEMCORE)pItem);
     2471                        /* Wake up the worker thread. */
     2472                        int rc2 = PDMDevHlpSUPSemEventSignal(pDevIns, pBusLogic->hEvtProcess);
     2473                        AssertRC(rc2);
    24852474                    }
    24862475                }
     
    28402829    {
    28412830        ASMAtomicXchgBool(&pThis->fBiosReqPending, true);
    2842         /* Send a notifier to the PDM queue that there are pending requests. */
    2843         PPDMQUEUEITEMCORE pItem = PDMQueueAlloc(pThis->CTX_SUFF(pNotifierQueue));
    2844         AssertMsg(pItem, ("Allocating item for queue failed\n"));
    2845         PDMQueueInsert(pThis->CTX_SUFF(pNotifierQueue), (PPDMQUEUEITEMCORE)pItem);
     2831        /* Wake up the worker thread now that there are pending requests. */
     2832        int rc2 = PDMDevHlpSUPSemEventSignal(pDevIns, pThis->hEvtProcess);
     2833        AssertRC(rc2);
    28462834        rc = VINF_SUCCESS;
    28472835    }
     
    28742862    {
    28752863        ASMAtomicXchgBool(&pThis->fBiosReqPending, true);
    2876         /* Send a notifier to the PDM queue that there are pending requests. */
    2877         PPDMQUEUEITEMCORE pItem = PDMQueueAlloc(pThis->CTX_SUFF(pNotifierQueue));
    2878         AssertMsg(pItem, ("Allocating item for queue failed\n"));
    2879         PDMQueueInsert(pThis->CTX_SUFF(pNotifierQueue), (PPDMQUEUEITEMCORE)pItem);
     2864        /* Wake up the worker thread now taht there are pending requests. */
     2865        int rc2 = PDMDevHlpSUPSemEventSignal(pDevIns, pThis->hEvtProcess);
     2866        AssertRC(rc2);
    28802867    }
    28812868    else if (RT_FAILURE(rc))
     
    41604147
    41614148    pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    4162     pThis->pNotifierQueueRC = PDMQueueRCPtr(pThis->pNotifierQueueR3);
    41634149
    41644150    for (uint32_t i = 0; i < BUSLOGIC_MAX_DEVICES; i++)
     
    43364322        return PDMDEV_SET_ERROR(pDevIns, rc, N_("BusLogic cannot register ISA I/O handlers"));
    43374323
    4338     /* Initialize task queue. */
    4339     rc = PDMDevHlpQueueCreate(pDevIns, sizeof(PDMQUEUEITEMCORE), 5, 0,
    4340                               buslogicR3NotifyQueueConsumer, true, "BusLogicTask", &pThis->pNotifierQueueR3);
    4341     if (RT_FAILURE(rc))
    4342         return rc;
    4343     pThis->pNotifierQueueR0 = PDMQueueR0Ptr(pThis->pNotifierQueueR3);
    4344     pThis->pNotifierQueueRC = PDMQueueRCPtr(pThis->pNotifierQueueR3);
    4345 
     4324
     4325    /* Init the interrupt critsect. */
    43464326    rc = PDMDevHlpCritSectInit(pDevIns, &pThis->CritSectIntr, RT_SRC_POS, "BusLogic-Intr#%u", pDevIns->iInstance);
    43474327    if (RT_FAILURE(rc))
     
    43684348    for (unsigned i = 0; i < RT_ELEMENTS(pThis->aDeviceStates); i++)
    43694349    {
    4370         char szName[24];
    43714350        PBUSLOGICDEVICE pDevice = &pThis->aDeviceStates[i];
    4372 
    4373         char *pszName;
    4374         if (RTStrAPrintf(&pszName, "Device%u", i) < 0)
    4375             AssertLogRelFailedReturn(VERR_NO_MEMORY);
    43764351
    43774352        /* Initialize static parts of the device. */
     
    43914366        pDevice->IMediaExPort.pfnMediumEjected           = buslogicR3MediumEjected;
    43924367        pDevice->ILed.pfnQueryStatusLed                  = buslogicR3DeviceQueryStatusLed;
     4368        RTStrPrintf(pDevice->szName, sizeof(pDevice->szName), "Device%u", i);
    43934369
    43944370        /* Attach SCSI driver. */
    4395         rc = PDMDevHlpDriverAttach(pDevIns, pDevice->iLUN, &pDevice->IBase, &pDevice->pDrvBase, pszName);
     4371        rc = PDMDevHlpDriverAttach(pDevIns, pDevice->iLUN, &pDevice->IBase, &pDevice->pDrvBase, pDevice->szName);
    43964372        if (RT_SUCCESS(rc))
    43974373        {
     
    44234399            pDevice->pDrvMediaEx = NULL;
    44244400            rc = VINF_SUCCESS;
    4425             Log(("BusLogic: no driver attached to device %s\n", szName));
     4401            Log(("BusLogic: no driver attached to device %s\n", pDevice->szName));
    44264402        }
    44274403        else
    44284404        {
    4429             AssertLogRelMsgFailed(("BusLogic: Failed to attach %s\n", szName));
     4405            AssertLogRelMsgFailed(("BusLogic: Failed to attach %s\n", pDevice->szName));
    44304406            return rc;
    44314407        }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette