Changeset 21615 in vbox for trunk/src/VBox/Devices/Storage/DevAHCI.cpp
- Timestamp:
- Jul 15, 2009 3:26:05 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevAHCI.cpp
r21363 r21615 294 294 uint32_t regFBU; 295 295 /** Interrupt Status. */ 296 uint32_tregIS;296 volatile uint32_t regIS; 297 297 /** Interrupt Enable. */ 298 298 uint32_t regIE; … … 1029 1029 { 1030 1030 ahciLog(("%s: write u32Value=%#010x\n", __FUNCTION__, u32Value)); 1031 pAhciPort->regSERR &= ~u32Value; 1032 if (u32Value & AHCI_PORT_SERR_X) 1033 { 1031 1032 if ( (u32Value & AHCI_PORT_SERR_X) 1033 && (pAhciPort->regSERR & AHCI_PORT_SERR_X)) 1034 { 1035 ASMAtomicAndU32(&pAhciPort->regIS, ~AHCI_PORT_IS_PCS); 1034 1036 pAhciPort->regTFD |= ATA_STAT_ERR; 1035 1037 pAhciPort->regTFD &= ~(ATA_STAT_DRQ | ATA_STAT_BUSY); 1036 1038 } 1039 1040 pAhciPort->regSERR &= ~u32Value; 1041 1037 1042 return VINF_SUCCESS; 1038 1043 } … … 1098 1103 1099 1104 /* We received a COMINIT from the device. Tell the guest. */ 1100 pAhciPort->regIS |= AHCI_PORT_IS_PCS;1105 ASMAtomicOrU32(&pAhciPort->regIS, AHCI_PORT_IS_PCS); 1101 1106 pAhciPort->regSERR |= AHCI_PORT_SERR_X; 1102 1107 pAhciPort->regTFD |= ATA_STAT_BUSY; … … 1105 1110 { 1106 1111 ahciPostFirstD2HFisIntoMemory(pAhciPort); 1107 pAhciPort->regIS |= AHCI_PORT_IS_DHRS;1112 ASMAtomicOrU32(&pAhciPort->regIS, AHCI_PORT_IS_DHRS); 1108 1113 1109 1114 if (pAhciPort->regIE & AHCI_PORT_IE_DHRE) … … 1247 1252 #else 1248 1253 ahciPostFirstD2HFisIntoMemory(pAhciPort); 1249 pAhciPort->regIS |= AHCI_PORT_IS_DHRS;1254 ASMAtomicOrU32(&pAhciPort->regIS, AHCI_PORT_IS_DHRS); 1250 1255 1251 1256 if (pAhciPort->regIE & AHCI_PORT_IE_DHRE) … … 1364 1369 { 1365 1370 ahciLog(("%s: write u32Value=%#010x\n", __FUNCTION__, u32Value)); 1366 pAhciPort->regIS &= ~u32Value; 1367 1368 if (u32Value & AHCI_PORT_IS_PCS) 1369 pAhciPort->regSERR &= ~AHCI_PORT_SERR_X; 1371 ASMAtomicAndU32(&pAhciPort->regIS, ~(u32Value & AHCI_PORT_IS_READONLY)); 1372 1370 1373 return VINF_SUCCESS; 1371 1374 } … … 1502 1505 * notification bits. 1503 1506 */ 1507 bool fClear = true; 1504 1508 1505 1509 ahci->regHbaIs &= ~(u32Value); 1506 1510 1507 if ((!ahci->u32PortsInterrupted) && (!ahci->regHbaIs)) 1511 fClear = (!ahci->u32PortsInterrupted) && (!ahci->regHbaIs); 1512 if (fClear) 1513 { 1514 unsigned i = 0; 1515 1516 /* Check if the cleared ports have a interrupt status bit set. */ 1517 while (u32Value > 0) 1518 { 1519 if (u32Value & 0x01) 1520 { 1521 PAHCIPort pAhciPort = &ahci->ahciPort[i]; 1522 1523 if (pAhciPort->regIE & pAhciPort->regIS) 1524 { 1525 Log(("%s: Interrupt status of port %u set -> Set interrupt again\n", __FUNCTION__, i)); 1526 ASMAtomicOrU32(&ahci->u32PortsInterrupted, 1 << i); 1527 fClear = false; 1528 break; 1529 } 1530 } 1531 u32Value = u32Value >> 1; 1532 i++; 1533 } 1534 } 1535 1536 if (fClear) 1508 1537 ahciHbaClearInterrupt(ahci); 1509 1538 else … … 1791 1820 pAhciPort->regCMD |= AHCI_PORT_CMD_CPS; /* Indicate that there is a device on that port */ 1792 1821 /* We received a COMINIT signal */ 1793 pAhciPort->regSERR |= AHCI_PORT_SERR_X;1794 pAhciPort->regIS |= AHCI_PORT_IS_PCS;1795 1822 pAhciPort->regTFD |= ATA_STAT_BUSY; 1796 1823 … … 3822 3849 { 3823 3850 /* Error bit is set. */ 3824 pAhciPort->regIS |= AHCI_PORT_IS_TFES;3851 ASMAtomicOrU32(&pAhciPort->regIS, AHCI_PORT_IS_TFES); 3825 3852 if (pAhciPort->regIE & AHCI_PORT_IE_TFEE) 3826 3853 fAssertIntr = true; … … 3829 3856 if (fInterrupt) 3830 3857 { 3831 pAhciPort->regIS |= AHCI_PORT_IS_DHRS;3858 ASMAtomicOrU32(&pAhciPort->regIS, AHCI_PORT_IS_DHRS); 3832 3859 /* Check if we should assert an interrupt */ 3833 3860 if (pAhciPort->regIE & AHCI_PORT_IE_DHRE) … … 3873 3900 { 3874 3901 /* Error bit is set. */ 3875 pAhciPort->regIS |= AHCI_PORT_IS_TFES;3902 ASMAtomicOrU32(&pAhciPort->regIS, AHCI_PORT_IS_TFES); 3876 3903 if (pAhciPort->regIE & AHCI_PORT_IE_TFEE) 3877 3904 fAssertIntr = true; … … 3880 3907 if (fInterrupt) 3881 3908 { 3882 pAhciPort->regIS |= AHCI_PORT_IS_SDBS;3909 ASMAtomicOrU32(&pAhciPort->regIS, AHCI_PORT_IS_SDBS); 3883 3910 /* Check if we should assert an interrupt */ 3884 3911 if (pAhciPort->regIE & AHCI_PORT_IE_SDBE) … … 4943 4970 /* Print some infos about the FIS. */ 4944 4971 ahciDumpFisInfo(pAhciPort, &pAhciPortTaskState->cmdFis[0]); 4972 4973 /* Print the PRDT */ 4974 RTGCPHYS GCPhysAddrPRDTLEntryStart = AHCI_RTGCPHYS_FROM_U32(pAhciPortTaskState->cmdHdr.u32CmdTblAddrUp, pAhciPortTaskState->cmdHdr.u32CmdTblAddr) + AHCI_CMDHDR_PRDT_OFFSET; 4975 4976 ahciLog(("PRDT address %RGp number of entries %u\n", GCPhysAddrPRDTLEntryStart, AHCI_CMDHDR_PRDTL_ENTRIES(pAhciPortTaskState->cmdHdr.u32DescInf))); 4977 4978 for (unsigned i = 0; i < AHCI_CMDHDR_PRDTL_ENTRIES(pAhciPortTaskState->cmdHdr.u32DescInf); i++) 4979 { 4980 SGLEntry SGEntry; 4981 4982 ahciLog(("Entry %u at address %RGp\n", i, GCPhysAddrPRDTLEntryStart)); 4983 PDMDevHlpPhysRead(pAhciPort->CTX_SUFF(pDevIns), GCPhysAddrPRDTLEntryStart, &SGEntry, sizeof(SGLEntry)); 4984 4985 RTGCPHYS GCPhysDataAddr = AHCI_RTGCPHYS_FROM_U32(SGEntry.u32DBAUp, SGEntry.u32DBA); 4986 ahciLog(("GCPhysAddr=%RGp Size=%u\n", GCPhysDataAddr, SGEntry.u32DescInf & SGLENTRY_DESCINF_DBC)); 4987 4988 GCPhysAddrPRDTLEntryStart += sizeof(SGLEntry); 4989 } 4945 4990 #endif 4946 4991 } … … 5180 5225 } 5181 5226 5182 ahciLog(("%s: Processing requests\n", __FUNCTION__));5183 5227 ASMAtomicXchgBool(&pAhciPort->fNotificationSend, false); 5184 5228 5185 5229 uint32_t cTasksToProcess = ASMAtomicXchgU32(&pAhciPort->uActTasksActive, 0); 5230 5231 ahciLog(("%s: Processing %u requests\n", __FUNCTION__, cTasksToProcess)); 5186 5232 5187 5233 /* Process commands. */ … … 5351 5397 ahciLog(("%s: After uActReadPos=%u\n", __FUNCTION__, pAhciPort->uActReadPos)); 5352 5398 cTasksToProcess--; 5399 if (!cTasksToProcess) 5400 cTasksToProcess = ASMAtomicXchgU32(&pAhciPort->uActTasksActive, 0); 5353 5401 } 5354 5402 … … 5418 5466 */ 5419 5467 pAhciPort->regCMD |= AHCI_PORT_CMD_CPS; 5420 pAhciPort->regIS |= AHCI_PORT_IS_CPDS | AHCI_PORT_IS_PRCS;5468 ASMAtomicOrU32(&pAhciPort->regIS, AHCI_PORT_IS_CPDS | AHCI_PORT_IS_PRCS); 5421 5469 pAhciPort->regSERR |= AHCI_PORT_SERR_N; 5422 5470 if (pAhciPort->regIE & AHCI_PORT_IE_CPDE) … … 5440 5488 pAhciPort->regSSTS = 0; 5441 5489 pAhciPort->regCMD &= ~AHCI_PORT_CMD_CPS; 5442 pAhciPort->regIS |= AHCI_PORT_IS_CPDS | AHCI_PORT_IS_PRCS;5490 ASMAtomicOrU32(&pAhciPort->regIS, AHCI_PORT_IS_CPDS | AHCI_PORT_IS_PRCS); 5443 5491 pAhciPort->regSERR |= AHCI_PORT_SERR_N; 5444 5492 if (pAhciPort->regIE & AHCI_PORT_IE_CPDE) … … 5853 5901 SSMR3GetGCPhys(pSSMHandle, (RTGCPHYS *)&pAhci->ahciPort[i].GCPhysAddrClb); 5854 5902 SSMR3GetGCPhys(pSSMHandle, (RTGCPHYS *)&pAhci->ahciPort[i].GCPhysAddrFb); 5855 SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].regIS);5903 SSMR3GetU32(pSSMHandle, (uint32_t *)&pAhci->ahciPort[i].regIS); 5856 5904 SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].regIE); 5857 5905 SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].regCMD);
Note:
See TracChangeset
for help on using the changeset viewer.