- Timestamp:
- Aug 8, 2008 3:50:07 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevPIC.cpp
r11261 r11262 153 153 static inline void DumpPICState(PicState *s, const char *szFn) 154 154 { 155 PDEVPIC pData = PDMINS 2DATA(s->CTX_SUFF(pDevIns), PDEVPIC);155 PDEVPIC pData = PDMINS_2_DATA(s->CTX_SUFF(pDevIns), PDEVPIC); 156 156 157 157 Log2(("%s: pic%d: elcr=%x last_irr=%x irr=%x imr=%x isr=%x irq_base=%x\n", … … 212 212 static int pic_get_irq(PicState *s) 213 213 { 214 PicState *pics = &(PDMINS 2DATA(s->CTX_SUFF(pDevIns), PDEVPIC))->aPics[0];214 PicState *pics = &(PDMINS_2_DATA(s->CTX_SUFF(pDevIns), PDEVPIC))->aPics[0]; 215 215 int mask, cur_priority, priority; 216 216 Log(("pic_get_irq%d: mask=%x\n", (s == pics) ? 0 : 1, s->irr & ~s->imr)); … … 352 352 PDMBOTHCBDECL(void) picSetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel) 353 353 { 354 PDEVPIC pData = PDMINS 2DATA(pDevIns, PDEVPIC);354 PDEVPIC pData = PDMINS_2_DATA(pDevIns, PDEVPIC); 355 355 Assert(pData->CTX_SUFF(pDevIns) == pDevIns); 356 356 Assert(pData->aPics[0].CTX_SUFF(pDevIns) == pDevIns); … … 398 398 PDMBOTHCBDECL(int) picGetInterrupt(PPDMDEVINS pDevIns) 399 399 { 400 PDEVPIC pData = PDMINS 2DATA(pDevIns, PDEVPIC);400 PDEVPIC pData = PDMINS_2_DATA(pDevIns, PDEVPIC); 401 401 int irq; 402 402 int irq2; … … 467 467 { 468 468 PicState *s = (PicState*)opaque; 469 PDEVPIC pData = PDMINS 2DATA(s->CTX_SUFF(pDevIns), PDEVPIC);469 PDEVPIC pData = PDMINS_2_DATA(s->CTX_SUFF(pDevIns), PDEVPIC); 470 470 int rc = VINF_SUCCESS; 471 471 int priority, cmd, irq; … … 587 587 static uint32_t pic_poll_read (PicState *s, uint32_t addr1) 588 588 { 589 PDEVPIC pData = PDMINS 2DATA(s->CTX_SUFF(pDevIns), PDEVPIC);589 PDEVPIC pData = PDMINS_2_DATA(s->CTX_SUFF(pDevIns), PDEVPIC); 590 590 PicState *pics = &pData->aPics[0]; 591 591 int ret; … … 706 706 PDMBOTHCBDECL(int) picIOPortRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb) 707 707 { 708 PDEVPIC pData = PDMINS 2DATA(pDevIns, PDEVPIC);708 PDEVPIC pData = PDMINS_2_DATA(pDevIns, PDEVPIC); 709 709 uint32_t iPic = (uint32_t)(uintptr_t)pvUser; 710 710 … … 734 734 PDMBOTHCBDECL(int) picIOPortWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb) 735 735 { 736 PDEVPIC pData = PDMINS 2DATA(pDevIns, PDEVPIC);736 PDEVPIC pData = PDMINS_2_DATA(pDevIns, PDEVPIC); 737 737 uint32_t iPic = (uint32_t)(uintptr_t)pvUser; 738 738 … … 767 767 { 768 768 PicState *s = (PicState*)pvUser; 769 PIC_LOCK(PDMINS 2DATA(pDevIns, PDEVPIC), VINF_IOM_HC_IOPORT_READ);769 PIC_LOCK(PDMINS_2_DATA(pDevIns, PDEVPIC), VINF_IOM_HC_IOPORT_READ); 770 770 *pu32 = s->elcr; 771 PIC_UNLOCK(PDMINS 2DATA(pDevIns, PDEVPIC));771 PIC_UNLOCK(PDMINS_2_DATA(pDevIns, PDEVPIC)); 772 772 return VINF_SUCCESS; 773 773 } … … 791 791 { 792 792 PicState *s = (PicState*)pvUser; 793 PIC_LOCK(PDMINS 2DATA(pDevIns, PDEVPIC), VINF_IOM_HC_IOPORT_WRITE);793 PIC_LOCK(PDMINS_2_DATA(pDevIns, PDEVPIC), VINF_IOM_HC_IOPORT_WRITE); 794 794 s->elcr = u32 & s->elcr_mask; 795 PIC_UNLOCK(PDMINS 2DATA(pDevIns, PDEVPIC));795 PIC_UNLOCK(PDMINS_2_DATA(pDevIns, PDEVPIC)); 796 796 } 797 797 return VINF_SUCCESS; … … 811 811 static DECLCALLBACK(void) picInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 812 812 { 813 PDEVPIC pData = PDMINS 2DATA(pDevIns, PDEVPIC);813 PDEVPIC pData = PDMINS_2_DATA(pDevIns, PDEVPIC); 814 814 815 815 /* … … 848 848 static DECLCALLBACK(int) picSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle) 849 849 { 850 PDEVPIC pData = PDMINS 2DATA(pDevIns, PDEVPIC);850 PDEVPIC pData = PDMINS_2_DATA(pDevIns, PDEVPIC); 851 851 pic_save(pSSMHandle, &pData->aPics[0]); 852 852 pic_save(pSSMHandle, &pData->aPics[1]); … … 865 865 static DECLCALLBACK(int) picLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version) 866 866 { 867 PDEVPIC pData = PDMINS 2DATA(pDevIns, PDEVPIC);867 PDEVPIC pData = PDMINS_2_DATA(pDevIns, PDEVPIC); 868 868 int rc = pic_load(pSSMHandle, &pData->aPics[0], u32Version); 869 if ( VBOX_SUCCESS(rc))869 if (RT_SUCCESS(rc)) 870 870 rc = pic_load(pSSMHandle, &pData->aPics[1], u32Version); 871 871 return rc; … … 883 883 static DECLCALLBACK(void) picReset(PPDMDEVINS pDevIns) 884 884 { 885 PDEVPIC pData = PDMINS 2DATA(pDevIns, PDEVPIC);885 PDEVPIC pData = PDMINS_2_DATA(pDevIns, PDEVPIC); 886 886 unsigned i; 887 887 LogFlow(("picReset:\n")); 888 888 pData->pPicHlpR3->pfnLock(pDevIns, VERR_INTERNAL_ERROR); 889 889 890 for (i = 0; i < ELEMENTS(pData->aPics); i++)890 for (i = 0; i < RT_ELEMENTS(pData->aPics); i++) 891 891 pic_reset(&pData->aPics[i]); 892 892 … … 900 900 static DECLCALLBACK(void) picRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) 901 901 { 902 PDEVPIC pData = PDMINS 2DATA(pDevIns, PDEVPIC);902 PDEVPIC pData = PDMINS_2_DATA(pDevIns, PDEVPIC); 903 903 unsigned i; 904 904 … … 915 915 static DECLCALLBACK(int) picConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfgHandle) 916 916 { 917 PDEVPIC pData = PDMINS 2DATA(pDevIns, PDEVPIC);917 PDEVPIC pData = PDMINS_2_DATA(pDevIns, PDEVPIC); 918 918 PDMPICREG PicReg; 919 919 int rc; … … 931 931 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 932 932 fGCEnabled = true; 933 else if ( VBOX_FAILURE(rc))933 else if (RT_FAILURE(rc)) 934 934 return PDMDEV_SET_ERROR(pDevIns, rc, 935 935 N_("Configuration error: failed to read GCEnabled as boolean")); … … 938 938 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 939 939 fR0Enabled = true; 940 else if ( VBOX_FAILURE(rc))940 else if (RT_FAILURE(rc)) 941 941 return PDMDEV_SET_ERROR(pDevIns, rc, 942 942 N_("Configuration error: failed to read R0Enabled as boolean")); … … 947 947 * Init the data. 948 948 */ 949 Assert( ELEMENTS(pData->aPics) == 2);949 Assert(RT_ELEMENTS(pData->aPics) == 2); 950 950 pData->pDevInsR3 = pDevIns; 951 951 pData->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); … … 1002 1002 */ 1003 1003 rc = PDMDevHlpIOPortRegister(pDevIns, 0x20, 2, (void *)0, picIOPortWrite, picIOPortRead, NULL, NULL, "i8259 PIC #0"); 1004 if ( VBOX_FAILURE(rc))1004 if (RT_FAILURE(rc)) 1005 1005 return rc; 1006 1006 rc = PDMDevHlpIOPortRegister(pDevIns, 0xa0, 2, (void *)1, picIOPortWrite, picIOPortRead, NULL, NULL, "i8259 PIC #1"); 1007 if ( VBOX_FAILURE(rc))1007 if (RT_FAILURE(rc)) 1008 1008 return rc; 1009 1009 if (fGCEnabled) 1010 1010 { 1011 1011 rc = PDMDevHlpIOPortRegisterGC(pDevIns, 0x20, 2, 0, "picIOPortWrite", "picIOPortRead", NULL, NULL, "i8259 PIC #0"); 1012 if ( VBOX_FAILURE(rc))1012 if (RT_FAILURE(rc)) 1013 1013 return rc; 1014 1014 rc = PDMDevHlpIOPortRegisterGC(pDevIns, 0xa0, 2, 1, "picIOPortWrite", "picIOPortRead", NULL, NULL, "i8259 PIC #1"); 1015 if ( VBOX_FAILURE(rc))1015 if (RT_FAILURE(rc)) 1016 1016 return rc; 1017 1017 } … … 1019 1019 { 1020 1020 rc = PDMDevHlpIOPortRegisterR0(pDevIns, 0x20, 2, 0, "picIOPortWrite", "picIOPortRead", NULL, NULL, "i8259 PIC #0"); 1021 if ( VBOX_FAILURE(rc))1021 if (RT_FAILURE(rc)) 1022 1022 return rc; 1023 1023 rc = PDMDevHlpIOPortRegisterR0(pDevIns, 0xa0, 2, 1, "picIOPortWrite", "picIOPortRead", NULL, NULL, "i8259 PIC #1"); 1024 if ( VBOX_FAILURE(rc))1024 if (RT_FAILURE(rc)) 1025 1025 return rc; 1026 1026 } … … 1028 1028 rc = PDMDevHlpIOPortRegister(pDevIns, 0x4d0, 1, &pData->aPics[0], 1029 1029 picIOPortElcrWrite, picIOPortElcrRead, NULL, NULL, "i8259 PIC #0 - elcr"); 1030 if ( VBOX_FAILURE(rc))1030 if (RT_FAILURE(rc)) 1031 1031 return rc; 1032 1032 rc = PDMDevHlpIOPortRegister(pDevIns, 0x4d1, 1, &pData->aPics[1], 1033 1033 picIOPortElcrWrite, picIOPortElcrRead, NULL, NULL, "i8259 PIC #1 - elcr"); 1034 if ( VBOX_FAILURE(rc))1034 if (RT_FAILURE(rc)) 1035 1035 return rc; 1036 1036 if (fGCEnabled) 1037 1037 { 1038 RT GCPTR pDataGC = PDMINS2DATA_GCPTR(pDevIns);1039 rc = PDMDevHlpIOPortRegisterGC(pDevIns, 0x4d0, 1, pData GC + RT_OFFSETOF(DEVPIC, aPics[0]),1038 RTRCPTR pDataRC = PDMINS_2_DATA_RCPTR(pDevIns); 1039 rc = PDMDevHlpIOPortRegisterGC(pDevIns, 0x4d0, 1, pDataRC + RT_OFFSETOF(DEVPIC, aPics[0]), 1040 1040 "picIOPortElcrWrite", "picIOPortElcrRead", NULL, NULL, "i8259 PIC #0 - elcr"); 1041 if ( VBOX_FAILURE(rc))1041 if (RT_FAILURE(rc)) 1042 1042 return rc; 1043 rc = PDMDevHlpIOPortRegisterGC(pDevIns, 0x4d1, 1, pData GC + RT_OFFSETOF(DEVPIC, aPics[1]),1043 rc = PDMDevHlpIOPortRegisterGC(pDevIns, 0x4d1, 1, pDataRC + RT_OFFSETOF(DEVPIC, aPics[1]), 1044 1044 "picIOPortElcrWrite", "picIOPortElcrRead", NULL, NULL, "i8259 PIC #1 - elcr"); 1045 if ( VBOX_FAILURE(rc))1045 if (RT_FAILURE(rc)) 1046 1046 return rc; 1047 1047 } 1048 1048 if (fR0Enabled) 1049 1049 { 1050 RTR0PTR pDataR0 = PDMINS 2DATA_R0PTR(pDevIns);1050 RTR0PTR pDataR0 = PDMINS_2_DATA_R0PTR(pDevIns); 1051 1051 rc = PDMDevHlpIOPortRegisterR0(pDevIns, 0x4d0, 1, pDataR0 + RT_OFFSETOF(DEVPIC, aPics[0]), 1052 1052 "picIOPortElcrWrite", "picIOPortElcrRead", NULL, NULL, "i8259 PIC #0 - elcr"); 1053 if ( VBOX_FAILURE(rc))1053 if (RT_FAILURE(rc)) 1054 1054 return rc; 1055 1055 rc = PDMDevHlpIOPortRegisterR0(pDevIns, 0x4d1, 1, pDataR0 + RT_OFFSETOF(DEVPIC, aPics[1]), 1056 1056 "picIOPortElcrWrite", "picIOPortElcrRead", NULL, NULL, "i8259 PIC #1 - elcr"); 1057 if ( VBOX_FAILURE(rc))1057 if (RT_FAILURE(rc)) 1058 1058 return rc; 1059 1059 } … … 1062 1062 NULL, picSaveExec, NULL, 1063 1063 NULL, picLoadExec, NULL); 1064 if ( VBOX_FAILURE(rc))1064 if (RT_FAILURE(rc)) 1065 1065 return rc; 1066 1066
Note:
See TracChangeset
for help on using the changeset viewer.