| 548 | } |
| 549 | |
| 550 | void Disk::ReadCapacity10() |
| 551 | { |
| 552 | CheckReady(); |
| 553 | |
| 554 | if (GetBlockCount() == 0) { |
| 555 | throw scsi_exception(sense_key::illegal_request, asc::medium_not_present); |
| 556 | } |
| 557 | |
| 558 | vector<uint8_t>& buf = GetController()->GetBuffer(); |
| 559 | |
| 560 | // Create end of logical block address (blocks-1) |
| 561 | uint64_t capacity = GetBlockCount() - 1; |
| 562 | |
| 563 | // If the capacity exceeds 32 bit, -1 must be returned and the client has to use READ CAPACITY(16) |
| 564 | if (capacity > 4294967295) { |
| 565 | capacity = -1; |
| 566 | } |
| 567 | SetInt32(buf, 0, static_cast<uint32_t>(capacity)); |
| 568 | |
| 569 | // Create block length (1 << size) |
| 570 | SetInt32(buf, 4, 1 << size_shift_count); |
| 571 | |
| 572 | GetController()->SetLength(8); |
| 573 | |
| 574 | EnterDataInPhase(); |
| 575 | } |
| 576 | |
| 577 | void Disk::ReadCapacity16() |
| 578 | { |
nothing calls this directly
no test coverage detected