VirtualBox

Changeset 39139 in vbox for trunk/src/VBox/Devices/USB


Ignore:
Timestamp:
Oct 28, 2011 2:30:37 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
74593
Message:

DevOHCI: Use IOMMMIO_FLAGS_READ_DWORD.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/USB/DevOHCI.cpp

    r39136 r39139  
    55
    66/*
    7  * Copyright (C) 2006-2009 Oracle Corporation
     7 * Copyright (C) 2006-2011 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    115115
    116116
    117 /* Number of Downstream Ports on the root hub, if you change this
    118  * you need to add more status register words to the 'opreg' array
     117/** Number of Downstream Ports on the root hub.
     118 * If you change this you need to add more status register words to the 'opreg'
     119 * array.
    119120 */
    120121#define OHCI_NDP 8
     
    122123/** Pointer to OHCI device data. */
    123124typedef struct OHCI *POHCI;
     125/** Read-only pointer to the OHCI device data. */
     126typedef struct OHCI const *PCOHCI;
    124127
    125128
     
    536539{
    537540    const char *pszName;
    538     int (*pfnRead )(POHCI ohci, uint32_t iReg, uint32_t *pu32Value);
    539     int (*pfnWrite)(POHCI ohci, uint32_t iReg, uint32_t u32Value);
     541    int (*pfnRead )(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value);
     542    int (*pfnWrite)(POHCI pThis, uint32_t iReg, uint32_t u32Value);
    540543} OHCIOPREG;
    541544
     
    37783781 * Read the HcRevision register.
    37793782 */
    3780 static int HcRevision_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     3783static int HcRevision_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    37813784{
    37823785    Log2(("HcRevision_r() -> 0x10\n"));
     
    37983801 * Read the HcControl register.
    37993802 */
    3800 static int HcControl_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     3803static int HcControl_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    38013804{
    38023805    uint32_t ctl = pOhci->ctl;
     
    38783881 * Read the HcCommandStatus register.
    38793882 */
    3880 static int HcCommandStatus_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     3883static int HcCommandStatus_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    38813884{
    38823885    uint32_t status = pOhci->status;
     
    39293932 * Read the HcInterruptStatus register.
    39303933 */
    3931 static int HcInterruptStatus_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     3934static int HcInterruptStatus_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    39323935{
    39333936    uint32_t val = pOhci->intr_status;
     
    39713974 * Read the HcInterruptEnable register
    39723975 */
    3973 static int HcInterruptEnable_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     3976static int HcInterruptEnable_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    39743977{
    39753978    uint32_t val = pOhci->intr;
     
    40104013 * Reads the HcInterruptDisable register.
    40114014 */
    4012 static int HcInterruptDisable_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4015static int HcInterruptDisable_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    40134016{
    40144017#if 1 /** @todo r=bird: "On read, the current value of the HcInterruptEnable register is returned." */
     
    40544057 * Read the HcHCCA register (Host Controller Communications Area physical address).
    40554058 */
    4056 static int HcHCCA_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4059static int HcHCCA_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    40574060{
    40584061    Log2(("HcHCCA_r() -> %#010x\n", pOhci->hcca));
     
    40744077 * Read the HcPeriodCurrentED register.
    40754078 */
    4076 static int HcPeriodCurrentED_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4079static int HcPeriodCurrentED_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    40774080{
    40784081    Log2(("HcPeriodCurrentED_r() -> %#010x\n", pOhci->per_cur));
     
    40974100 * Read the HcControlHeadED register.
    40984101 */
    4099 static int HcControlHeadED_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4102static int HcControlHeadED_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    41004103{
    41014104    Log2(("HcControlHeadED_r() -> %#010x\n", pOhci->ctrl_head));
     
    41184121 * Read the HcControlCurrentED register.
    41194122 */
    4120 static int HcControlCurrentED_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4123static int HcControlCurrentED_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    41214124{
    41224125    Log2(("HcControlCurrentED_r() -> %#010x\n", pOhci->ctrl_cur));
     
    41404143 * Read the HcBulkHeadED register.
    41414144 */
    4142 static int HcBulkHeadED_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4145static int HcBulkHeadED_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    41434146{
    41444147    Log2(("HcBulkHeadED_r() -> %#010x\n", pOhci->bulk_head));
     
    41614164 * Read the HcBulkCurrentED register.
    41624165 */
    4163 static int HcBulkCurrentED_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4166static int HcBulkCurrentED_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    41644167{
    41654168    Log2(("HcBulkCurrentED_r() -> %#010x\n", pOhci->bulk_cur));
     
    41844187 * Read the HcDoneHead register.
    41854188 */
    4186 static int HcDoneHead_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4189static int HcDoneHead_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    41874190{
    41884191    Log2(("HcDoneHead_r() -> 0x%#08x\n", pOhci->done));
     
    42054208 * Read the HcFmInterval (Fm=Frame) register.
    42064209 */
    4207 static int HcFmInterval_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4210static int HcFmInterval_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    42084211{
    42094212    uint32_t val = (pOhci->fit << 31) | (pOhci->fsmps << 16) | (pOhci->fi);
     
    42424245 * Read the HcFmRemaining (Fm = Frame) register.
    42434246 */
    4244 static int HcFmRemaining_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4247static int HcFmRemaining_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    42454248{
    42464249    uint32_t Value = pOhci->frt << 31;
     
    42784281 * Read the HcFmNumber (Fm = Frame) register.
    42794282 */
    4280 static int HcFmNumber_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4283static int HcFmNumber_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    42814284{
    42824285    uint32_t val = (uint16_t)pOhci->HcFmNumber;
     
    43004303 * The register determines when in a frame to switch from control&bulk to periodic lists.
    43014304 */
    4302 static int HcPeriodicStart_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4305static int HcPeriodicStart_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    43034306{
    43044307    Log2(("HcPeriodicStart_r() -> %#010x - PS=%d\n", pOhci->pstart, pOhci->pstart & 0x3fff));
     
    43234326 * Read the HcLSThreshold register.
    43244327 */
    4325 static int HcLSThreshold_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4328static int HcLSThreshold_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    43264329{
    43274330    Log2(("HcLSThreshold_r() -> %#010x\n", OHCI_LS_THRESH));
     
    43534356 * Read the HcRhDescriptorA register.
    43544357 */
    4355 static int HcRhDescriptorA_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4358static int HcRhDescriptorA_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    43564359{
    43574360    uint32_t val = pOhci->RootHub.desc_a;
     
    44014404 * Read the HcRhDescriptorB register.
    44024405 */
    4403 static int HcRhDescriptorB_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4406static int HcRhDescriptorB_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    44044407{
    44054408    uint32_t val = pOhci->RootHub.desc_b;
     
    44324435 * Read the HcRhStatus (Rh = Root Hub) register.
    44334436 */
    4434 static int HcRhStatus_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4437static int HcRhStatus_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    44354438{
    44364439    uint32_t val = pOhci->RootHub.status;
     
    45054508 * Read the HcRhPortStatus register of a port.
    45064509 */
    4507 static int HcRhPortStatus_r(POHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4510static int HcRhPortStatus_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    45084511{
    45094512    const unsigned i = iReg - 21;
     
    47904793    POHCI pOhci = PDMINS_2_DATA(pDevIns, POHCI);
    47914794
    4792     /*
    4793      * Validate the access.
    4794      */
    4795     if (cb != sizeof(uint32_t))
    4796     {
    4797         Log2(("ohciRead: Bad read size!!! GCPhysAddr=%RGp cb=%d\n", GCPhysAddr, cb));
    4798         return VINF_IOM_MMIO_UNUSED_FF; /* No idea what really would happen... */
    4799     }
    4800     if (GCPhysAddr & 0x3)
    4801     {
    4802         Log2(("ohciRead: Unaligned read!!! GCPhysAddr=%RGp cb=%d\n", GCPhysAddr, cb));
    4803         return VINF_IOM_MMIO_UNUSED_FF;
    4804     }
     4795    /* Paranoia: Assert that IOMMMIO_FLAGS_READ_DWORD works. */
     4796    AssertReturn(cb != sizeof(uint32_t), VERR_INTERNAL_ERROR_3);
     4797    AssertReturn(!(GCPhysAddr & 0x3), VERR_INTERNAL_ERROR_4);
    48054798
    48064799    /*
     
    48734866#ifdef IN_RING3
    48744867
    4875 static DECLCALLBACK(int)
    4876 ohciR3Map(PPCIDEVICE pPciDev, int iRegion, RTGCPHYS GCPhysAddress, uint32_t cb, PCIADDRESSSPACE enmType)
     4868/**
     4869 * @callback_method_impl{FNPCIIOREGIONMAP}
     4870 */
     4871static DECLCALLBACK(int) ohciR3Map(PPCIDEVICE pPciDev, int iRegion, RTGCPHYS GCPhysAddress, uint32_t cb, PCIADDRESSSPACE enmType)
    48774872{
    48784873    POHCI pOhci = (POHCI)pPciDev;
    48794874    int rc = PDMDevHlpMMIORegister(pOhci->CTX_SUFF(pDevIns), GCPhysAddress, cb, NULL /*pvUser*/,
    4880                                    IOMMMIO_FLAGS_READ_PASSTHRU | IOMMMIO_FLAGS_WRITE_PASSTHRU,
     4875                                   IOMMMIO_FLAGS_READ_DWORD | IOMMMIO_FLAGS_WRITE_PASSTHRU,
    48814876                                   ohciWrite, ohciRead, "USB OHCI");
    48824877    if (RT_FAILURE(rc))
     
    48884883        return rc;
    48894884
    4890     rc = PDMDevHlpMMIORegisterR0(pOhci->CTX_SUFF(pDevIns), GCPhysAddress, cb, NIL_RTR0PTR /*pvUser*/,
    4891                                  "ohciWrite", "ohciRead");
     4885    rc = PDMDevHlpMMIORegisterR0(pOhci->CTX_SUFF(pDevIns), GCPhysAddress, cb, NIL_RTR0PTR /*pvUser*/, "ohciWrite", "ohciRead");
    48924886    if (RT_FAILURE(rc))
    48934887        return rc;
    4894 
    48954888# endif
    48964889
     
    48984891    return VINF_SUCCESS;
    48994892}
     4893
    49004894
    49014895/**
     
    49454939    return VINF_SUCCESS;
    49464940}
     4941
    49474942
    49484943/**
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