|
|
1.1 ! root 1: // ! 2: // nono ! 3: // Copyright (C) 2024 nono project ! 4: // Licensed under nono-license.txt ! 5: // ! 6: ! 7: // ! 8: // VirtIO SCSI デバイス ! 9: // ! 10: ! 11: #pragma once ! 12: ! 13: #include "virtio_base.h" ! 14: #include <array> ! 15: ! 16: class SCSIDomain; ! 17: class SCSIHostDevice; ! 18: ! 19: class VirtIOSCSIDevice : public VirtIODevice ! 20: { ! 21: using inherited = VirtIODevice; ! 22: public: ! 23: VirtIOSCSIDevice(uint slot_); ! 24: ~VirtIOSCSIDevice() override; ! 25: ! 26: bool Create() override; ! 27: bool Init() override; ! 28: void ResetHard(bool poweron) override; ! 29: ! 30: SCSIDomain *GetDomain() const noexcept { return domain.get(); } ! 31: ! 32: // アクセス状況を返す ! 33: void GetAccess(std::array<uint32, 16> *dst) const { *dst = access; } ! 34: ! 35: private: ! 36: DECLARE_MONITOR_CALLBACK(MonitorUpdate); ! 37: ! 38: void ProcessDesc(VirtIOReq&) override; ! 39: ! 40: void ProcessDescControl(VirtIOReq&); ! 41: void ProcessDescEvent(VirtIOReq&); ! 42: void ProcessDescRequest(VirtIOReq&); ! 43: void ProcessDescRequestError(VirtIOReq&, uint32 response, uint32 residual); ! 44: ! 45: const char *GetFeatureName(uint feature) const override; ! 46: ! 47: // SCSI 管理 ! 48: std::unique_ptr<SCSIDomain> domain /*{}*/; ! 49: ! 50: // SCSI ホスト ! 51: SCSIHostDevice *host {}; ! 52: ! 53: uint32 sense_size {}; ! 54: uint32 cdb_size {}; ! 55: ! 56: // アクセスインジケータ用。 ! 57: // [0] が ID0 の read 用、[1] が ID0 の write 用、 ! 58: // [2] が ID1 の read 用、[3] が ID1 の write 用、 ! 59: // …の要領で並べてある。 ! 60: std::array<uint32, 8 * 2> access {}; ! 61: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.