| 109 | } |
| 110 | |
| 111 | void PrimaryDevice::ReportLuns() |
| 112 | { |
| 113 | // Only SELECT REPORT mode 0 is supported |
| 114 | if (GetController()->GetCmdByte(2)) { |
| 115 | throw scsi_exception(sense_key::illegal_request, asc::invalid_field_in_cdb); |
| 116 | } |
| 117 | |
| 118 | const uint32_t allocation_length = GetInt32(GetController()->GetCmd(), 6); |
| 119 | |
| 120 | vector<uint8_t>& buf = GetController()->GetBuffer(); |
| 121 | fill_n(buf.begin(), min(buf.size(), static_cast<size_t>(allocation_length)), 0); |
| 122 | |
| 123 | uint32_t size = 0; |
| 124 | for (int lun = 0; lun < GetController()->GetMaxLuns(); lun++) { |
| 125 | if (GetController()->HasDeviceForLun(lun)) { |
| 126 | size += 8; |
| 127 | buf[size + 7] = (uint8_t)lun; |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | SetInt16(buf, 2, size); |
| 132 | |
| 133 | size += 8; |
| 134 | |
| 135 | GetController()->SetLength(min(allocation_length, size)); |
| 136 | |
| 137 | EnterDataInPhase(); |
| 138 | } |
| 139 | |
| 140 | void PrimaryDevice::RequestSense() |
| 141 | { |
nothing calls this directly
no test coverage detected