Lines Matching refs:cSectors

1218     p[6] = RT_H2LE_U16(s->PCHSGeometry.cSectors);
1236 p[56] = RT_H2LE_U16(s->PCHSGeometry.cSectors);
1239 * s->PCHSGeometry.cSectors);
1242 * s->PCHSGeometry.cSectors >> 16);
1451 iLBA = ((s->uATARegHCyl << 8) | s->uATARegLCyl) * s->PCHSGeometry.cHeads * s->PCHSGeometry.cSectors +
1452 (s->uATARegSelect & 0x0f) * s->PCHSGeometry.cSectors +
1486 cyl = iLBA / (s->PCHSGeometry.cHeads * s->PCHSGeometry.cSectors);
1487 r = iLBA % (s->PCHSGeometry.cHeads * s->PCHSGeometry.cSectors);
1490 s->uATARegSelect = (s->uATARegSelect & 0xf0) | ((r / s->PCHSGeometry.cSectors) & 0x0f);
1491 s->uATARegSector = (r % s->PCHSGeometry.cSectors) + 1;
1559 uint32_t cSectors, bool *pfRedo)
1568 rc = s->pDrvBlock->pfnRead(s->pDrvBlock, u64Sector * s->cbSector, pvBuf, cSectors * s->cbSector);
1571 Log4(("ataReadSectors: rc=%Rrc cSectors=%#x u64Sector=%llu\n%.*Rhxd\n",
1572 rc, cSectors, u64Sector, cSectors * s->cbSector, pvBuf));
1574 STAM_REL_COUNTER_ADD(&s->StatBytesRead, cSectors * s->cbSector);
1589 const void *pvBuf, uint32_t cSectors, bool *pfRedo)
1602 rc = s->pDrvBlock->pfnWrite(s->pDrvBlock, u64Sector * s->cbSector, pvBuf, cSectors * s->cbSector);
1609 Log4(("ataWriteSectors: rc=%Rrc cSectors=%#x u64Sector=%llu\n%.*Rhxd\n",
1610 rc, cSectors, u64Sector, cSectors * s->cbSector, pvBuf));
1612 STAM_REL_COUNTER_ADD(&s->StatBytesWritten, cSectors * s->cbSector);
1628 uint32_t cSectors;
1630 cSectors = s->cbTotalTransfer / s->cbSector;
1631 if (cSectors > s->cSectorsPerIRQ)
1634 s->cbElementaryTransfer = cSectors * s->cbSector;
1643 uint32_t cSectors;
1647 cSectors = s->cbElementaryTransfer / s->cbSector;
1648 Assert(cSectors);
1650 Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iLBA));
1651 rc = ataReadSectors(s, iLBA, s->CTX_SUFF(pbIOBuffer), cSectors, &fRedo);
1654 ataSetSector(s, iLBA + cSectors);
1664 LogRel(("PIIX3 ATA: LUN#%d: disk read error (rc=%Rrc iSector=%#RX64 cSectors=%#RX32)\n",
1665 s->iLUN, rc, iLBA, cSectors));
1681 uint32_t cSectors;
1685 cSectors = s->cbElementaryTransfer / s->cbSector;
1686 Assert(cSectors);
1688 Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iLBA));
1689 rc = ataWriteSectors(s, iLBA, s->CTX_SUFF(pbIOBuffer), cSectors, &fRedo);
1692 ataSetSector(s, iLBA + cSectors);
1702 LogRel(("PIIX3 ATA: LUN#%d: disk write error (rc=%Rrc iSector=%#RX64 cSectors=%#RX32)\n",
1703 s->iLUN, rc, iLBA, cSectors));
1859 uint32_t cbTransfer, cSectors;
1863 cSectors = cbTransfer / s->cbATAPISector;
1864 Assert(cSectors * s->cbATAPISector <= cbTransfer);
1865 Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, s->iATAPILBA));
1874 rc = s->pDrvBlock->pfnRead(s->pDrvBlock, (uint64_t)s->iATAPILBA * s->cbATAPISector, s->CTX_SUFF(pbIOBuffer), s->cbATAPISector * cSectors);
1880 for (uint32_t i = s->iATAPILBA; i < s->iATAPILBA + cSectors; i++)
1919 STAM_REL_COUNTER_ADD(&s->StatBytesRead, s->cbATAPISector * cSectors);
1928 s->iATAPILBA += cSectors;
1933 LogRel(("PIIX3 ATA: LUN#%d: CD-ROM read error, %d sectors at LBA %d\n", s->iLUN, cSectors, s->iATAPILBA));
2021 uint32_t iATAPILBA, cSectors, cReqSectors, cbCurrTX;
2035 cSectors = ataBE2H_U16(s->aATAPICmd + 7);
2040 cSectors = ataBE2H_U32(s->aATAPICmd + 6);
2044 cSectors = ataBE2H_U24(s->aATAPICmd + 6);
2048 cSectors = ataMSF2LBA(s->aATAPICmd + 6) - iATAPILBA;
2062 cSectorsMax = RT_MIN(cSectorsMax, cSectors);
2110 ataH2BE_U16(s->aATAPICmd + 7, cSectors - cSectorsMax);
2115 ataH2BE_U32(s->aATAPICmd + 6, cSectors - cSectorsMax);
2119 ataH2BE_U24(s->aATAPICmd + 6, cSectors - cSectorsMax);
2123 ataLBA2MSF(s->aATAPICmd + 6, iATAPILBA + cSectors - cSectorsMax);
2404 static bool atapiReadSectors(ATADevState *s, uint32_t iATAPILBA, uint32_t cSectors, uint32_t cbSector)
2406 Assert(cSectors > 0);
2409 ataStartTransfer(s, cSectors * cbSector, PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_READ, true);
3136 uint32_t cSectors, iATAPILBA;
3150 cSectors = ataBE2H_U16(pbPacket + 7);
3152 cSectors = ataBE2H_U32(pbPacket + 6);
3154 if (cSectors == 0)
3159 if ((uint64_t)iATAPILBA + cSectors > s->cTotalSectors)
3168 LogRel(("PIIX3 ATA: LUN#%d: CD-ROM block number %Ld invalid (READ)\n", s->iLUN, (uint64_t)iATAPILBA + cSectors));
3174 atapiReadSectors(s, iATAPILBA, cSectors, 2048);
3179 uint32_t cSectors, iATAPILBA;
3192 cSectors = (pbPacket[6] << 16) | (pbPacket[7] << 8) | pbPacket[8];
3194 if (cSectors == 0)
3199 if ((uint64_t)iATAPILBA + cSectors > s->cTotalSectors)
3208 LogRel(("PIIX3 ATA: LUN#%d: CD-ROM block number %Ld invalid (READ CD)\n", s->iLUN, (uint64_t)iATAPILBA + cSectors));
3222 atapiReadSectors(s, iATAPILBA, cSectors, 2048);
3226 atapiReadSectors(s, iATAPILBA, cSectors, 2352);
3430 uint32_t cSectors, iATAPILBA;
3500 cSectors = ataBE2H_U16(pbPacket + 7);
3501 Log2(("ATAPI PT: lba %d sectors %d\n", iATAPILBA, cSectors));
3503 cbTransfer = cSectors * s->cbATAPISector;
3508 cSectors = ataBE2H_U32(pbPacket + 6);
3509 Log2(("ATAPI PT: lba %d sectors %d\n", iATAPILBA, cSectors));
3511 cbTransfer = cSectors * s->cbATAPISector;
3571 cSectors = ataMSF2LBA(pbPacket + 6) - ataMSF2LBA(pbPacket + 3);
3572 if (cSectors > 32)
3573 cSectors = 32; /* Limit transfer size to 64~74K. Safety first. In any case this can only harm software doing CDDA extraction. */
3574 cbTransfer = cSectors * s->cbATAPISector;
3665 cSectors = ataBE2H_U16(pbPacket + 7);
3670 Log2(("ATAPI PT: lba %d sectors %d sector size %d\n", iATAPILBA, cSectors, s->cbATAPISector));
3671 cbTransfer = cSectors * s->cbATAPISector;
3676 cSectors = ataBE2H_U32(pbPacket + 6);
3681 Log2(("ATAPI PT: lba %d sectors %d sector size %d\n", iATAPILBA, cSectors, s->cbATAPISector));
3682 cbTransfer = cSectors * s->cbATAPISector;
3897 static int ataTrimSectors(ATADevState *s, uint64_t u64Sector, uint32_t cSectors,
3907 TrimRange.cbRange = cSectors * s->cbSector;
3958 LogRel(("PIIX3 ATA: LUN#%d: disk trim error (rc=%Rrc iSector=%#RX64 cSectors=%#RX32)\n",
6266 pIf->PCHSGeometry.cSectors = 0; /* dummy */
6278 pIf->PCHSGeometry.cSectors = 63; /*??*/
6289 || pIf->PCHSGeometry.cSectors == 0
6295 pIf->PCHSGeometry.cSectors = 63;
6301 LogRel(("PIIX3 ATA: LUN#%d: disk, PCHS=%u/%u/%u, total number of sectors %Ld\n", pIf->iLUN, pIf->PCHSGeometry.cCylinders, pIf->PCHSGeometry.cHeads, pIf->PCHSGeometry.cSectors, pIf->cTotalSectors));
6511 SSMR3PutU32(pSSM, pThis->aCts[i].aIfs[j].PCHSGeometry.cSectors);
6684 SSMR3GetU32(pSSM, &pThis->aCts[i].aIfs[j].PCHSGeometry.cSectors);