VirtualBox

Changeset 81777 in vbox for trunk/src/VBox/Devices/Storage


Ignore:
Timestamp:
Nov 11, 2019 7:58:22 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134568
Message:

DevLsiLogicSCSI: Removed GCPhysMMIOBase (forgot earlier) amd aligned the member names on tab stops (was driving me nuts). bugref:9218

File:
1 edited

Legend:

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

    r81774 r81777  
    6565
    6666/** Maximum number of entries in the release log. */
    67 #define MAX_REL_LOG_ERRORS 1024
    68 
    69 #define LSILOGIC_RTGCPHYS_FROM_U32(Hi, Lo)         ( (RTGCPHYS)RT_MAKE_U64(Lo, Hi) )
     67#define MAX_REL_LOG_ERRORS                          1024
     68
     69#define LSILOGIC_RTGCPHYS_FROM_U32(Hi, Lo)          ( (RTGCPHYS)RT_MAKE_U64(Lo, Hi) )
    7070
    7171/** Upper number a buffer is freed if it was too big before. */
    72 #define LSILOGIC_MAX_ALLOC_TOO_MUCH 20
     72#define LSILOGIC_MAX_ALLOC_TOO_MUCH                 20
    7373
    7474/** Maximum size of the memory regions (prevents teh guest from DOSing the host by
    7575 * allocating loadds of memory). */
    76 #define LSILOGIC_MEMORY_REGIONS_MAX (_1M)
     76#define LSILOGIC_MEMORY_REGIONS_MAX                 _1M
    7777
    7878
     
    111111{
    112112    /** Lower 32 bits of the reply address in memory. */
    113     uint32_t      u32HostMFALowAddress;
     113    uint32_t        u32HostMFALowAddress;
    114114    /** Full address of the reply in guest memory. */
    115     RTGCPHYS      GCPhysReplyAddress;
     115    RTGCPHYS        GCPhysReplyAddress;
    116116    /** Size of the reply. */
    117     uint32_t      cbReply;
     117    uint32_t        cbReply;
    118118    /** Different views to the reply depending on the request type. */
    119     MptReplyUnion Reply;
     119    MptReplyUnion   Reply;
    120120} LSILOGICSCSIREPLY;
    121121/** Pointer to reply data. */
     
    128128{
    129129    /** List node. */
    130     RTLISTNODE    NodeList;
     130    RTLISTNODE      NodeList;
    131131    /** 32bit address the region starts to describe. */
    132     uint32_t      u32AddrStart;
     132    uint32_t        u32AddrStart;
    133133    /** 32bit address the region ends (inclusive). */
    134     uint32_t      u32AddrEnd;
     134    uint32_t        u32AddrEnd;
    135135    /** Data for this region - variable. */
    136     uint32_t      au32Data[1];
     136    uint32_t        au32Data[1];
    137137} LSILOGICMEMREGN;
    138138/** Pointer to a memory region. */
     
    149149{
    150150    /** Pointer to the owning lsilogic device instance. - R3 pointer */
    151     R3PTRTYPE(PLSILOGICSCSI)      pLsiLogicR3;
     151    R3PTRTYPE(PLSILOGICSCSI)    pLsiLogicR3;
    152152
    153153    /** LUN of the device. */
    154     uint32_t                      iLUN;
     154    uint32_t                    iLUN;
    155155    /** Number of outstanding tasks on the port. */
    156     volatile uint32_t             cOutstandingRequests;
     156    volatile uint32_t           cOutstandingRequests;
    157157
    158158#if HC_ARCH_BITS == 64
    159     uint32_t                      Alignment0;
     159    uint32_t                    Alignment0;
    160160#endif
    161161
    162162    /** Our base interface. */
    163     PDMIBASE                      IBase;
     163    PDMIBASE                    IBase;
    164164    /** Media port interface. */
    165     PDMIMEDIAPORT                 IMediaPort;
     165    PDMIMEDIAPORT               IMediaPort;
    166166    /** Extended media port interface. */
    167     PDMIMEDIAEXPORT               IMediaExPort;
     167    PDMIMEDIAEXPORT             IMediaExPort;
    168168    /** Led interface. */
    169     PDMILEDPORTS                  ILed;
     169    PDMILEDPORTS                ILed;
    170170    /** Pointer to the attached driver's base interface. */
    171     R3PTRTYPE(PPDMIBASE)          pDrvBase;
     171    R3PTRTYPE(PPDMIBASE)        pDrvBase;
    172172    /** Pointer to the attached driver's media interface. */
    173     R3PTRTYPE(PPDMIMEDIA)         pDrvMedia;
     173    R3PTRTYPE(PPDMIMEDIA)       pDrvMedia;
    174174    /** Pointer to the attached driver's extended media interface. */
    175     R3PTRTYPE(PPDMIMEDIAEX)       pDrvMediaEx;
     175    R3PTRTYPE(PPDMIMEDIAEX)     pDrvMediaEx;
    176176    /** The status LED state for this device. */
    177     PDMLED                        Led;
     177    PDMLED                      Led;
    178178
    179179} LSILOGICDEVICE;
     
    184184typedef struct LSILOGICREQ *PLSILOGICREQ;
    185185
    186 /**
    187  * Device instance data for the emulated SCSI controller.
     186
     187/**
     188 * Shared instance data for the LsiLogic emulation.
    188189 */
    189190typedef struct LSILOGICSCSI
    190191{
    191192    /** Pointer to the device instance. - R3 ptr. */
    192     PPDMDEVINSR3         pDevInsR3;
     193    PPDMDEVINSR3                pDevInsR3;
    193194    /** Pointer to the device instance. - R0 ptr. */
    194     PPDMDEVINSR0         pDevInsR0;
     195    PPDMDEVINSR0                pDevInsR0;
    195196    /** Pointer to the device instance. - RC ptr. */
    196     PPDMDEVINSRC         pDevInsRC;
     197    PPDMDEVINSRC                pDevInsRC;
    197198
    198199    /** Flag whether the GC part of the device is enabled. */
    199     bool                 fGCEnabled;
     200    bool                        fGCEnabled;
    200201    /** Flag whether the R0 part of the device is enabled. */
    201     bool                 fR0Enabled;
    202     bool                 afPaddingMinus1[2+4];
     202    bool                        fR0Enabled;
     203    bool                        afPaddingMinus1[2+4];
    203204
    204205    /** The state the controller is currently in. */
    205     LSILOGICSTATE        enmState;
     206    LSILOGICSTATE               enmState;
    206207    /** Who needs to init the driver to get into operational state. */
    207     LSILOGICWHOINIT      enmWhoInit;
     208    LSILOGICWHOINIT             enmWhoInit;
    208209    /** Flag whether we are in doorbell function. */
    209     LSILOGICDOORBELLSTATE enmDoorbellState;
     210    LSILOGICDOORBELLSTATE       enmDoorbellState;
    210211    /** Flag whether diagnostic access is enabled. */
    211     bool                 fDiagnosticEnabled;
     212    bool                        fDiagnosticEnabled;
    212213    /** Flag whether a notification was send to R3. */
    213     bool                 fNotificationSent;
     214    bool                        fNotificationSent;
    214215    /** Flag whether the guest enabled event notification from the IOC. */
    215     bool                 fEventNotificationEnabled;
     216    bool                        fEventNotificationEnabled;
    216217    /** Flag whether the diagnostic address and RW registers are enabled. */
    217     bool                 fDiagRegsEnabled;
     218    bool                        fDiagRegsEnabled;
    218219
    219220    /** Number of device states allocated. */
    220     uint32_t             cDeviceStates;
     221    uint32_t                    cDeviceStates;
    221222
    222223    /** States for attached devices. */
    223     R3PTRTYPE(PLSILOGICDEVICE) paDeviceStates;
     224    R3PTRTYPE(PLSILOGICDEVICE)  paDeviceStates;
    224225#if HC_ARCH_BITS == 32
    225     RTR3PTR                 R3PtrPadding0;
     226    RTR3PTR                     R3PtrPadding0;
    226227#endif
    227228
    228229    /** Interrupt mask. */
    229     volatile uint32_t     uInterruptMask;
     230    volatile uint32_t           uInterruptMask;
    230231    /** Interrupt status register. */
    231     volatile uint32_t     uInterruptStatus;
     232    volatile uint32_t           uInterruptStatus;
    232233
    233234    /** Buffer for messages which are passed through the doorbell using the
    234235     * handshake method. */
    235     uint32_t              aMessage[sizeof(MptConfigurationRequest)]; /** @todo r=bird: Looks like 4 tims the required size? Please explain in comment if this correct... */
     236    uint32_t                    aMessage[sizeof(MptConfigurationRequest)]; /** @todo r=bird: Looks like 4 times the required size? Please explain in comment if this correct... */
    236237    /** Actual position in the buffer. */
    237     uint32_t              iMessage;
     238    uint32_t                    iMessage;
    238239    /** Size of the message which is given in the doorbell message in dwords. */
    239     uint32_t              cMessage;
     240    uint32_t                    cMessage;
    240241
    241242    /** Reply buffer.
    242243     * @note 60 bytes  */
    243     MptReplyUnion         ReplyBuffer;
     244    MptReplyUnion               ReplyBuffer;
    244245    /** Next entry to read. */
    245     uint32_t              uNextReplyEntryRead;
     246    uint32_t                    uNextReplyEntryRead;
    246247    /** Size of the reply in the buffer in 16bit words. */
    247     uint32_t              cReplySize;
     248    uint32_t                    cReplySize;
    248249
    249250    /** The fault code of the I/O controller if we are in the fault state. */
    250     uint16_t              u16IOCFaultCode;
    251     uint16_t              u16Padding0b;
    252 
    253     /** MMIO address the device is mapped to. */
    254     RTGCPHYS              GCPhysMMIOBase;
     251    uint16_t                    u16IOCFaultCode;
     252    uint16_t                    u16Padding0b;
    255253
    256254    /** Upper 32 bits of the message frame address to locate requests in guest memory. */
    257     uint32_t              u32HostMFAHighAddr;
     255    uint32_t                    u32HostMFAHighAddr;
    258256    /** Upper 32 bits of the sense buffer address. */
    259     uint32_t              u32SenseBufferHighAddr;
     257    uint32_t                    u32SenseBufferHighAddr;
    260258    /** Maximum number of devices the driver reported he can handle. */
    261     uint8_t               cMaxDevices;
    262     /** Maximum number of buses the driver reported he can handle. */
    263     uint8_t               cMaxBuses;
     259    uint8_t                     cMaxDevices;
     260    /** Maximum number of       buses the driver reported he can handle. */
     261    uint8_t                     cMaxBuses;
    264262    /** Current size of reply message frames in the guest. */
    265     uint16_t              cbReplyFrame;
     263    uint16_t                    cbReplyFrame;
    266264
    267265    /** Next key to write in the sequence to get access
    268266     *  to diagnostic memory. */
    269     uint32_t              iDiagnosticAccess;
     267    uint32_t                    iDiagnosticAccess;
    270268
    271269    /** Number entries configured for the reply queue. */
    272     uint32_t              cReplyQueueEntries;
     270    uint32_t                    cReplyQueueEntries;
    273271    /** Number entries configured for the outstanding request queue. */
    274     uint32_t              cRequestQueueEntries;
     272    uint32_t                    cRequestQueueEntries;
    275273
    276274    /** Critical section protecting the reply post queue. */
    277     PDMCRITSECT           ReplyPostQueueCritSect;
     275    PDMCRITSECT                 ReplyPostQueueCritSect;
    278276    /** Critical section protecting the reply free queue. */
    279     PDMCRITSECT           ReplyFreeQueueCritSect;
     277    PDMCRITSECT                 ReplyFreeQueueCritSect;
    280278    /** Critical section protecting the request queue against
    281279     * concurrent access from the guest. */
    282     PDMCRITSECT           RequestQueueCritSect;
     280    PDMCRITSECT                 RequestQueueCritSect;
    283281    /** Critical section protecting the reply free queue against
    284282     * concurrent write access from the guest. */
    285     PDMCRITSECT           ReplyFreeQueueWriteCritSect;
     283    PDMCRITSECT                 ReplyFreeQueueWriteCritSect;
    286284
    287285    /** The reply free qeueue (only the first cReplyQueueEntries are used). */
    288     uint32_t volatile       aReplyFreeQueue[LSILOGICSCSI_REPLY_QUEUE_DEPTH_MAX];
     286    uint32_t volatile           aReplyFreeQueue[LSILOGICSCSI_REPLY_QUEUE_DEPTH_MAX];
    289287    /** The reply post qeueue (only the first cReplyQueueEntries are used). */
    290     uint32_t volatile       aReplyPostQueue[LSILOGICSCSI_REPLY_QUEUE_DEPTH_MAX];
     288    uint32_t volatile           aReplyPostQueue[LSILOGICSCSI_REPLY_QUEUE_DEPTH_MAX];
    291289    /** The request qeueue (only the first cRequestQueueEntries are used). */
    292     uint32_t volatile       aRequestQueue[LSILOGICSCSI_REQUEST_QUEUE_DEPTH_MAX];
     290    uint32_t volatile           aRequestQueue[LSILOGICSCSI_REQUEST_QUEUE_DEPTH_MAX];
    293291
    294292    /** Next free entry in the reply queue the guest can write a address to. */
    295     volatile uint32_t              uReplyFreeQueueNextEntryFreeWrite;
     293    volatile uint32_t           uReplyFreeQueueNextEntryFreeWrite;
    296294    /** Next valid entry the controller can read a valid address for reply frames from. */
    297     volatile uint32_t              uReplyFreeQueueNextAddressRead;
     295    volatile uint32_t           uReplyFreeQueueNextAddressRead;
    298296
    299297    /** Next free entry in the reply queue the guest can write a address to. */
    300     volatile uint32_t              uReplyPostQueueNextEntryFreeWrite;
     298    volatile uint32_t           uReplyPostQueueNextEntryFreeWrite;
    301299    /** Next valid entry the controller can read a valid address for reply frames from. */
    302     volatile uint32_t              uReplyPostQueueNextAddressRead;
     300    volatile uint32_t           uReplyPostQueueNextAddressRead;
    303301
    304302    /** Next free entry the guest can write a address to a request frame to. */
    305     volatile uint32_t              uRequestQueueNextEntryFreeWrite;
     303    volatile uint32_t           uRequestQueueNextEntryFreeWrite;
    306304    /** Next valid entry the controller can read a valid address for request frames from. */
    307     volatile uint32_t              uRequestQueueNextAddressRead;
     305    volatile uint32_t           uRequestQueueNextAddressRead;
    308306
    309307    /** Emulated controller type */
    310     LSILOGICCTRLTYPE               enmCtrlType;
     308    LSILOGICCTRLTYPE            enmCtrlType;
    311309    /** Handle counter */
    312     uint16_t                       u16NextHandle;
     310    uint16_t                    u16NextHandle;
    313311
    314312    /** Number of ports this controller has. */
    315     uint8_t                        cPorts;
     313    uint8_t                     cPorts;
    316314
    317315    /** BIOS emulation. */
    318     VBOXSCSI                       VBoxSCSI;
     316    VBOXSCSI                    VBoxSCSI;
    319317
    320318    /** Status LUN: The base interface. */
    321     PDMIBASE                       IBase;
     319    PDMIBASE                    IBase;
    322320    /** Status LUN: Leds interface. */
    323     PDMILEDPORTS                   ILeds;
     321    PDMILEDPORTS                ILeds;
    324322    /** Status LUN: Partner of ILeds. */
    325     R3PTRTYPE(PPDMILEDCONNECTORS)  pLedsConnector;
     323    R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector;
    326324    /** Status LUN: Media Notifys. */
    327     R3PTRTYPE(PPDMIMEDIANOTIFY)    pMediaNotify;
     325    R3PTRTYPE(PPDMIMEDIANOTIFY) pMediaNotify;
    328326    /** Pointer to the configuration page area. */
    329327    R3PTRTYPE(PMptConfigurationPagesSupported) pConfigurationPages;
     
    331329    /** Indicates that PDMDevHlpAsyncNotificationCompleted should be called when
    332330     * a port is entering the idle state. */
    333     bool volatile                    fSignalIdle;
     331    bool volatile               fSignalIdle;
    334332    /** Flag whether we have tasks which need to be processed again- */
    335     bool volatile                    fRedo;
     333    bool volatile               fRedo;
    336334    /** Flag whether the worker thread is sleeping. */
    337     volatile bool                    fWrkThreadSleeping;
     335    volatile bool               fWrkThreadSleeping;
    338336    /** Flag whether a request from the BIOS is pending which the
    339337     * worker thread needs to process. */
    340     volatile bool                    fBiosReqPending;
     338    volatile bool               fBiosReqPending;
    341339#if HC_ARCH_BITS == 64
    342340    /** Alignment padding. */
    343     bool                             afPadding2[4];
     341    bool                        afPadding2[4];
    344342#endif
    345343    /** List of tasks which can be redone. */
     
    347345
    348346    /** Current address to read from or write to in the diagnostic memory region. */
    349     uint32_t                         u32DiagMemAddr;
     347    uint32_t                    u32DiagMemAddr;
    350348    /** Current size of the memory regions. */
    351     uint32_t                         cbMemRegns;
     349    uint32_t                    cbMemRegns;
    352350
    353351#if HC_ARCH_BITS ==32
    354     uint32_t                         u32Padding3;
     352    uint32_t                    u32Padding3;
    355353#endif
    356354
     
    358356    {
    359357        /** List of memory regions - PLSILOGICMEMREGN. */
    360         RTLISTANCHOR                 ListMemRegns;
    361         uint8_t                      u8Padding[2 * sizeof(RTUINTPTR)];
     358        RTLISTANCHOR            ListMemRegns;
     359        uint8_t                 u8Padding[2 * sizeof(RTUINTPTR)];
    362360    };
    363361
    364362    /** Worker thread. */
    365     R3PTRTYPE(PPDMTHREAD)            pThreadWrk;
     363    R3PTRTYPE(PPDMTHREAD)       pThreadWrk;
    366364    /** The event semaphore the processing thread waits on. */
    367     SUPSEMEVENT                      hEvtProcess;
     365    SUPSEMEVENT                 hEvtProcess;
    368366
    369367    /** PCI Region \#0: I/O ports register access. */
    370     IOMIOPORTHANDLE                 hIoPortsReg;
     368    IOMIOPORTHANDLE             hIoPortsReg;
    371369    /** PCI Region \#1: MMIO register access. */
    372     IOMMMIOHANDLE                   hMmioReg;
     370    IOMMMIOHANDLE               hMmioReg;
    373371    /** PCI Region \#2: MMIO diag. */
    374     IOMMMIOHANDLE                   hMmioDiag;
     372    IOMMMIOHANDLE               hMmioDiag;
    375373    /** ISA Ports for the BIOS (when booting is configured). */
    376     IOMIOPORTHANDLE                 hIoPortsBios;
     374    IOMIOPORTHANDLE             hIoPortsBios;
    377375} LSILOGISCSI;
     376
    378377
    379378/**
     
    384383{
    385384    /** I/O request handle. */
    386     PDMMEDIAEXIOREQ            hIoReq;
     385    PDMMEDIAEXIOREQ             hIoReq;
    387386    /** Next in the redo list. */
    388     PLSILOGICREQ               pRedoNext;
     387    PLSILOGICREQ                pRedoNext;
    389388    /** Target device. */
    390     PLSILOGICDEVICE            pTargetDevice;
     389    PLSILOGICDEVICE             pTargetDevice;
    391390    /** The message request from the guest. */
    392     MptRequestUnion            GuestRequest;
     391    MptRequestUnion             GuestRequest;
    393392    /** Address of the message request frame in guests memory.
    394393     *  Used to read the S/G entries in the second step. */
    395     RTGCPHYS                   GCPhysMessageFrameAddr;
     394    RTGCPHYS                    GCPhysMessageFrameAddr;
    396395    /** Physical start address of the S/G list. */
    397     RTGCPHYS                   GCPhysSgStart;
     396    RTGCPHYS                    GCPhysSgStart;
    398397    /** Chain offset */
    399     uint32_t                   cChainOffset;
     398    uint32_t                    cChainOffset;
    400399    /** Pointer to the sense buffer. */
    401     uint8_t                    abSenseBuffer[18];
     400    uint8_t                     abSenseBuffer[18];
    402401    /** Flag whether the request was issued from the BIOS. */
    403     bool                       fBIOS;
     402    bool                        fBIOS;
    404403    /** SCSI status code. */
    405     uint8_t                    u8ScsiSts;
     404    uint8_t                     u8ScsiSts;
    406405} LSILOGICREQ;
    407406
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