Changeset 71751 in vbox for trunk/src/VBox
- Timestamp:
- Apr 8, 2018 11:05:36 PM (7 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r71750 r71751 197 197 #define AC97_AD_MISC_HPSEL RT_BIT(10) /**< PCM (front) goes to headphone outputs. */ 198 198 199 #define ICHAC97STATE_2_DEVINS(a_pAC97) ((a_pAC97)-> pDevInsR3)199 #define ICHAC97STATE_2_DEVINS(a_pAC97) ((a_pAC97)->CTX_SUFF(pDevIns)) 200 200 201 201 enum … … 396 396 /** Critical section protecting the AC'97 state. */ 397 397 PDMCRITSECT CritSect; 398 /** R3 Pointer to the device instance. */398 /** R3 pointer to the device instance. */ 399 399 PPDMDEVINSR3 pDevInsR3; 400 /** R0 pointer to the device instance. */ 401 PPDMDEVINSR0 pDevInsR0; 402 /** RC pointer to the device instance. */ 403 PPDMDEVINSRC pDevInsRC; 404 /** Set if R0/RC is enabled. */ 405 bool fRZEnabled; 400 406 /** Global Control (Bus Master Control Register). */ 401 407 uint32_t glob_cnt; … … 415 421 uint8_t cStreamsActive; 416 422 #ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS 417 /** The timer for pumping data thru the attached LUN drivers. */ 418 PTMTIMERR3 pTimer; 419 # if HC_ARCH_BITS == 32 423 /** The timer for pumping data thru the attached LUN drivers - R3Ptr. */ 424 PTMTIMERR3 pTimerR3; 425 /** The timer for pumping data thru the attached LUN drivers - R0Ptr. */ 426 PTMTIMERR0 pTimerR0; 427 /** The timer for pumping data thru the attached LUN drivers - RCPtr. */ 428 PTMTIMERRC pTimerRC; 420 429 uint32_t Padding0; 421 # endif422 430 /** Flag indicating whether the timer is active or not. */ 423 431 bool fTimerActive; … … 437 445 #endif 438 446 /** List of associated LUN drivers (AC97DRIVER). */ 439 RTLISTANCHOR 447 RTLISTANCHORR3 lstDrv; 440 448 /** The device's software mixer. */ 441 449 R3PTRTYPE(PAUDIOMIXER) pMixer; … … 502 510 #define DEVAC97_LOCK_BOTH_RETURN_VOID(a_pThis) \ 503 511 do { \ 504 int rcLock = TMTimerLock((a_pThis)-> pTimer, VERR_IGNORED); \512 int rcLock = TMTimerLock((a_pThis)->CTX_SUFF(pTimer), VERR_IGNORED); \ 505 513 if (rcLock != VINF_SUCCESS) \ 506 514 { \ … … 512 520 { \ 513 521 AssertRC(rcLock); \ 514 TMTimerUnlock((a_pThis)-> pTimer); \522 TMTimerUnlock((a_pThis)->CTX_SUFF(pTimer)); \ 515 523 return; \ 516 524 } \ … … 522 530 #define DEVAC97_LOCK_BOTH_RETURN(a_pThis, a_rcBusy) \ 523 531 do { \ 524 int rcLock = TMTimerLock((a_pThis)-> pTimer, (a_rcBusy)); \532 int rcLock = TMTimerLock((a_pThis)->CTX_SUFF(pTimer), (a_rcBusy)); \ 525 533 if (rcLock != VINF_SUCCESS) \ 526 534 return rcLock; \ … … 529 537 { \ 530 538 AssertRC(rcLock); \ 531 TMTimerUnlock((a_pThis)-> pTimer); \539 TMTimerUnlock((a_pThis)->CTX_SUFF(pTimer)); \ 532 540 return rcLock; \ 533 541 } \ … … 540 548 do { \ 541 549 PDMCritSectLeave(&(a_pThis)->CritSect); \ 542 TMTimerUnlock((a_pThis)-> pTimer); \550 TMTimerUnlock((a_pThis)->CTX_SUFF(pTimer)); \ 543 551 } while (0) 544 552 … … 607 615 } 608 616 617 #ifdef IN_RING3 618 609 619 /** 610 620 * Retrieves the audio mixer sink of a corresponding AC'97 stream index. … … 648 658 PDMDevHlpPhysRead(pDevIns, pRegs->bdbar + pRegs->civ * 8, &u32[0], sizeof(u32)); 649 659 pRegs->bd_valid = 1; 650 #if !defined(RT_ARCH_X86) && !defined(RT_ARCH_AMD64)651 # error Please adapt the code (audio buffers are little endian)!660 #ifndef RT_LITTLE_ENDIAN 661 # error "Please adapt the code (audio buffers are little endian)!" 652 662 #else 653 663 pRegs->bd.addr = RT_H2LE_U32(u32[0] & ~3); … … 661 671 } 662 672 673 #endif /* IN_RING3 */ 674 663 675 /** 664 676 * Updates the status register (SR) of an AC'97 audio stream. … … 716 728 } 717 729 } 730 731 #ifdef IN_RING3 718 732 719 733 /** … … 1405 1419 } 1406 1420 1421 #endif /* IN_RING3 */ 1422 1407 1423 /** 1408 1424 * Sets a AC'97 mixer control to a specific value. … … 1435 1451 return RT_MAKE_U16(pThis->mixer_data[uMixerIdx + 0], pThis->mixer_data[uMixerIdx + 1]); 1436 1452 } 1453 1454 #ifdef IN_RING3 1437 1455 1438 1456 /** … … 1960 1978 } 1961 1979 1980 #endif /* IN_RING3 */ 1981 1962 1982 /** 1963 1983 * Retrieves an AC'97 audio stream from an AC'97 stream index. … … 1978 1998 1979 1999 } 2000 2001 #ifdef IN_RING3 1980 2002 1981 2003 /** … … 2123 2145 DEVAC97_LOCK_BOTH_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE); 2124 2146 2125 AssertPtr(pThis-> pTimer);2147 AssertPtr(pThis->CTX_SUFF(pTimer)); 2126 2148 2127 2149 if (!pThis->fTimerActive) … … 2150 2172 LogFlowFuncEnter(); 2151 2173 2152 if (!pThis-> pTimer)2174 if (!pThis->CTX_SUFF(pTimer)) 2153 2175 return VERR_WRONG_ORDER; 2154 2176 … … 2172 2194 LogFlowFuncEnter(); 2173 2195 2174 if (!pThis-> pTimer) /* Only can happen on device construction time, so no locking needed here. */2196 if (!pThis->CTX_SUFF(pTimer)) /* Only can happen on device construction time, so no locking needed here. */ 2175 2197 return VINF_SUCCESS; 2176 2198 … … 2205 2227 LogFlowFuncEnter(); 2206 2228 2207 if (!pThis-> pTimer)2229 if (!pThis->CTX_SUFF(pTimer)) 2208 2230 return VERR_WRONG_ORDER; 2209 2231 … … 2230 2252 DEVAC97_LOCK_BOTH_RETURN_VOID(pThis); 2231 2253 2232 uint64_t cTicksNow = TMTimerGet(pThis-> pTimer);2254 uint64_t cTicksNow = TMTimerGet(pThis->CTX_SUFF(pTimer)); 2233 2255 2234 2256 /* Update current time timestamp. */ 2235 2257 pThis->uTimerTS = cTicksNow; 2236 2258 2237 /* Flag indicating whether to kickthe timer again for the next DMA transfer or sink processing. */2238 bool f KickTimer = false;2259 /* Flag indicating whether to arm the timer again for the next DMA transfer or sink processing. */ 2260 bool fArmTimer = false; 2239 2261 2240 2262 ichac97DoTransfers(pThis); 2241 2263 2242 /* Do we need to kickthe timer again? */2264 /* Do we need to arm the timer again? */ 2243 2265 if ( AudioMixerSinkIsActive(ichac97IndexToSink(pThis, pThis->StreamLineIn.u8SD)) 2244 2266 || AudioMixerSinkIsActive(ichac97IndexToSink(pThis, pThis->StreamMicIn.u8SD)) 2245 2267 || AudioMixerSinkIsActive(ichac97IndexToSink(pThis, pThis->StreamOut.u8SD))) 2246 2268 { 2247 fKickTimer = true; 2248 } 2249 2250 if ( ASMAtomicReadBool(&pThis->fTimerActive) 2251 || fKickTimer) 2252 { 2253 /* Kick the timer again. */ 2269 fArmTimer = true; 2270 } 2271 2272 if ( ASMAtomicReadBool(&pThis->fTimerActive) /** @todo r=bird: totally unnecessary to do atomic read here, isn't it? */ 2273 || fArmTimer) 2274 { 2275 /** @todo r=bird: This is simplitic insanity. Nobody wants a timer running 2276 * every 5 ms (see AC97_TIMER_HZ) all the time the VM is up running! 2277 * 2278 * If there isn't a way of detecting that guest is up to something, at 2279 * least try lowering the frequency when idle. 2280 */ 2281 /* Arm the timer again. */ 2254 2282 uint64_t cTicks = pThis->cTimerTicks; 2255 2283 /** @todo adjust cTicks down by now much cbOutMin represents. */ 2256 TMTimerSet(pThis-> pTimer, cTicksNow + cTicks);2284 TMTimerSet(pThis->CTX_SUFF(pTimer), cTicksNow + cTicks); 2257 2285 } 2258 2286 else … … 2520 2548 } 2521 2549 2550 #endif /* IN_RING3 */ 2551 2552 2522 2553 /** 2523 2554 * Port I/O Handler for IN operations. … … 2533 2564 * @param cbVal Number of bytes read. 2534 2565 */ 2535 static DECLCALLBACK(int) ichac97IOPortNABMRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT uPort, 2536 uint32_t *pu32Val, unsigned cbVal) 2537 { 2538 RT_NOREF(pDevIns); 2539 2540 PAC97STATE pThis = (PAC97STATE)pvUser; 2541 2542 DEVAC97_LOCK(pThis); 2566 PDMBOTHCBDECL(int) ichac97IOPortNABMRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT uPort, uint32_t *pu32Val, unsigned cbVal) 2567 { 2568 PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE); 2569 RT_NOREF(pvUser); 2570 2571 DEVAC97_LOCK_RETURN(pThis, VINF_IOM_R3_IOPORT_READ); 2543 2572 2544 2573 /* Get the index of the NABMBAR port. */ … … 2706 2735 * @param cbVal The value size in bytes. 2707 2736 */ 2708 static DECLCALLBACK(int) ichac97IOPortNABMWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT uPort, 2709 uint32_t u32Val, unsigned cbVal) 2710 { 2711 RT_NOREF(pDevIns); 2712 2713 PAC97STATE pThis = (PAC97STATE)pvUser; 2737 PDMBOTHCBDECL(int) ichac97IOPortNABMWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT uPort, uint32_t u32Val, unsigned cbVal) 2738 { 2739 PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE); 2740 RT_NOREF(pvUser); 2714 2741 2715 2742 DEVAC97_LOCK_BOTH_RETURN(pThis, VINF_IOM_R3_IOPORT_WRITE); … … 2724 2751 pRegs = &pStream->Regs; 2725 2752 2753 int rc = VINF_SUCCESS; 2726 2754 switch (cbVal) 2727 2755 { … … 2740 2768 && (pRegs->sr & AC97_SR_DCH)) 2741 2769 { 2770 #ifdef IN_RING3 2742 2771 pRegs->sr &= ~(AC97_SR_DCH | AC97_SR_CELV); 2743 2772 pRegs->civ = pRegs->piv; … … 2745 2774 2746 2775 ichac97StreamFetchBDLE(pThis, pStream); 2776 #else 2777 rc = VINF_IOM_R3_IOPORT_WRITE; 2778 #endif 2747 2779 } 2748 2780 pRegs->lvi = u32Val % AC97_MAX_BDLE; … … 2758 2790 case MC_CR: 2759 2791 { 2792 #ifdef IN_RING3 2760 2793 Log3Func(("[SD%RU8] CR <- %#x (cr %#x)\n", pStream->u8SD, u32Val, pRegs->cr)); 2761 2762 2794 if (u32Val & AC97_CR_RR) /* Busmaster reset. */ 2763 2795 { … … 2799 2831 } 2800 2832 } 2833 #else /* !IN_RING3 */ 2834 rc = VINF_IOM_R3_IOPORT_WRITE; 2835 #endif 2801 2836 break; 2802 2837 } … … 2882 2917 DEVAC97_UNLOCK_BOTH(pThis); 2883 2918 2884 return VINF_SUCCESS;2919 return rc; 2885 2920 } 2886 2921 … … 2898 2933 * @param cbVal Number of bytes read. 2899 2934 */ 2900 static DECLCALLBACK(int) ichac97IOPortNAMRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT uPort, uint32_t *pu32Val, unsigned cbVal)2901 { 2902 RT_NOREF(pDevIns);2903 PAC97STATE pThis = (PAC97STATE)pvUser;2904 2905 DEVAC97_LOCK (pThis);2935 PDMBOTHCBDECL(int) ichac97IOPortNAMRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT uPort, uint32_t *pu32Val, unsigned cbVal) 2936 { 2937 PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE); 2938 RT_NOREF(pvUser); 2939 2940 DEVAC97_LOCK_RETURN(pThis, VINF_IOM_R3_IOPORT_READ); 2906 2941 2907 2942 int rc = VINF_SUCCESS; … … 2959 2994 * @remarks Caller enters the device critical section. 2960 2995 */ 2961 static DECLCALLBACK(int) ichac97IOPortNAMWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT uPort, uint32_t u32Val, unsigned cbVal)2962 { 2963 RT_NOREF(pDevIns);2964 PAC97STATE pThis = (PAC97STATE)pvUser;2996 PDMBOTHCBDECL(int) ichac97IOPortNAMWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT uPort, uint32_t u32Val, unsigned cbVal) 2997 { 2998 PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE); 2999 RT_NOREF(pvUser); 2965 3000 2966 3001 DEVAC97_LOCK_BOTH_RETURN(pThis, VINF_IOM_R3_IOPORT_WRITE); 2967 3002 2968 3003 uint32_t uPortIdx = uPort - pThis->IOPortBase[0]; 2969 3004 int rc = VINF_SUCCESS; 2970 3005 switch (cbVal) 2971 3006 { … … 2983 3018 { 2984 3019 case AC97_Reset: 3020 #ifdef IN_RING3 2985 3021 ichac97Reset(pThis->CTX_SUFF(pDevIns)); 3022 #else 3023 rc = VINF_IOM_R3_IOPORT_WRITE; 3024 #endif 2986 3025 break; 2987 3026 case AC97_Powerdown_Ctrl_Stat: … … 2996 3035 break; /* Register controls surround (rear), do nothing. */ 2997 3036 } 3037 #ifdef IN_RING3 2998 3038 ichac97MixerSetVolume(pThis, uPortIdx, PDMAUDIOMIXERCTL_VOLUME_MASTER, u32Val); 3039 #else 3040 rc = VINF_IOM_R3_IOPORT_WRITE; 3041 #endif 2999 3042 break; 3000 3043 case AC97_Headphone_Volume_Mute: … … 3004 3047 { 3005 3048 /* Register controls PCM (front) outputs. */ 3049 #ifdef IN_RING3 3006 3050 ichac97MixerSetVolume(pThis, uPortIdx, PDMAUDIOMIXERCTL_VOLUME_MASTER, u32Val); 3051 #else 3052 rc = VINF_IOM_R3_IOPORT_WRITE; 3053 #endif 3007 3054 } 3008 3055 } 3009 3056 break; 3010 3057 case AC97_PCM_Out_Volume_Mute: 3058 #ifdef IN_RING3 3011 3059 ichac97MixerSetVolume(pThis, uPortIdx, PDMAUDIOMIXERCTL_FRONT, u32Val); 3060 #else 3061 rc = VINF_IOM_R3_IOPORT_WRITE; 3062 #endif 3012 3063 break; 3013 3064 case AC97_Line_In_Volume_Mute: 3065 #ifdef IN_RING3 3014 3066 ichac97MixerSetVolume(pThis, uPortIdx, PDMAUDIOMIXERCTL_LINE_IN, u32Val); 3067 #else 3068 rc = VINF_IOM_R3_IOPORT_WRITE; 3069 #endif 3015 3070 break; 3016 3071 case AC97_Record_Select: 3072 #ifdef IN_RING3 3017 3073 ichac97MixerRecordSelect(pThis, u32Val); 3074 #else 3075 rc = VINF_IOM_R3_IOPORT_WRITE; 3076 #endif 3018 3077 break; 3019 3078 case AC97_Record_Gain_Mute: 3079 #ifdef IN_RING3 3020 3080 /* Newer Ubuntu guests rely on that when controlling gain and muting 3021 3081 * the recording (capturing) levels. */ 3022 3082 ichac97MixerSetVolume(pThis, uPortIdx, PDMAUDIOMIXERCTL_LINE_IN, u32Val); 3083 #else 3084 rc = VINF_IOM_R3_IOPORT_WRITE; 3085 #endif 3023 3086 break; 3024 3087 case AC97_Record_Gain_Mic_Mute: 3088 #ifdef IN_RING3 3025 3089 /* Ditto; see note above. */ 3026 3090 ichac97MixerSetVolume(pThis, uPortIdx, PDMAUDIOMIXERCTL_MIC_IN, u32Val); 3091 #else 3092 rc = VINF_IOM_R3_IOPORT_WRITE; 3093 #endif 3027 3094 break; 3028 3095 case AC97_Vendor_ID1: … … 3034 3101 break; 3035 3102 case AC97_Extended_Audio_Ctrl_Stat: 3103 #ifdef IN_RING3 3036 3104 if (!(u32Val & AC97_EACS_VRA)) 3037 3105 { … … 3055 3123 LogFunc(("Setting extended audio control to %#x\n", u32Val)); 3056 3124 ichac97MixerSet(pThis, AC97_Extended_Audio_Ctrl_Stat, u32Val); 3125 #else 3126 rc = VINF_IOM_R3_IOPORT_WRITE; 3127 #endif 3057 3128 break; 3058 3129 case AC97_PCM_Front_DAC_Rate: 3059 3130 if (ichac97MixerGet(pThis, AC97_Extended_Audio_Ctrl_Stat) & AC97_EACS_VRA) 3060 3131 { 3132 #ifdef IN_RING3 3061 3133 ichac97MixerSet(pThis, uPortIdx, u32Val); 3062 3134 LogFunc(("Set front DAC rate to %RU32\n", u32Val)); 3063 3135 ichac97StreamReOpen(pThis, &pThis->StreamOut); 3136 #else 3137 rc = VINF_IOM_R3_IOPORT_WRITE; 3138 #endif 3064 3139 } 3065 3140 else … … 3069 3144 if (ichac97MixerGet(pThis, AC97_Extended_Audio_Ctrl_Stat) & AC97_EACS_VRM) 3070 3145 { 3146 #ifdef IN_RING3 3071 3147 ichac97MixerSet(pThis, uPortIdx, u32Val); 3072 3148 LogFunc(("Set MIC ADC rate to %RU32\n", u32Val)); 3073 3149 ichac97StreamReOpen(pThis, &pThis->StreamMicIn); 3150 #else 3151 rc = VINF_IOM_R3_IOPORT_WRITE; 3152 #endif 3074 3153 } 3075 3154 else … … 3079 3158 if (ichac97MixerGet(pThis, AC97_Extended_Audio_Ctrl_Stat) & AC97_EACS_VRA) 3080 3159 { 3160 #ifdef IN_RING3 3081 3161 ichac97MixerSet(pThis, uPortIdx, u32Val); 3082 3162 LogFunc(("Set front LR ADC rate to %RU32\n", u32Val)); 3083 3163 ichac97StreamReOpen(pThis, &pThis->StreamLineIn); 3164 #else 3165 rc = VINF_IOM_R3_IOPORT_WRITE; 3166 #endif 3084 3167 } 3085 3168 else … … 3108 3191 DEVAC97_UNLOCK_BOTH(pThis); 3109 3192 3110 return VINF_SUCCESS; 3111 } 3112 3193 return rc; 3194 } 3195 3196 #ifdef IN_RING3 3113 3197 3114 3198 /** … … 3131 3215 int rc; 3132 3216 if (iRegion == 0) 3133 rc = PDMDevHlpIOPortRegister(pDevIns, Port, 256, pThis,3134 3217 { 3218 rc = PDMDevHlpIOPortRegister(pDevIns, Port, 256, NULL, ichac97IOPortNAMWrite, ichac97IOPortNAMRead, 3135 3219 NULL, NULL, "ICHAC97 NAM"); 3220 AssertRCReturn(rc, rc); 3221 if (pThis->fRZEnabled) 3222 { 3223 rc = PDMDevHlpIOPortRegisterR0(pDevIns, Port, 256, NIL_RTR0PTR, "ichac97IOPortNAMWrite", "ichac97IOPortNAMRead", 3224 NULL, NULL, "ICHAC97 NAM"); 3225 AssertRCReturn(rc, rc); 3226 rc = PDMDevHlpIOPortRegisterRC(pDevIns, Port, 256, NIL_RTRCPTR, "ichac97IOPortNAMWrite", "ichac97IOPortNAMRead", 3227 NULL, NULL, "ICHAC97 NAM"); 3228 AssertRCReturn(rc, rc); 3229 } 3230 } 3136 3231 else 3137 rc = PDMDevHlpIOPortRegister(pDevIns, Port, 64, pThis,3138 3232 { 3233 rc = PDMDevHlpIOPortRegister(pDevIns, Port, 64, NULL, ichac97IOPortNABMWrite, ichac97IOPortNABMRead, 3139 3234 NULL, NULL, "ICHAC97 NABM"); 3140 if (RT_FAILURE(rc)) 3141 return rc; 3235 AssertRCReturn(rc, rc); 3236 if (pThis->fRZEnabled) 3237 { 3238 rc = PDMDevHlpIOPortRegisterR0(pDevIns, Port, 64, NIL_RTR0PTR, "ichac97IOPortNABMWrite", "ichac97IOPortNABMRead", 3239 NULL, NULL, "ICHAC97 NABM"); 3240 AssertRCReturn(rc, rc); 3241 rc = PDMDevHlpIOPortRegisterRC(pDevIns, Port, 64, NIL_RTRCPTR, "ichac97IOPortNABMWrite", "ichac97IOPortNABMRead", 3242 NULL, NULL, "ICHAC97 NABM"); 3243 AssertRCReturn(rc, rc); 3244 3245 } 3246 } 3142 3247 3143 3248 pThis->IOPortBase[iRegion] = Port; … … 3145 3250 } 3146 3251 3147 #ifdef IN_RING3 3252 3148 3253 /** 3149 3254 * Saves (serializes) an AC'97 stream using SSM. … … 3619 3724 3620 3725 /** 3726 * @interface_method_impl{PDMDEVREG,pfnRelocate} 3727 */ 3728 static DECLCALLBACK(void) ichac97Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) 3729 { 3730 NOREF(offDelta); 3731 PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE); 3732 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 3733 #ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS 3734 pThis->pTimerRC = TMTimerRCPtr(pThis->pTimerR3); 3735 #endif 3736 } 3737 3738 /** 3621 3739 * @interface_method_impl{PDMDEVREG,pfnDestruct} 3622 3740 */ … … 3653 3771 * Initialize data so we can run the destructor without scewing up. 3654 3772 */ 3773 pThis->pDevInsR3 = pDevIns; 3774 pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 3775 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 3776 pThis->IBase.pfnQueryInterface = ichac97QueryInterface; 3655 3777 RTListInit(&pThis->lstDrv); 3656 3657 3778 3658 3779 /* … … 3660 3781 */ 3661 3782 if (!CFGMR3AreValuesValid(pCfg, 3783 "RZEnabled\0" 3662 3784 "Codec\0" 3663 3785 "TimerHz\0")) … … 3668 3790 * Read config data. 3669 3791 */ 3792 int rc = CFGMR3QueryBoolDef(pCfg, "RZEnabled", &pThis->fRZEnabled, true); 3793 if (RT_FAILURE(rc)) 3794 return PDMDEV_SET_ERROR(pDevIns, rc, 3795 N_("HDA configuration error: failed to read RCEnabled as boolean")); 3796 3670 3797 char szCodec[20]; 3671 intrc = CFGMR3QueryStringDef(pCfg, "Codec", &szCodec[0], sizeof(szCodec), "STAC9700");3798 rc = CFGMR3QueryStringDef(pCfg, "Codec", &szCodec[0], sizeof(szCodec), "STAC9700"); 3672 3799 if (RT_FAILURE(rc)) 3673 3800 return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, … … 3711 3838 * Initialize data (most of it anyway). 3712 3839 */ 3713 pThis->pDevInsR3 = pDevIns;3714 /* IBase */3715 pThis->IBase.pfnQueryInterface = ichac97QueryInterface;3716 3717 3840 /* PCI Device */ 3718 3841 PCIDevSetVendorId (&pThis->PciDev, 0x8086); /* 00 ro - intel. */ Assert(pThis->PciDev.abConfig[0x00] == 0x86); Assert(pThis->PciDev.abConfig[0x01] == 0x80); … … 3937 4060 */ 3938 4061 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, ichac97Timer, pThis, 3939 TMTIMER_FLAGS_NO_CRIT_SECT, "AC'97 Timer", &pThis->pTimer );4062 TMTIMER_FLAGS_NO_CRIT_SECT, "AC'97 Timer", &pThis->pTimerR3); 3940 4063 AssertRCReturn(rc, rc); 4064 pThis->pTimerR0 = TMTimerR0Ptr(pThis->pTimerR3); 4065 pThis->pTimerRC = TMTimerRCPtr(pThis->pTimerR3); 3941 4066 3942 4067 /* Use our own critcal section for the device timer. 3943 4068 * That way we can control more fine-grained when to lock what. */ 3944 rc = TMR3TimerSetCritSect(pThis->pTimer , &pThis->CritSect);4069 rc = TMR3TimerSetCritSect(pThis->pTimerR3, &pThis->CritSect); 3945 4070 AssertRCReturn(rc, rc); 3946 4071 3947 pThis->cTimerTicks = TMTimerGetFreq(pThis->pTimer ) / uTimerHz;3948 pThis->uTimerTS = TMTimerGet(pThis->pTimer );4072 pThis->cTimerTicks = TMTimerGetFreq(pThis->pTimerR3) / uTimerHz; 4073 pThis->uTimerTS = TMTimerGet(pThis->pTimerR3); 3949 4074 LogFunc(("Timer ticks=%RU64 (%RU16 Hz)\n", pThis->cTimerTicks, uTimerHz)); 3950 4075 } … … 4016 4141 "ichac97", 4017 4142 /* szRCMod */ 4018 " ",4143 "VBoxDDRC.rc", 4019 4144 /* szR0Mod */ 4020 " ",4145 "VBoxDDR0.r0", 4021 4146 /* pszDescription */ 4022 4147 "ICH AC'97 Audio Controller", 4023 4148 /* fFlags */ 4024 PDM_DEVREG_FLAGS_DEFAULT_BITS ,4149 PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0, 4025 4150 /* fClass */ 4026 4151 PDM_DEVREG_CLASS_AUDIO, … … 4034 4159 ichac97Destruct, 4035 4160 /* pfnRelocate */ 4036 NULL,4161 ichac97Relocate, 4037 4162 /* pfnMemSetup */ 4038 4163 NULL, -
trunk/src/VBox/Devices/Makefile.kmk
r71721 r71751 934 934 VBoxDDRC_SOURCES += \ 935 935 Audio/DevHDA.cpp \ 936 Audio/DevHDACommon.cpp 936 Audio/DevHDACommon.cpp \ 937 Audio/DevIchAc97.cpp 937 938 938 939 VBoxDDRC_DEFS += \ … … 1118 1119 VBoxDDR0_SOURCES += \ 1119 1120 Audio/DevHDA.cpp \ 1120 Audio/DevHDACommon.cpp 1121 Audio/DevHDACommon.cpp \ 1122 Audio/DevIchAc97.cpp 1121 1123 1122 1124 ifdef VBOX_WITH_E1000 -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
r71732 r71751 132 132 #undef LOG_GROUP 133 133 #include "../PC/DevHPET.cpp" 134 # 135 # 136 # 137 # 134 #undef LOG_GROUP 135 #include "../Audio/DevIchAc97.cpp" 136 #undef LOG_GROUP 137 #include "../Audio/DevHDA.cpp" 138 138 #ifdef VBOX_WITH_NVME_IMPL 139 139 # undef LOG_GROUP … … 1861 1861 GEN_CHECK_OFF(AC97DRIVER, Out); 1862 1862 1863 GEN_CHECK_SIZE(AC97STATE); 1864 GEN_CHECK_OFF(AC97STATE, CritSect); 1865 GEN_CHECK_OFF(AC97STATE, pDevInsR3); 1866 GEN_CHECK_OFF(AC97STATE, pDevInsR0); 1867 GEN_CHECK_OFF(AC97STATE, pDevInsRC); 1868 GEN_CHECK_OFF(AC97STATE, fRZEnabled); 1869 GEN_CHECK_OFF(AC97STATE, glob_cnt); 1870 GEN_CHECK_OFF(AC97STATE, glob_sta); 1871 GEN_CHECK_OFF(AC97STATE, cas); 1872 GEN_CHECK_OFF(AC97STATE, last_samp); 1873 GEN_CHECK_OFF(AC97STATE, mixer_data); 1874 GEN_CHECK_OFF(AC97STATE, StreamLineIn); 1875 GEN_CHECK_OFF(AC97STATE, StreamMicIn); 1876 GEN_CHECK_OFF(AC97STATE, StreamOut); 1877 GEN_CHECK_OFF(AC97STATE, cStreamsActive); 1878 #ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS 1879 GEN_CHECK_OFF(AC97STATE, pTimerR3); 1880 GEN_CHECK_OFF(AC97STATE, pTimerR0); 1881 GEN_CHECK_OFF(AC97STATE, pTimerRC); 1882 GEN_CHECK_OFF(AC97STATE, Padding0); 1883 GEN_CHECK_OFF(AC97STATE, fTimerActive); 1884 GEN_CHECK_OFF(AC97STATE, u8Padding1); 1885 GEN_CHECK_OFF(AC97STATE, cTimerTicks); 1886 GEN_CHECK_OFF(AC97STATE, uTimerTS); 1887 #endif 1888 #ifdef VBOX_WITH_STATISTICS 1889 GEN_CHECK_OFF(AC97STATE, StatTimer); 1890 GEN_CHECK_OFF(AC97STATE, StatIn); 1891 GEN_CHECK_OFF(AC97STATE, StatOut); 1892 GEN_CHECK_OFF(AC97STATE, StatBytesRead); 1893 GEN_CHECK_OFF(AC97STATE, StatBytesWritten); 1894 #endif 1895 GEN_CHECK_OFF(AC97STATE, lstDrv); 1896 GEN_CHECK_OFF(AC97STATE, pMixer); 1897 GEN_CHECK_OFF(AC97STATE, pSinkOut); 1898 GEN_CHECK_OFF(AC97STATE, pSinkLineIn); 1899 GEN_CHECK_OFF(AC97STATE, pSinkMicIn); 1900 GEN_CHECK_OFF(AC97STATE, silence); 1901 GEN_CHECK_OFF(AC97STATE, bup_flag); 1902 GEN_CHECK_OFF(AC97STATE, IBase); 1903 GEN_CHECK_OFF(AC97STATE, IOPortBase); 1904 GEN_CHECK_OFF(AC97STATE, uCodecModel); 1905 1863 1906 GEN_CHECK_SIZE(HDADRIVERSTREAM); 1864 1907 GEN_CHECK_OFF(HDADRIVERSTREAM, DestSource);
Note:
See TracChangeset
for help on using the changeset viewer.