- Timestamp:
- Mar 5, 2010 7:40:43 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/pdmdev.h
r26944 r27126 1711 1711 * @returns rc if we failed to set legacy mode. 1712 1712 * @param pDevIns Device instance of the HPET. 1713 * @param fActivate Activate or deactivate legacy mode.1714 */ 1715 DECLR3CALLBACKMEMBER(int, pfnSetLegacyMode,(PPDMDEVINS pDevIns, bool fActivate ));1713 * @param fActivated Whether legacy mode is activated or deactivated. 1714 */ 1715 DECLR3CALLBACKMEMBER(int, pfnSetLegacyMode,(PPDMDEVINS pDevIns, bool fActivated)); 1716 1716 1717 1717 -
trunk/include/VBox/pdmifs.h
r27121 r27126 1937 1937 #define PDMIVMMDEVPORT_IID "d7e52035-3b6c-422e-9215-2a75646a945d" 1938 1938 1939 /** Pointer to a PIT port interface. */ 1940 typedef struct PDMIPITPORT *PPDMIPITPORT; 1941 /** 1942 * PIT port interface. 1943 */ 1944 typedef struct PDMIPITPORT 1945 { 1946 /** 1947 * Notify PIT about change of HPET legacy mode. 1948 * 1949 * @returns VBox status code 1950 * @param pInterface Pointer to the interface structure containing the called function pointer. 1951 * @param fActivate If HPET legacy mode activated or deactivated. 1952 */ 1953 DECLR3CALLBACKMEMBER(int, pfnNotifyHpetLegacy,(PPDMIPITPORT pInterface, bool fActivate)); 1954 } PDMIPITPORT; 1955 /** PDMIPITPORT interface ID. */ 1956 #define PDMIPITPORT_IID "06127207-3182-4394-b16e-0ecfeb5cbb27" 1957 1958 /** Pointer to a RTC port interface. */ 1959 typedef struct PDMIRTCPORT *PPDMIRTCPORT; 1960 /** 1961 * RTC port interface. 1962 */ 1963 typedef struct PDMIRTCPORT 1964 { 1965 /** 1966 * Notify RTC about change of HPET legacy mode. 1967 * 1968 * @returns VBox status code 1969 * @param pInterface Pointer to the interface structure containing the called function pointer. 1970 * @param fActivate If HPET legacy mode activated or deactivated. 1971 */ 1972 DECLR3CALLBACKMEMBER(int, pfnNotifyHpetLegacy,(PPDMIRTCPORT pInterface, bool fActivate)); 1973 } PDMIRTCPORT; 1974 /** PDMIRTCPORT interface ID. */ 1975 #define PDMIRTCPORT_IID "b6af0d7c-56c7-4064-85aa-ba78b43a26e7" 1939 1940 /** Pointer to a HPET legacy notifcation interface. */ 1941 typedef struct PDMIHPETLEGACYNOTIFY *PPDMIHPETLEGACYNOTIFY; 1942 /** 1943 * HPET legacy notifcation interface. 1944 */ 1945 typedef struct PDMIHPETLEGACYNOTIFY 1946 { 1947 /** 1948 * Notify about change of HPET legacy mode. 1949 * 1950 * @param pInterface Pointer to the interface structure containing the 1951 * called function pointer. 1952 * @param fActivated If HPET legacy mode is activated (@c true) or 1953 * deactivated (@c false). 1954 */ 1955 DECLR3CALLBACKMEMBER(void, pfnModeChanged,(PPDMIHPETLEGACYNOTIFY pInterface, bool fActivated)); 1956 } PDMIHPETLEGACYNOTIFY; 1957 /** PDMIHPETLEGACYNOTIFY interface ID. */ 1958 #define PDMIHPETLEGACYNOTIFY_IID "c9ada595-4b65-4311-8b21-b10498997774" 1976 1959 1977 1960 -
trunk/src/VBox/Devices/PC/DevHPET.cpp
r27121 r27126 616 616 iOldValue = (uint32_t)(pThis->u64Config); 617 617 618 /* *618 /* 619 619 * This check must be here, before actual update, as hpetLegacyMode 620 620 * may request retry in R3 - so we must keep state intact. -
trunk/src/VBox/Devices/PC/DevPit-i8254.cpp
r27125 r27126 156 156 /** Config: Speaker enabled. */ 157 157 bool fSpeakerCfg; 158 uint8_t fDisabledByHpet; 159 #if HC_ARCH_BITS == 64 160 bool afAlignment0[4]; 161 #endif 158 bool fDisabledByHpet; 159 bool afAlignment0[HC_ARCH_BITS == 32 ? 4 : 4]; 162 160 /** PIT port interface. */ 163 PDMI PITPORT IPITPort;161 PDMIHPETLEGACYNOTIFY IHpetLegacyNotify; 164 162 /** Pointer to the device instance. */ 165 163 PPDMDEVINSR3 pDevIns; 166 #if HC_ARCH_BITS == 32167 uint32_t alignment1;168 #endif169 164 /** Number of IRQs that's been raised. */ 170 165 STAMCOUNTER StatPITIrq; … … 789 784 790 785 SSMR3PutS32(pSSM, pThis->speaker_data_on); 791 792 793 786 #ifdef FAKE_REFRESH_CLOCK 794 787 SSMR3PutS32(pSSM, pThis->dummy_refresh_clock); … … 797 790 #endif 798 791 799 SSMR3PutU8(pSSM, pThis->fDisabledByHpet); 800 801 return 0; 792 return SSMR3PutBool(pSSM, pThis->fDisabledByHpet); 802 793 } 803 794 … … 877 868 SSMR3GetS32(pSSM, &u32Dummy); 878 869 #endif 879 880 870 if (uVersion > PIT_SAVED_STATE_VERSION_VBOX_31) 881 SSMR3Get U8(pSSM, &pThis->fDisabledByHpet);882 883 return 0;871 SSMR3GetBool(pSSM, &pThis->fDisabledByHpet); 872 873 return VINF_SUCCESS; 884 874 } 885 875 … … 903 893 904 894 /** 895 * Info handler, device version. 896 * 897 * @param pDevIns Device instance which registered the info. 898 * @param pHlp Callback functions for doing output. 899 * @param pszArgs Argument string. Optional and specific to the handler. 900 */ 901 static DECLCALLBACK(void) pitInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 902 { 903 PITState *pThis = PDMINS_2_DATA(pDevIns, PITState *); 904 unsigned i; 905 for (i = 0; i < RT_ELEMENTS(pThis->channels); i++) 906 { 907 const PITChannelState *pCh = &pThis->channels[i]; 908 909 pHlp->pfnPrintf(pHlp, 910 "PIT (i8254) channel %d status: irq=%#x\n" 911 " count=%08x" " latched_count=%04x count_latched=%02x\n" 912 " status=%02x status_latched=%02x read_state=%02x\n" 913 " write_state=%02x write_latch=%02x rw_mode=%02x\n" 914 " mode=%02x bcd=%02x gate=%02x\n" 915 " count_load_time=%016RX64 next_transition_time=%016RX64\n" 916 " u64ReloadTS=%016RX64 u64NextTS=%016RX64\n" 917 , 918 i, pCh->irq, 919 pCh->count, pCh->latched_count, pCh->count_latched, 920 pCh->status, pCh->status_latched, pCh->read_state, 921 pCh->write_state, pCh->write_latch, pCh->rw_mode, 922 pCh->mode, pCh->bcd, pCh->gate, 923 pCh->count_load_time, pCh->next_transition_time, 924 pCh->u64ReloadTS, pCh->u64NextTS); 925 } 926 #ifdef FAKE_REFRESH_CLOCK 927 pHlp->pfnPrintf(pHlp, "speaker_data_on=%#x dummy_refresh_clock=%#x\n", 928 pThis->speaker_data_on, pThis->dummy_refresh_clock); 929 #else 930 pHlp->pfnPrintf(pHlp, "speaker_data_on=%#x\n", pThis->speaker_data_on); 931 #endif 932 if (pThis->fDisabledByHpet) 933 pHlp->pfnPrintf(pHlp, "Disabled by HPET\n"); 934 } 935 936 937 /** 938 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 939 */ 940 static DECLCALLBACK(void *) pitQueryInterface(PPDMIBASE pInterface, const char *pszIID) 941 { 942 PPDMDEVINS pDevIns = RT_FROM_MEMBER(pInterface, PDMDEVINS, IBase); 943 PITState *pThis = PDMINS_2_DATA(pDevIns, PITState *); 944 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDevIns->IBase); 945 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHPETLEGACYNOTIFY, &pThis->IHpetLegacyNotify); 946 return NULL; 947 } 948 949 950 /** 951 * @interface_method_impl{PDMIHPETLEGACYNOTIFY,pfnModeChanged} 952 */ 953 static DECLCALLBACK(void) pitNotifyHpetLegacyNotify_ModeChanged(PPDMIHPETLEGACYNOTIFY pInterface, bool fActivated) 954 { 955 PITState *pThis = RT_FROM_MEMBER(pInterface, PITState, IHpetLegacyNotify); 956 pThis->fDisabledByHpet = fActivated; 957 } 958 959 960 /** 905 961 * Relocation notification. 906 962 * … … 924 980 } 925 981 926 /** @todo remove this! */927 static DECLCALLBACK(void) pitInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs);928 982 929 983 /** … … 966 1020 967 1021 /** 968 * Info handler, device version.969 *970 * @param pDevIns Device instance which registered the info.971 * @param pHlp Callback functions for doing output.972 * @param pszArgs Argument string. Optional and specific to the handler.973 */974 static DECLCALLBACK(void) pitInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)975 {976 PITState *pThis = PDMINS_2_DATA(pDevIns, PITState *);977 unsigned i;978 for (i = 0; i < RT_ELEMENTS(pThis->channels); i++)979 {980 const PITChannelState *pCh = &pThis->channels[i];981 982 pHlp->pfnPrintf(pHlp,983 "PIT (i8254) channel %d status: irq=%#x\n"984 " count=%08x" " latched_count=%04x count_latched=%02x\n"985 " status=%02x status_latched=%02x read_state=%02x\n"986 " write_state=%02x write_latch=%02x rw_mode=%02x\n"987 " mode=%02x bcd=%02x gate=%02x\n"988 " count_load_time=%016RX64 next_transition_time=%016RX64\n"989 " u64ReloadTS=%016RX64 u64NextTS=%016RX64\n"990 ,991 i, pCh->irq,992 pCh->count, pCh->latched_count, pCh->count_latched,993 pCh->status, pCh->status_latched, pCh->read_state,994 pCh->write_state, pCh->write_latch, pCh->rw_mode,995 pCh->mode, pCh->bcd, pCh->gate,996 pCh->count_load_time, pCh->next_transition_time,997 pCh->u64ReloadTS, pCh->u64NextTS);998 }999 #ifdef FAKE_REFRESH_CLOCK1000 pHlp->pfnPrintf(pHlp, "speaker_data_on=%#x dummy_refresh_clock=%#x\n",1001 pThis->speaker_data_on, pThis->dummy_refresh_clock);1002 #else1003 pHlp->pfnPrintf(pHlp, "speaker_data_on=%#x\n", pThis->speaker_data_on);1004 #endif1005 if (pThis->fDisabledByHpet)1006 pHlp->pfnPrintf(pHlp, "Disabled by HPET\n");1007 }1008 1009 /**1010 * @interface_method_impl{PDMIBASE,pfnQueryInterface}1011 */1012 static DECLCALLBACK(void *) pitQueryInterface(PPDMIBASE pInterface, const char *pszIID)1013 {1014 PPDMDEVINS pDevIns = RT_FROM_MEMBER(pInterface, PDMDEVINS, IBase);1015 PITState *pThis = PDMINS_2_DATA(pDevIns, PITState *);1016 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDevIns->IBase);1017 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIPITPORT, &pThis->IPITPort);1018 return NULL;1019 }1020 1021 /**1022 * @interface_method_impl{PDMIPITPORT,pfnNotifyHpetLegacy}1023 *1024 * @returns VBox status code1025 * @param pInterface Pointer to the interface structure containing the called function pointer.1026 */1027 static DECLCALLBACK(int) pitNotifyHpetLegacy(PPDMIPITPORT pInterface, bool fActivate)1028 {1029 PITState *pThis = RT_FROM_MEMBER(pInterface, PITState, IPITPort);1030 pThis->fDisabledByHpet = fActivate;1031 return VINF_SUCCESS;1032 }1033 1034 /**1035 1022 * @interface_method_impl{PDMDEVREG,pfnConstruct} 1036 1023 */ … … 1091 1078 pThis->channels[i].pPitRC = PDMINS_2_DATA_RCPTR(pDevIns); 1092 1079 } 1080 1081 /* 1082 * Interfaces 1083 */ 1084 /* IBase */ 1085 pDevIns->IBase.pfnQueryInterface = pitQueryInterface; 1086 /* IHpetLegacyNotify */ 1087 pThis->IHpetLegacyNotify.pfnModeChanged = pitNotifyHpetLegacyNotify_ModeChanged; 1093 1088 1094 1089 /* … … 1135 1130 if (RT_FAILURE(rc)) 1136 1131 return rc; 1137 1138 /*1139 * Interfaces1140 */1141 /* IBase */1142 pDevIns->IBase.pfnQueryInterface = pitQueryInterface;1143 /* IPITPort */1144 pThis->IPITPort.pfnNotifyHpetLegacy = pitNotifyHpetLegacy;1145 1132 1146 1133 /* -
trunk/src/VBox/Devices/PC/DevRTC.cpp
r27121 r27126 146 146 uint8_t cmos_data[128]; 147 147 uint8_t cmos_index; 148 uint8_t fDisabledByHpet; 149 uint8_t Alignment0[6]; 148 uint8_t Alignment0[7]; 150 149 struct my_tm current_tm; 151 150 /** The configured IRQ. */ … … 155 154 /** Use UTC or local time initially. */ 156 155 bool fUTC; 156 /** Disabled by HPET legacy mode. */ 157 bool fDisabledByHpet; 157 158 /* periodic timer */ 158 159 int64_t next_periodic_time; 159 160 /* second update */ 160 161 int64_t next_second_time; 161 162 /** RTC port interface. */163 PDMIRTCPORT IRTCPort;164 162 165 163 /** Pointer to the device instance - R3 Ptr. */ … … 198 196 /** The current/previous timer period. Used to prevent flooding changes. */ 199 197 int32_t CurPeriod; 198 199 /** HPET legacy mode notification interface. */ 200 PDMIHPETLEGACYNOTIFY IHpetLegacyNotify; 200 201 }; 201 202 … … 237 238 } 238 239 } 239 240 240 241 241 static void rtc_raise_irq(RTCState* pThis, uint32_t iLevel) … … 663 663 TMR3TimerSave(pThis->CTX_SUFF(pSecondTimer2), pSSM); 664 664 665 SSMR3PutU8(pSSM, pThis->fDisabledByHpet); 666 667 return VINF_SUCCESS; 665 return SSMR3PutBool(pSSM, pThis->fDisabledByHpet); 668 666 } 669 667 … … 723 721 TMR3TimerLoad(pThis->CTX_SUFF(pSecondTimer), pSSM); 724 722 TMR3TimerLoad(pThis->CTX_SUFF(pSecondTimer2), pSSM); 723 724 if (uVersion > RTC_SAVED_STATE_VERSION_VBOX_31) 725 SSMR3GetBool(pSSM, &pThis->fDisabledByHpet); 725 726 726 727 int period_code = pThis->cmos_data[RTC_REG_A] & 0x0f; … … 738 739 pThis->cRelLogEntries = 0; 739 740 740 741 if (uVersion > RTC_SAVED_STATE_VERSION_VBOX_31)742 SSMR3GetU8(pSSM, &pThis->fDisabledByHpet);743 744 741 return VINF_SUCCESS; 745 742 } … … 862 859 863 860 /** 861 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 862 */ 863 static DECLCALLBACK(void *) rtcQueryInterface(PPDMIBASE pInterface, const char *pszIID) 864 { 865 PPDMDEVINS pDevIns = RT_FROM_MEMBER(pInterface, PDMDEVINS, IBase); 866 RTCState *pThis = PDMINS_2_DATA(pDevIns, RTCState *); 867 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDevIns->IBase); 868 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHPETLEGACYNOTIFY, &pThis->IHpetLegacyNotify); 869 return NULL; 870 } 871 872 873 /** 874 * @interface_method_impl{PDMIHPETLEGACYNOTIFY,pfnModeChanged} 875 */ 876 static DECLCALLBACK(void) rtcHpetLegacyNotify_ModeChanged(PPDMIHPETLEGACYNOTIFY pInterface, bool fActivated) 877 { 878 RTCState *pThis = RT_FROM_MEMBER(pInterface, RTCState, IHpetLegacyNotify); 879 pThis->fDisabledByHpet = fActivated; 880 } 881 882 883 /** 864 884 * @copydoc 865 885 */ … … 874 894 } 875 895 876 /**877 * @interface_method_impl{PDMIBASE,pfnQueryInterface}878 */879 static DECLCALLBACK(void *) rtcQueryInterface(PPDMIBASE pInterface, const char *pszIID)880 {881 PPDMDEVINS pDevIns = RT_FROM_MEMBER(pInterface, PDMDEVINS, IBase);882 RTCState *pThis = PDMINS_2_DATA(pDevIns, RTCState *);883 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDevIns->IBase);884 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIRTCPORT, &pThis->IRTCPort);885 return NULL;886 }887 888 /**889 * @interface_method_impl{PDMIRTCPORT,pfnNotifyHpetLegacy}890 */891 static DECLCALLBACK(int) rtcNotifyHpetLegacy(PPDMIRTCPORT pInterface, bool fActivate)892 {893 RTCState *pThis = RT_FROM_MEMBER(pInterface, RTCState, IRTCPort);894 pThis->fDisabledByHpet = fActivate;895 return VINF_SUCCESS;896 }897 896 898 897 /** … … 964 963 pThis->fDisabledByHpet = false; 965 964 965 /* IBase */ 966 pDevIns->IBase.pfnQueryInterface = rtcQueryInterface; 967 /* IHpetLegacyNotify */ 968 pThis->IHpetLegacyNotify.pfnModeChanged = rtcHpetLegacyNotify_ModeChanged; 969 966 970 /* 967 971 * Create timers, arm them, register I/O Ports and save state. … … 1020 1024 1021 1025 /* 1022 * Interfaces1023 */1024 /* IBase */1025 pDevIns->IBase.pfnQueryInterface = rtcQueryInterface;1026 /* IRTCPort */1027 pThis->IRTCPort.pfnNotifyHpetLegacy = rtcNotifyHpetLegacy;1028 1029 /*1030 1026 * Register ourselves as the RTC/CMOS with PDM. 1031 * @todo: maybe use generic iface above?1032 1027 */ 1033 1028 rc = PDMDevHlpRTCRegister(pDevIns, &pThis->RtcReg, &pThis->pRtcHlpR3); … … 1096 1091 #endif /* IN_RING3 */ 1097 1092 #endif /* !VBOX_DEVICE_STRUCT_TESTCASE */ 1093 -
trunk/src/VBox/VMM/PDMDevMiscHlp.cpp
r27121 r27126 557 557 558 558 /** @interface_method_impl{PDMHPETHLPR3,pfnSetLegacyMode} */ 559 static DECLCALLBACK(int) pdmR3HpetHlp_SetLegacyMode(PPDMDEVINS pDevIns, bool fActivate) 560 { 561 PDMDEV_ASSERT_DEVINS(pDevIns); 562 LogFlow(("pdmR3HpetHlp_SetLegacyMode: caller='%s'/%d: fActivate=%d\n", pDevIns->pReg->szName, pDevIns->iInstance, fActivate)); 563 564 PPDMIBASE pBase; 565 int rc; 566 567 rc = PDMR3QueryDevice(pDevIns->Internal.s.pVMR3, "i8254", 0, &pBase); 568 /* No PIT - no problems too */ 569 if (RT_SUCCESS(rc)) 559 static DECLCALLBACK(int) pdmR3HpetHlp_SetLegacyMode(PPDMDEVINS pDevIns, bool fActivated) 560 { 561 PDMDEV_ASSERT_DEVINS(pDevIns); 562 LogFlow(("pdmR3HpetHlp_SetLegacyMode: caller='%s'/%d: fActivated=%RTbool\n", pDevIns->pReg->szName, pDevIns->iInstance, fActivated)); 563 564 size_t i; 565 int rc = VINF_SUCCESS; 566 static const char * const s_apszDevsToNotify[] = 570 567 { 571 Assert(pBase); 572 PPDMIPITPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIPITPORT); 573 574 rc = pPort ? pPort->pfnNotifyHpetLegacy(pPort, fActivate) : VINF_SUCCESS; 568 "i8254", 569 "mc146818" 570 }; 571 for (i = 0; i < RT_ELEMENTS(s_apszDevsToNotify); i++) 572 { 573 PPDMIBASE pBase; 574 rc = PDMR3QueryDevice(pDevIns->Internal.s.pVMR3, "i8254", 0, &pBase); 575 if (RT_SUCCESS(rc)) 576 { 577 PPDMIHPETLEGACYNOTIFY pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIHPETLEGACYNOTIFY); 578 AssertLogRelMsgBreakStmt(pPort, ("%s\n", s_apszDevsToNotify[i]), rc == VERR_INTERNAL_ERROR_3); 579 pPort->pfnModeChanged(pPort, fActivated); 580 } 581 else if ( rc == VERR_PDM_DEVICE_NOT_FOUND 582 || rc == VERR_PDM_DEVICE_INSTANCE_NOT_FOUND) 583 rc = VINF_SUCCESS; /* the device isn't configured, ignore. */ 584 else 585 AssertLogRelMsgFailedBreak(("%s -> %Rrc\n", s_apszDevsToNotify[i], rc)); 575 586 } 576 else 577 rc = VINF_SUCCESS; 578 579 if (RT_FAILURE(rc)) 580 return rc; 581 582 rc = PDMR3QueryDevice(pDevIns->Internal.s.pVMR3, "mc146818", 0, &pBase); 583 /* No RTC - no problems too */ 584 if (RT_SUCCESS(rc)) 585 { 586 Assert(pBase); 587 PPDMIRTCPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIRTCPORT); 588 rc = pPort ? pPort->pfnNotifyHpetLegacy(pPort, fActivate) : VINF_SUCCESS; 589 } 590 else 591 rc = VINF_SUCCESS; 592 587 588 /* Don't bother cleaning up, any failure here will cause a guru meditation. */ 589 590 LogFlow(("pdmR3HpetHlp_SetLegacyMode: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); 593 591 return rc; 594 592 }
Note:
See TracChangeset
for help on using the changeset viewer.