Changeset 44644 in vbox
- Timestamp:
- Feb 11, 2013 7:50:48 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 83732
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchIntelHDA.cpp
r44643 r44644 491 491 static FNPDMDEVRESET hdaReset; 492 492 493 static int hdaRegReadUnimplemented(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value);494 static int hdaRegWriteUnimplemented(PHDASTATE pThis, uint32_t i ndex, uint32_t pu32Value);495 static int hdaRegReadGCTL(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value);496 static int hdaRegWriteGCTL(PHDASTATE pThis, uint32_t i ndex, uint32_t pu32Value);497 static int hdaRegReadSTATESTS(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value);498 static int hdaRegWriteSTATESTS(PHDASTATE pThis, uint32_t i ndex, uint32_t pu32Value);499 static int hdaRegReadGCAP(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value);500 static int hdaRegReadINTSTS(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value);501 static int hdaRegReadWALCLK(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value);502 static int hdaRegWriteINTSTS(PHDASTATE pThis, uint32_t i ndex, uint32_t pu32Value);503 static int hdaRegWriteCORBWP(PHDASTATE pThis, uint32_t i ndex, uint32_t pu32Value);504 static int hdaRegWriteCORBRP(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value);505 static int hdaRegWriteCORBCTL(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value);506 static int hdaRegWriteCORBSTS(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value);507 static int hdaRegWriteRIRBWP(PHDASTATE pThis, uint32_t i ndex, uint32_t pu32Value);508 static int hdaRegWriteRIRBSTS(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value);509 static int hdaRegWriteIRS(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value);510 static int hdaRegReadIRS(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value);511 static int hdaRegWriteSDCTL(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value);512 static int hdaRegReadSDCTL(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value);513 514 static int hdaRegWriteSDSTS(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value);515 static int hdaRegWriteSDLVI(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value);516 static int hdaRegWriteSDFIFOW(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value);517 static int hdaRegWriteSDFIFOS(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value);518 static int hdaRegWriteSDFMT(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value);519 static int hdaRegWriteSDBDPL(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value);520 static int hdaRegWriteSDBDPU(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value);521 static int hdaRegWriteBase(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value);522 static int hdaRegReadU32(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value);523 static int hdaRegWriteU32(PHDASTATE pThis, uint32_t i ndex, uint32_t pu32Value);524 static int hdaRegReadU24(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value);525 static int hdaRegWriteU24(PHDASTATE pThis, uint32_t i ndex, uint32_t pu32Value);526 static int hdaRegReadU16(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value);527 static int hdaRegWriteU16(PHDASTATE pThis, uint32_t i ndex, uint32_t pu32Value);528 static int hdaRegReadU8(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value);529 static int hdaRegWriteU8(PHDASTATE pThis, uint32_t i ndex, uint32_t pu32Value);493 static int hdaRegReadUnimplemented(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value); 494 static int hdaRegWriteUnimplemented(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value); 495 static int hdaRegReadGCTL(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value); 496 static int hdaRegWriteGCTL(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value); 497 static int hdaRegReadSTATESTS(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value); 498 static int hdaRegWriteSTATESTS(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value); 499 static int hdaRegReadGCAP(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value); 500 static int hdaRegReadINTSTS(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value); 501 static int hdaRegReadWALCLK(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value); 502 static int hdaRegWriteINTSTS(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value); 503 static int hdaRegWriteCORBWP(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value); 504 static int hdaRegWriteCORBRP(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value); 505 static int hdaRegWriteCORBCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value); 506 static int hdaRegWriteCORBSTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value); 507 static int hdaRegWriteRIRBWP(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value); 508 static int hdaRegWriteRIRBSTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value); 509 static int hdaRegWriteIRS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value); 510 static int hdaRegReadIRS(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value); 511 static int hdaRegWriteSDCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value); 512 static int hdaRegReadSDCTL(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value); 513 514 static int hdaRegWriteSDSTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value); 515 static int hdaRegWriteSDLVI(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value); 516 static int hdaRegWriteSDFIFOW(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value); 517 static int hdaRegWriteSDFIFOS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value); 518 static int hdaRegWriteSDFMT(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value); 519 static int hdaRegWriteSDBDPL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value); 520 static int hdaRegWriteSDBDPU(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value); 521 static int hdaRegWriteBase(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value); 522 static int hdaRegReadU32(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value); 523 static int hdaRegWriteU32(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value); 524 static int hdaRegReadU24(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value); 525 static int hdaRegWriteU24(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value); 526 static int hdaRegReadU16(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value); 527 static int hdaRegWriteU16(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value); 528 static int hdaRegReadU8(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value); 529 static int hdaRegWriteU8(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value); 530 530 531 531 DECLINLINE(void) hdaInitTransferDescriptor(PHDASTATE pThis, PHDABDLEDESC pBdle, uint8_t u8Strm, … … 553 553 uint32_t writable; 554 554 /** Read callback. */ 555 int (*pfnRead)(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value);555 int (*pfnRead)(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value); 556 556 /** Write callback. */ 557 int (*pfnWrite)(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value);557 int (*pfnWrite)(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value); 558 558 /** Abbreviated name. */ 559 559 const char *abbrev; … … 966 966 /* Register access handlers. */ 967 967 968 static int hdaRegReadUnimplemented(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value)968 static int hdaRegReadUnimplemented(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value) 969 969 { 970 970 *pu32Value = 0; … … 972 972 } 973 973 974 static int hdaRegWriteUnimplemented(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)974 static int hdaRegWriteUnimplemented(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 975 975 { 976 976 return VINF_SUCCESS; … … 978 978 979 979 /* U8 */ 980 static int hdaRegReadU8(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value)981 { 982 Assert(((pThis->au32Regs[i ndex] & g_aIchIntelHDRegMap[index].readable) & 0xffffff00) == 0);983 return hdaRegReadU32(pThis, i ndex, pu32Value);984 } 985 986 static int hdaRegWriteU8(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)980 static int hdaRegReadU8(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value) 981 { 982 Assert(((pThis->au32Regs[iReg] & g_aIchIntelHDRegMap[iReg].readable) & 0xffffff00) == 0); 983 return hdaRegReadU32(pThis, iReg, pu32Value); 984 } 985 986 static int hdaRegWriteU8(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 987 987 { 988 988 Assert((u32Value & 0xffffff00) == 0); 989 return hdaRegWriteU32(pThis, i ndex, u32Value);989 return hdaRegWriteU32(pThis, iReg, u32Value); 990 990 } 991 991 992 992 /* U16 */ 993 static int hdaRegReadU16(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value)994 { 995 Assert(((pThis->au32Regs[i ndex] & g_aIchIntelHDRegMap[index].readable) & 0xffff0000) == 0);996 return hdaRegReadU32(pThis, i ndex, pu32Value);997 } 998 999 static int hdaRegWriteU16(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)993 static int hdaRegReadU16(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value) 994 { 995 Assert(((pThis->au32Regs[iReg] & g_aIchIntelHDRegMap[iReg].readable) & 0xffff0000) == 0); 996 return hdaRegReadU32(pThis, iReg, pu32Value); 997 } 998 999 static int hdaRegWriteU16(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1000 1000 { 1001 1001 Assert((u32Value & 0xffff0000) == 0); 1002 return hdaRegWriteU32(pThis, i ndex, u32Value);1002 return hdaRegWriteU32(pThis, iReg, u32Value); 1003 1003 } 1004 1004 1005 1005 /* U24 */ 1006 static int hdaRegReadU24(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value)1007 { 1008 Assert(((pThis->au32Regs[i ndex] & g_aIchIntelHDRegMap[index].readable) & 0xff000000) == 0);1009 return hdaRegReadU32(pThis, i ndex, pu32Value);1010 } 1011 1012 static int hdaRegWriteU24(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1006 static int hdaRegReadU24(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value) 1007 { 1008 Assert(((pThis->au32Regs[iReg] & g_aIchIntelHDRegMap[iReg].readable) & 0xff000000) == 0); 1009 return hdaRegReadU32(pThis, iReg, pu32Value); 1010 } 1011 1012 static int hdaRegWriteU24(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1013 1013 { 1014 1014 Assert((u32Value & 0xff000000) == 0); 1015 return hdaRegWriteU32(pThis, i ndex, u32Value);1015 return hdaRegWriteU32(pThis, iReg, u32Value); 1016 1016 } 1017 1017 1018 1018 /* U32 */ 1019 static int hdaRegReadU32(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value)1020 { 1021 *pu32Value = pThis->au32Regs[i ndex] & g_aIchIntelHDRegMap[index].readable;1019 static int hdaRegReadU32(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value) 1020 { 1021 *pu32Value = pThis->au32Regs[iReg] & g_aIchIntelHDRegMap[iReg].readable; 1022 1022 return VINF_SUCCESS; 1023 1023 } 1024 1024 1025 static int hdaRegWriteU32(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1026 { 1027 pThis->au32Regs[i ndex] = (u32Value & g_aIchIntelHDRegMap[index].writable)1028 | (pThis->au32Regs[index] & ~g_aIchIntelHDRegMap[index].writable);1025 static int hdaRegWriteU32(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1026 { 1027 pThis->au32Regs[iReg] = (u32Value & g_aIchIntelHDRegMap[iReg].writable) 1028 | (pThis->au32Regs[iReg] & ~g_aIchIntelHDRegMap[iReg].writable); 1029 1029 return VINF_SUCCESS; 1030 1030 } 1031 1031 1032 static int hdaRegReadGCTL(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value)1033 { 1034 return hdaRegReadU32(pThis, i ndex, pu32Value);1035 } 1036 1037 static int hdaRegWriteGCTL(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1032 static int hdaRegReadGCTL(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value) 1033 { 1034 return hdaRegReadU32(pThis, iReg, pu32Value); 1035 } 1036 1037 static int hdaRegWriteGCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1038 1038 { 1039 1039 if (u32Value & HDA_REG_FIELD_FLAG_MASK(GCTL, RST)) … … 1066 1066 } 1067 1067 1068 static int hdaRegWriteSTATESTS(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1069 { 1070 uint32_t v = pThis->au32Regs[i ndex];1068 static int hdaRegWriteSTATESTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1069 { 1070 uint32_t v = pThis->au32Regs[iReg]; 1071 1071 uint32_t nv = u32Value & ICH6_HDA_STATES_SCSF; 1072 pThis->au32Regs[i ndex] &= ~(v & nv); /* write of 1 clears corresponding bit */1072 pThis->au32Regs[iReg] &= ~(v & nv); /* write of 1 clears corresponding bit */ 1073 1073 return VINF_SUCCESS; 1074 1074 } 1075 1075 1076 static int hdaRegReadINTSTS(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value)1076 static int hdaRegReadINTSTS(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value) 1077 1077 { 1078 1078 uint32_t v = 0; … … 1100 1100 } 1101 1101 1102 static int hdaRegReadWALCLK(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value)1102 static int hdaRegReadWALCLK(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value) 1103 1103 { 1104 1104 /* HDA spec (1a): 3.3.16 WALCLK counter ticks with 24Mhz bitclock rate. */ … … 1108 1108 } 1109 1109 1110 static int hdaRegReadGCAP(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value)1111 { 1112 return hdaRegReadU16(pThis, i ndex, pu32Value);1113 } 1114 1115 static int hdaRegWriteCORBRP(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1110 static int hdaRegReadGCAP(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value) 1111 { 1112 return hdaRegReadU16(pThis, iReg, pu32Value); 1113 } 1114 1115 static int hdaRegWriteCORBRP(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1116 1116 { 1117 1117 if (u32Value & HDA_REG_FIELD_FLAG_MASK(CORBRP, RST)) 1118 1118 CORBRP(pThis) = 0; 1119 1119 else 1120 return hdaRegWriteU8(pThis, i ndex, u32Value);1120 return hdaRegWriteU8(pThis, iReg, u32Value); 1121 1121 return VINF_SUCCESS; 1122 1122 } 1123 1123 1124 static int hdaRegWriteCORBCTL(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1125 { 1126 int rc = hdaRegWriteU8(pThis, i ndex, u32Value);1124 static int hdaRegWriteCORBCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1125 { 1126 int rc = hdaRegWriteU8(pThis, iReg, u32Value); 1127 1127 AssertRC(rc); 1128 1128 if ( CORBWP(pThis) != CORBRP(pThis) … … 1132 1132 } 1133 1133 1134 static int hdaRegWriteCORBSTS(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1134 static int hdaRegWriteCORBSTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1135 1135 { 1136 1136 uint32_t v = CORBSTS(pThis); … … 1139 1139 } 1140 1140 1141 static int hdaRegWriteCORBWP(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1141 static int hdaRegWriteCORBWP(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1142 1142 { 1143 1143 int rc; 1144 rc = hdaRegWriteU16(pThis, i ndex, u32Value);1144 rc = hdaRegWriteU16(pThis, iReg, u32Value); 1145 1145 if (RT_FAILURE(rc)) 1146 1146 AssertRCReturn(rc, rc); … … 1153 1153 } 1154 1154 1155 static int hdaRegReadSDCTL(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value)1156 { 1157 return hdaRegReadU24(pThis, i ndex, pu32Value);1158 } 1159 1160 static int hdaRegWriteSDCTL(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1155 static int hdaRegReadSDCTL(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value) 1156 { 1157 return hdaRegReadU24(pThis, iReg, pu32Value); 1158 } 1159 1160 static int hdaRegWriteSDCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1161 1161 { 1162 1162 bool fRun = RT_BOOL(u32Value & HDA_REG_FIELD_FLAG_MASK(SDCTL, RUN)); 1163 bool fInRun = RT_BOOL(HDA_REG_IND(pThis, i ndex) & HDA_REG_FIELD_FLAG_MASK(SDCTL, RUN));1163 bool fInRun = RT_BOOL(HDA_REG_IND(pThis, iReg) & HDA_REG_FIELD_FLAG_MASK(SDCTL, RUN)); 1164 1164 bool fReset = RT_BOOL(u32Value & HDA_REG_FIELD_FLAG_MASK(SDCTL, SRST)); 1165 bool fInReset = RT_BOOL(HDA_REG_IND(pThis, i ndex) & HDA_REG_FIELD_FLAG_MASK(SDCTL, SRST));1165 bool fInReset = RT_BOOL(HDA_REG_IND(pThis, iReg) & HDA_REG_FIELD_FLAG_MASK(SDCTL, SRST)); 1166 1166 int rc = VINF_SUCCESS; 1167 1167 if (fInReset) … … 1183 1183 HDASTREAMTRANSFERDESC StreamDesc; 1184 1184 Assert((!fInRun && !fRun)); 1185 switch (i ndex)1185 switch (iReg) 1186 1186 { 1187 1187 case ICH6_HDA_REG_SD0CTL: … … 1208 1208 { 1209 1209 Assert((!fReset && !fInReset)); 1210 switch (i ndex)1210 switch (iReg) 1211 1211 { 1212 1212 case ICH6_HDA_REG_SD0CTL: … … 1223 1223 1224 1224 l_done: 1225 rc = hdaRegWriteU24(pThis, i ndex, u32Value);1225 rc = hdaRegWriteU24(pThis, iReg, u32Value); 1226 1226 if (RT_FAILURE(rc)) 1227 1227 AssertRCReturn(rc, VINF_SUCCESS); … … 1229 1229 } 1230 1230 1231 static int hdaRegWriteSDSTS(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1232 { 1233 uint32_t v = HDA_REG_IND(pThis, i ndex);1231 static int hdaRegWriteSDSTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1232 { 1233 uint32_t v = HDA_REG_IND(pThis, iReg); 1234 1234 v &= ~(u32Value & v); 1235 HDA_REG_IND(pThis, i ndex) = v;1235 HDA_REG_IND(pThis, iReg) = v; 1236 1236 hdaProcessInterrupt(pThis); 1237 1237 return VINF_SUCCESS; 1238 1238 } 1239 1239 1240 static int hdaRegWriteSDLVI(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1241 { 1242 int rc = hdaRegWriteU32(pThis, i ndex, u32Value);1240 static int hdaRegWriteSDLVI(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1241 { 1242 int rc = hdaRegWriteU32(pThis, iReg, u32Value); 1243 1243 if (RT_FAILURE(rc)) 1244 1244 AssertRCReturn(rc, VINF_SUCCESS); … … 1246 1246 } 1247 1247 1248 static int hdaRegWriteSDFIFOW(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1248 static int hdaRegWriteSDFIFOW(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1249 1249 { 1250 1250 switch (u32Value) … … 1253 1253 case HDA_SDFIFOW_16B: 1254 1254 case HDA_SDFIFOW_32B: 1255 return hdaRegWriteU16(pThis, i ndex, u32Value);1255 return hdaRegWriteU16(pThis, iReg, u32Value); 1256 1256 default: 1257 1257 Log(("hda: Attempt to store unsupported value(%x) in SDFIFOW\n", u32Value)); 1258 return hdaRegWriteU16(pThis, i ndex, HDA_SDFIFOW_32B);1258 return hdaRegWriteU16(pThis, iReg, HDA_SDFIFOW_32B); 1259 1259 } 1260 1260 return VINF_SUCCESS; 1261 1261 } 1262 1262 1263 /* 1264 * Note this method could be called for changing value on Output Streams only (ICH6 datasheet 18.2.39)1265 * 1266 */ 1267 static int hdaRegWriteSDFIFOS(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1268 { 1269 switch (i ndex)1263 /** 1264 * @note This method could be called for changing value on Output Streams 1265 * only (ICH6 datasheet 18.2.39) 1266 */ 1267 static int hdaRegWriteSDFIFOS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1268 { 1269 switch (iReg) 1270 1270 { 1271 1271 /* SDInFIFOS is RO, n=0-3 */ … … 1287 1287 case HDA_SDONFIFO_128B: 1288 1288 case HDA_SDONFIFO_192B: 1289 return hdaRegWriteU16(pThis, i ndex, u32Value);1289 return hdaRegWriteU16(pThis, iReg, u32Value); 1290 1290 1291 1291 case HDA_SDONFIFO_256B: 1292 1292 Log(("hda: 256-bit is unsupported, HDA is switched into 192-bit mode\n")); 1293 1293 default: 1294 return hdaRegWriteU16(pThis, i ndex, HDA_SDONFIFO_192B);1294 return hdaRegWriteU16(pThis, iReg, HDA_SDONFIFO_192B); 1295 1295 } 1296 1296 return VINF_SUCCESS; … … 1359 1359 } 1360 1360 1361 static int hdaRegWriteSDFMT(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1361 static int hdaRegWriteSDFMT(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1362 1362 { 1363 1363 #ifdef VBOX_WITH_HDA_CODEC_EMU … … 1366 1366 audsettings_t as; 1367 1367 /* no reason to reopen voice with same settings */ 1368 if (u32Value == HDA_REG_IND(pThis, i ndex))1368 if (u32Value == HDA_REG_IND(pThis, iReg)) 1369 1369 return VINF_SUCCESS; 1370 1370 hdaSdFmtToAudSettings(u32Value, &as); 1371 switch (i ndex)1371 switch (iReg) 1372 1372 { 1373 1373 case ICH6_HDA_REG_SD0FMT: … … 1378 1378 break; 1379 1379 default: 1380 Log(("HDA: attempt to change format on %d\n", i ndex));1380 Log(("HDA: attempt to change format on %d\n", iReg)); 1381 1381 rc = 0; 1382 1382 } 1383 return hdaRegWriteU16(pThis, i ndex, u32Value);1383 return hdaRegWriteU16(pThis, iReg, u32Value); 1384 1384 #else 1385 return hdaRegWriteU16(pThis, i ndex, u32Value);1385 return hdaRegWriteU16(pThis, iReg, u32Value); 1386 1386 #endif 1387 1387 } 1388 1388 1389 static int hdaRegWriteSDBDPL(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1390 { 1391 int rc = hdaRegWriteU32(pThis, i ndex, u32Value);1389 static int hdaRegWriteSDBDPL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1390 { 1391 int rc = hdaRegWriteU32(pThis, iReg, u32Value); 1392 1392 if (RT_FAILURE(rc)) 1393 1393 AssertRCReturn(rc, VINF_SUCCESS); … … 1395 1395 } 1396 1396 1397 static int hdaRegWriteSDBDPU(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1398 { 1399 int rc = hdaRegWriteU32(pThis, i ndex, u32Value);1397 static int hdaRegWriteSDBDPU(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1398 { 1399 int rc = hdaRegWriteU32(pThis, iReg, u32Value); 1400 1400 if (RT_FAILURE(rc)) 1401 1401 AssertRCReturn(rc, VINF_SUCCESS); … … 1403 1403 } 1404 1404 1405 static int hdaRegReadIRS(PHDASTATE pThis, uint32_t i ndex, uint32_t *pu32Value)1405 static int hdaRegReadIRS(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value) 1406 1406 { 1407 1407 int rc = VINF_SUCCESS; … … 1411 1411 IRS(pThis) = HDA_REG_FIELD_FLAG_MASK(IRS, ICB); /* busy */ 1412 1412 1413 rc = hdaRegReadU32(pThis, i ndex, pu32Value);1413 rc = hdaRegReadU32(pThis, iReg, pu32Value); 1414 1414 return rc; 1415 1415 } 1416 1416 1417 static int hdaRegWriteIRS(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1417 static int hdaRegWriteIRS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1418 1418 { 1419 1419 int rc = VINF_SUCCESS; … … 1459 1459 } 1460 1460 1461 static int hdaRegWriteRIRBWP(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1461 static int hdaRegWriteRIRBWP(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1462 1462 { 1463 1463 if (u32Value & HDA_REG_FIELD_FLAG_MASK(RIRBWP, RST)) … … 1469 1469 } 1470 1470 1471 static int hdaRegWriteBase(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1472 { 1473 int rc = hdaRegWriteU32(pThis, i ndex, u32Value);1471 static int hdaRegWriteBase(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1472 { 1473 int rc = hdaRegWriteU32(pThis, iReg, u32Value); 1474 1474 if (RT_FAILURE(rc)) 1475 1475 AssertRCReturn(rc, rc); 1476 switch(i ndex)1476 switch(iReg) 1477 1477 { 1478 1478 case ICH6_HDA_REG_CORBLBASE: 1479 1479 pThis->u64CORBBase &= 0xFFFFFFFF00000000ULL; 1480 pThis->u64CORBBase |= pThis->au32Regs[i ndex];1480 pThis->u64CORBBase |= pThis->au32Regs[iReg]; 1481 1481 break; 1482 1482 case ICH6_HDA_REG_CORBUBASE: 1483 1483 pThis->u64CORBBase &= 0x00000000FFFFFFFFULL; 1484 pThis->u64CORBBase |= ((uint64_t)pThis->au32Regs[i ndex] << 32);1484 pThis->u64CORBBase |= ((uint64_t)pThis->au32Regs[iReg] << 32); 1485 1485 break; 1486 1486 case ICH6_HDA_REG_RIRLBASE: 1487 1487 pThis->u64RIRBBase &= 0xFFFFFFFF00000000ULL; 1488 pThis->u64RIRBBase |= pThis->au32Regs[i ndex];1488 pThis->u64RIRBBase |= pThis->au32Regs[iReg]; 1489 1489 break; 1490 1490 case ICH6_HDA_REG_RIRUBASE: 1491 1491 pThis->u64RIRBBase &= 0x00000000FFFFFFFFULL; 1492 pThis->u64RIRBBase |= ((uint64_t)pThis->au32Regs[i ndex] << 32);1492 pThis->u64RIRBBase |= ((uint64_t)pThis->au32Regs[iReg] << 32); 1493 1493 break; 1494 1494 case ICH6_HDA_REG_DPLBASE: 1495 1495 /* @todo: first bit has special meaning */ 1496 1496 pThis->u64DPBase &= 0xFFFFFFFF00000000ULL; 1497 pThis->u64DPBase |= pThis->au32Regs[i ndex];1497 pThis->u64DPBase |= pThis->au32Regs[iReg]; 1498 1498 break; 1499 1499 case ICH6_HDA_REG_DPUBASE: 1500 1500 pThis->u64DPBase &= 0x00000000FFFFFFFFULL; 1501 pThis->u64DPBase |= ((uint64_t)pThis->au32Regs[i ndex] << 32);1501 pThis->u64DPBase |= ((uint64_t)pThis->au32Regs[iReg] << 32); 1502 1502 break; 1503 1503 default: … … 1508 1508 } 1509 1509 1510 static int hdaRegWriteRIRBSTS(PHDASTATE pThis, uint32_t i ndex, uint32_t u32Value)1510 static int hdaRegWriteRIRBSTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value) 1511 1511 { 1512 1512 uint8_t v = RIRBSTS(pThis);
Note:
See TracChangeset
for help on using the changeset viewer.