Changeset 31156 in vbox
- Timestamp:
- Jul 28, 2010 2:49:45 AM (14 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 3 edited
-
DevCodec.cpp (modified) (18 diffs)
-
DevCodec.h (modified) (1 diff)
-
DevIchIntelHDA.cpp (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevCodec.cpp
r31084 r31156 59 59 #define CODEC_B_INDEX(cmd) ((cmd) & CODEC_VERB_B_INDEX) 60 60 61 /* RPM 5.3.1 */62 #define CODEC_RESPONSE_UNSOLICITED RT_BIT_64(34)63 61 64 62 #define STAC9220_NODE_COUNT 0x1C … … 101 99 #define STAC9220_IS_CD_CMD(cmd) (CODEC_NID((cmd)) == 0x15) 102 100 101 #define STAC9220_IS_VOLKNOB_CMD(cmd) (CODEC_NID((cmd)) == 0x15) 102 103 103 /* STAC9220 6.2 & 6.12 */ 104 104 #define STAC9220_IS_RESERVED_CMD(cmd) ( \ … … 123 123 int rc; 124 124 rc = codecUnimplemented(pState, cmd, pResp); 125 *pResp |= CODEC_RESPONSE_UNSOLICITED; 125 *pResp |= CODEC_RESPONSE_UNSOLICITED; /* ??? */ 126 126 return rc; 127 127 } … … 218 218 return VINF_SUCCESS; 219 219 } 220 221 static int codecGetUnsolicitedEnabled(struct CODECState *pState, uint32_t cmd, uint64_t *pResp) 222 { 223 *pResp = 0; 224 if (STAC9220_IS_PORT_CMD(cmd)) 225 *pResp = pState->pNodes[CODEC_NID(cmd)].port.u32F08_param; 226 else if (STAC9220_IS_DIGPIN_CMD(cmd)) 227 *pResp = pState->pNodes[CODEC_NID(cmd)].digin.u32F08_param; 228 else if (STAC9220_IS_AFG_CMD(cmd)) 229 *pResp = pState->pNodes[CODEC_NID(cmd)].afg.u32F08_param; 230 else if (STAC9220_IS_VOLKNOB_CMD(cmd)) 231 *pResp = pState->pNodes[CODEC_NID(cmd)].volumeKnob.u32F08_param; 232 else 233 AssertMsgFailed(("unsuported operation %x on node: %x\n", CODEC_VERB_CMD8(cmd), CODEC_NID(cmd))); 234 return VINF_SUCCESS; 235 } 236 237 static int codecSetUnsolicitedEnabled(struct CODECState *pState, uint32_t cmd, uint64_t *pResp) 238 { 239 *pResp = 0; 240 uint32_t *pu32Reg = NULL; 241 if (STAC9220_IS_PORT_CMD(cmd)) 242 pu32Reg = &pState->pNodes[CODEC_NID(cmd)].port.u32F08_param; 243 else if (STAC9220_IS_DIGPIN_CMD(cmd)) 244 pu32Reg = &pState->pNodes[CODEC_NID(cmd)].digin.u32F08_param; 245 else if (STAC9220_IS_AFG_CMD(cmd)) 246 pu32Reg = &pState->pNodes[CODEC_NID(cmd)].afg.u32F08_param; 247 else if (STAC9220_IS_VOLKNOB_CMD(cmd)) 248 pu32Reg = &pState->pNodes[CODEC_NID(cmd)].volumeKnob.u32F08_param; 249 else 250 AssertMsgFailed(("unsuported operation %x on node: %x\n", CODEC_VERB_CMD8(cmd), CODEC_NID(cmd))); 251 Assert(pu32Reg); 252 *pu32Reg &= ~CODEC_VERB_8BIT_DATA; 253 *pu32Reg |= cmd & CODEC_VERB_8BIT_DATA; 254 return VINF_SUCCESS; 255 } 256 257 static int codecGetPinSence(struct CODECState *pState, uint32_t cmd, uint64_t *pResp) 258 { 259 *pResp = 0; 260 if (STAC9220_IS_PORT_CMD(cmd)) 261 *pResp = pState->pNodes[CODEC_NID(cmd)].port.u32F09_param; 262 else if (STAC9220_IS_DIGPIN_CMD(cmd)) 263 *pResp = pState->pNodes[CODEC_NID(cmd)].digin.u32F09_param; 264 else 265 AssertMsgFailed(("unsuported operation %x on node: %x\n", CODEC_VERB_CMD8(cmd), CODEC_NID(cmd))); 266 return VINF_SUCCESS; 267 } 268 static int codecSetPinSence(struct CODECState *pState, uint32_t cmd, uint64_t *pResp) 269 { 270 *pResp = 0; 271 uint32_t *pu32Reg = NULL; 272 if (STAC9220_IS_PORT_CMD(cmd)) 273 pu32Reg = &pState->pNodes[CODEC_NID(cmd)].port.u32F08_param; 274 else if (STAC9220_IS_DIGPIN_CMD(cmd)) 275 pu32Reg = &pState->pNodes[CODEC_NID(cmd)].digin.u32F08_param; 276 Assert(pu32Reg); 277 if(!pu32Reg) 278 return VINF_SUCCESS; 279 *pu32Reg &= ~CODEC_VERB_8BIT_DATA; 280 *pu32Reg |= cmd & CODEC_VERB_8BIT_DATA; 281 return VINF_SUCCESS; 282 } 283 220 284 static int codecGetConnectionListEntry(struct CODECState *pState, uint32_t cmd, uint64_t *pResp) 221 285 { … … 308 372 } 309 373 310 #if 0311 374 static int codecGetPowerState(struct CODECState *pState, uint32_t cmd, uint64_t *pResp) 312 375 { 313 376 Assert((CODEC_CAD(cmd) == pState->id)); 377 *pResp = 0; 314 378 if (STAC9220_IS_AFG_CMD(cmd)) 315 379 { 316 380 *pResp = pState->pNodes[CODEC_NID(cmd)].afg.u32F05_param; 317 381 } 318 return VINF_SUCCESS; 319 } 320 #endif 382 else if (STAC9220_IS_DAC_CMD(cmd)) 383 { 384 *pResp = pState->pNodes[CODEC_NID(cmd)].dac.u32F05_param; 385 } 386 else if (STAC9220_IS_DIGPIN_CMD(cmd)) 387 { 388 *pResp = pState->pNodes[CODEC_NID(cmd)].digin.u32F05_param; 389 } 390 else if (STAC9220_IS_ADC_CMD(cmd)) 391 { 392 *pResp = pState->pNodes[CODEC_NID(cmd)].adc.u32F05_param; 393 } 394 return VINF_SUCCESS; 395 } 396 397 static int codecSetPowerState(struct CODECState *pState, uint32_t cmd, uint64_t *pResp) 398 { 399 Assert((CODEC_CAD(cmd) == pState->id)); 400 uint32_t *pu32Reg = NULL; 401 *pResp = 0; 402 if (STAC9220_IS_AFG_CMD(cmd)) 403 { 404 pu32Reg = &pState->pNodes[CODEC_NID(cmd)].afg.u32F05_param; 405 } 406 else if (STAC9220_IS_DAC_CMD(cmd)) 407 { 408 pu32Reg = &pState->pNodes[CODEC_NID(cmd)].dac.u32F05_param; 409 } 410 else if (STAC9220_IS_DIGPIN_CMD(cmd)) 411 { 412 pu32Reg = &pState->pNodes[CODEC_NID(cmd)].digin.u32F05_param; 413 } 414 else if (STAC9220_IS_ADC_CMD(cmd)) 415 { 416 pu32Reg = &pState->pNodes[CODEC_NID(cmd)].adc.u32F05_param; 417 } 418 Assert((pu32Reg)); 419 if (!pu32Reg) 420 return VINF_SUCCESS; 421 *pu32Reg &= ~CODEC_VERB_8BIT_DATA; 422 *pu32Reg |= cmd & CODEC_VERB_8BIT_DATA; 423 return VINF_SUCCESS; 424 } 425 321 426 static int codecGetStreamId(struct CODECState *pState, uint32_t cmd, uint64_t *pResp) 322 427 { … … 387 492 { 388 493 pNode->node.id = nodenum; 494 pNode->node.au32F00_param[0xF] = RT_BIT(3)|RT_BIT(0); /* Power statest Supported: D0-yes, D1, D2, D3-no*/ 389 495 switch (nodenum) 390 496 { … … 401 507 pNode->afg.node.name = "AFG"; 402 508 pNode->node.au32F00_param[4] = RT_MAKE_U32_FROM_U8(0x1a, 0x00, 0x02, 0x00); 403 pNode->node.au32F00_param[5] = RT_ MAKE_U32_FROM_U8(0x1, 0x01, 0x00, 0x0);509 pNode->node.au32F00_param[5] = RT_BIT(8)|RT_BIT(0); 404 510 pNode->node.au32F00_param[8] = RT_MAKE_U32_FROM_U8(0x0d, 0x0d, 0x01, 0x0); /* Capabilities */ 405 511 //pNode->node.au32F00_param[0xa] = RT_BIT(19)|RT_BIT(18)|RT_BIT(17)|RT_BIT(10)|RT_BIT(9)|RT_BIT(8)|RT_BIT(7)|RT_BIT(6)|RT_BIT(5); 406 512 pNode->node.au32F00_param[0xa] = RT_BIT(17)|RT_BIT(5); 513 pNode->node.au32F00_param[0xc] = (17 << 8)|RT_BIT(6)|RT_BIT(5)|RT_BIT(2)|RT_BIT(1)|RT_BIT(0); 407 514 pNode->node.au32F00_param[0xb] = RT_BIT(0); 408 515 pNode->node.au32F00_param[0xd] = RT_BIT(31)|(0x5 << 16)|(0xE)<<8; 409 516 pNode->node.au32F00_param[0x12] = RT_BIT(31)|(0x2 << 16)|(0x7f << 8)|0x7f; 410 pNode->afg.u32F05_param = (0x2) << 4 | 0x2; /* PS-Act: 0x2, D2 */ 411 pNode->afg.u32F20_param = 0x83847626; /*STAC9271X */ 412 pNode->afg.u32F08_param = 0; 517 pNode->node.au32F00_param[0x11] = 0; 518 pNode->afg.u32F05_param = 0x3 << 4; /* PS-Act: D3 -> D0 */ 519 pNode->afg.u32F20_param = 0x83847882; 520 pNode->afg.u32F08_param = RT_BIT(7); 413 521 break; 414 522 case 2: … … 433 541 pNode->dac.node.au32F00_param[5] = (0x3 << 4) | 0x3; 434 542 pNode->dac.u32F0c_param = 0; 543 pNode->dac.u32F05_param = 0x3 << 4; /* PS-Act: D3 -> D0 */ 435 544 break; 436 545 case 6: … … 445 554 pNode->adc.node.au32F00_param[0xE] = RT_BIT(0); 446 555 pNode->adc.u32F03_param = RT_BIT(0); 447 pNode->adc.u32F05_param = (0x3 << 4) | 0x3;556 pNode->adc.u32F05_param = 0x3 << 4; /* PS-Act: D3 -> D0 */ 448 557 pNode->adc.u32F06_param = 0; 449 558 pNode->adc.node.au32F00_param[9] = RT_BIT(20)| (0xd << 16) | RT_BIT(10) | RT_BIT(8) | RT_BIT(6)| RT_BIT(0); … … 464 573 case 0xA: 465 574 pNode->node.name = "PortA"; 466 pNode->node.au32F00_param[0xC] = 0x173 f;575 pNode->node.au32F00_param[0xC] = 0x173d; 467 576 *(uint32_t *)pNode->node.au8F02_param = 0x2; 468 pNode->port.u32F07_param = 0; 577 pNode->port.u32F07_param = RT_BIT(6); 578 pNode->port.u32F08_param = RT_BIT(7); 579 pNode->port.u32F09_param = RT_BIT(31)|RT_BIT(30); /* 39.2 kOm */ 469 580 pNode->port.u32F1c_param = RT_MAKE_U32_FROM_U8(0x20, 0x40, 0x21, 0x02); 470 581 goto port_init; … … 473 584 pNode->node.au32F00_param[0xC] = 0x1737; 474 585 *(uint32_t *)pNode->node.au8F02_param = 0x4; 586 pNode->port.u32F09_param = 0; 475 587 pNode->port.u32F07_param = RT_BIT(5); 476 588 pNode->port.u32F1c_param = RT_MAKE_U32_FROM_U8(0x11, 0x60, 0x11, 0x01); … … 480 592 *(uint32_t *)pNode->node.au8F02_param = 0x3; 481 593 pNode->node.au32F00_param[0xC] = 0x1737; 594 pNode->port.u32F09_param = 0; 482 595 pNode->port.u32F07_param = RT_BIT(5); 483 596 pNode->port.u32F1c_param = RT_MAKE_U32_FROM_U8(0x10, 0x40, 0x11, 0x01); … … 485 598 case 0xD: 486 599 pNode->node.name = "PortD"; 600 pNode->port.u32F09_param = 0; 487 601 *(uint32_t *)pNode->node.au8F02_param = 0x2; 488 602 port_init: 489 603 pNode->port.u32F08_param = 0; 490 pNode->port.u32F09_param = 0x7fffffff;491 604 pNode->node.au32F00_param[9] = (4 << 20)|RT_BIT(8)|RT_BIT(7)|RT_BIT(0); 492 605 pNode->node.au32F00_param[0xE] = 0x1; … … 510 623 pNode->port.u32F1c_param = RT_MAKE_U32_FROM_U8(0x12, 0x60, 0x11, 0x01); 511 624 pNode->node.au8F02_param[0] = 0x5; 512 pNode->port.u32F09_param = 0 x7fffffff;625 pNode->port.u32F09_param = 0; 513 626 break; 514 627 case 0x10: … … 526 639 pNode->node.au32F00_param[9] = (4 << 20)|(3<<16)|RT_BIT(10)|RT_BIT(9)|RT_BIT(7)|RT_BIT(0); 527 640 pNode->node.au32F00_param[0xC] = /* RT_BIT(16)|*/ RT_BIT(5)|RT_BIT(2); 528 pNode->digin.u32F05_param = (3 << 4)|0x3;641 pNode->digin.u32F05_param = 0x3 << 4; /* PS-Act: D3 -> D0 */ 529 642 pNode->digin.u32F07_param = 0; 530 643 pNode->digin.u32F08_param = 0; … … 606 719 {0x000F0700, CODEC_VERB_8BIT_CMD , codecGetPinCtrl }, 607 720 {0x00070700, CODEC_VERB_8BIT_CMD , codecSetPinCtrl }, 721 {0x000F0800, CODEC_VERB_8BIT_CMD , codecGetUnsolicitedEnabled }, 722 {0x00070800, CODEC_VERB_8BIT_CMD , codecSetUnsolicitedEnabled }, 723 {0x000F0900, CODEC_VERB_8BIT_CMD , codecGetPinSence }, 724 {0x00070900, CODEC_VERB_8BIT_CMD , codecSetPinSence }, 608 725 {0x000F0200, CODEC_VERB_8BIT_CMD , codecGetConnectionListEntry }, 609 726 {0x000F0300, CODEC_VERB_8BIT_CMD , codecGetProcessingState }, … … 614 731 {0x000F2000, CODEC_VERB_8BIT_CMD , codecGetSubId }, 615 732 {0x0007FF00, CODEC_VERB_8BIT_CMD , codecReset }, 616 #if 0 617 {0x000F0500, CODEC_VERB_8BIT_CMD , codecGetPowerState}, 618 #endif 733 {0x000F0500, CODEC_VERB_8BIT_CMD , codecGetPowerState }, 734 {0x00070500, CODEC_VERB_8BIT_CMD , codecSetPowerState }, 619 735 }; 620 736 … … 627 743 || STAC9220_IS_RESERVED_CMD(cmd)) 628 744 { 629 *pfn = CODEC_VERBDATA(cmd) != 0 ? codecUnimplemented : codecBreak;745 *pfn = codecUnimplemented; 630 746 //** @todo r=michaln: There needs to be a counter to avoid log flooding (see e.g. DevRTC.cpp) 631 747 LogRel(("HDAcodec: cmd %x was ignored\n", cmd)); -
trunk/src/VBox/Devices/Audio/DevCodec.h
r31062 r31156 23 23 typedef FNCODECVERBPROCESSOR *PFNCODECVERBPROCESSOR; 24 24 typedef FNCODECVERBPROCESSOR **PPFNCODECVERBPROCESSOR; 25 26 /* RPM 5.3.1 */ 27 #define CODEC_RESPONSE_UNSOLICITED RT_BIT_64(34) 25 28 26 29 typedef struct CODECVERB -
trunk/src/VBox/Devices/Audio/DevIchIntelHDA.cpp
r31085 r31156 76 76 #define ICH6_HDA_GCTL_RST_SHIFT (0) 77 77 #define ICH6_HDA_GCTL_FSH_SHIFT (1) 78 #define ICH6_HDA_GCTL_UR_SHIFT (8) 78 79 #define GCTL(pState) (HDA_REG((pState), GCTL)) 79 80 … … 379 380 bool fInReset; 380 381 CODECState Codec; 382 uint8_t u8Counter; 381 383 } INTELHDLinkState; 382 384 … … 660 662 else 661 663 prefix = " "; 662 Log((" %s%016 x", prefix, pState->pu64RirbBuf[i + j]));664 Log((" %s%016lx", prefix, pState->pu64RirbBuf[i + j])); 663 665 } while (++j < 8); 664 666 Log(("\n")); … … 668 670 return rc; 669 671 } 672 673 #if 0 674 static int hdaUnsolictedResponse(INTELHDLinkState *pState, uint64_t pu64UnsolictedResponse) 675 { 676 uint8_t rirbWp; 677 if (!HDA_REG_FLAG_VALUE(pState, GCTL, UR)) 678 { 679 Log(("hda: unsolisited response %016lx is ignored\n")); 680 return VINF_SUCCESS; 681 } 682 } 683 #endif 684 670 685 static int hdaCORBCmdProcess(INTELHDLinkState *pState) 671 686 { … … 674 689 uint8_t corbWp; 675 690 uint8_t rirbWp; 676 uint8_t u8Counter = 0;677 691 678 692 PFNCODECVERBPROCESSOR pfn = (PFNCODECVERBPROCESSOR)NULL; … … 689 703 { 690 704 uint32_t cmd; 705 uint64_t resp; 691 706 corbRp++; 692 707 cmd = pState->pu32CorbBuf[corbRp]; … … 696 711 Assert(pfn); 697 712 (rirbWp)++; 698 rc = pfn(&pState->Codec, cmd, & pState->pu64RirbBuf[rirbWp]);713 rc = pfn(&pState->Codec, cmd, &resp); 699 714 if (RT_FAILURE(rc)) 700 715 AssertRCReturn(rc, rc); 701 u8Counter++; 702 if (u8Counter == RINTCNT_N(pState)) 716 Log(("hda: verb:%08x->%016lx\n", cmd, resp)); 717 if ( (resp & CODEC_RESPONSE_UNSOLICITED) 718 && !HDA_REG_FLAG_VALUE(pState, GCTL, UR)) 719 { 720 Log(("hda: unexpected unsolisited response.\n")); 721 pState->au32Regs[ICH6_HDA_REG_CORBRP] = corbRp; 722 return rc; 723 } 724 pState->pu64RirbBuf[rirbWp] = resp; 725 pState->u8Counter++; 726 if (pState->u8Counter == RINTCNT_N(pState)) 703 727 break; 704 728 } … … 710 734 { 711 735 RIRBSTS((pState)) |= HDA_REG_FIELD_FLAG_MASK(RIRBSTS,RINTFL); 736 pState->u8Counter = 0; 712 737 rc = hdaProcessInterrupt(pState); 713 738 } … … 1166 1191 return VINF_SUCCESS; 1167 1192 } 1193 1168 1194 DECLCALLBACK(void) hdaTransfer(CODECState *pCodecState, ENMSOUNDSOURCE src, int avail) 1169 1195 { … … 1501 1527 pThis->dev.config[0x53] = 0x00; /* PM - disabled, */ 1502 1528 1529 #if 0 1503 1530 pThis->dev.config[0x60] = 0x05; 1504 1531 pThis->dev.config[0x61] = 0x70; /* next */ 1505 1532 pThis->dev.config[0x62] = 0x00; 1506 1533 pThis->dev.config[0x63] = 0x80; 1534 #endif 1507 1535 1508 1536 /*
Note:
See TracChangeset
for help on using the changeset viewer.

