mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-29 16:49:55 +00:00
b7f65d33e2
* Make ModeSelect() non-const Signed-off-by: Klaus Kämpf <kkaempf@gmail.com> * Implement ModeSelect for scsicd and honor sector size setting. DEC's VMS can't handle 2k sector sizes and uses ModeSelect6 to set the sector size to 512 bytes. Fixes #1397 Signed-off-by: Klaus Kämpf <kkaempf@gmail.com> * Test sector size setting via ModeSelect in SCSICD Signed-off-by: Klaus Kämpf <kkaempf@gmail.com> * Re-calculate total blocks when sector size changes Signed-off-by: Klaus Kämpf <kkaempf@gmail.com> * Reset CD data tracks after sector size change The track calculation is based on sector size and must be reset after change of sector size. Signed-off-by: Klaus Kämpf <kkaempf@gmail.com> * resize cache after change of sector size The disk cache is based on sector size and must be resized when the sector size changes. Disk::ResizeCache needs a `raw` parameter, make this value accessible from the current cache. Signed-off-by: Klaus Kämpf <kkaempf@gmail.com> * Make GetRawMode const Signed-off-by: Klaus Kämpf <kkaempf@gmail.com> --------- Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator PiSCSI
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2022-2023 Uwe Seimet
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "primary_device.h"
|
|
#include <string>
|
|
#include <span>
|
|
#include <vector>
|
|
#include <map>
|
|
|
|
class ModePageDevice : public PrimaryDevice
|
|
{
|
|
public:
|
|
|
|
using PrimaryDevice::PrimaryDevice;
|
|
|
|
bool Init(const param_map&) override;
|
|
|
|
virtual void ModeSelect(scsi_defs::scsi_command, cdb_t, span<const uint8_t>, int);
|
|
|
|
protected:
|
|
|
|
bool SupportsSaveParameters() const { return supports_save_parameters; }
|
|
void SupportsSaveParameters(bool b) { supports_save_parameters = b; }
|
|
int AddModePages(cdb_t, vector<uint8_t>&, int, int, int) const;
|
|
virtual void SetUpModePages(map<int, vector<byte>>&, int, bool) const = 0;
|
|
virtual void AddVendorPage(map<int, vector<byte>>&, int, bool) const {
|
|
// Nothing to add by default
|
|
}
|
|
|
|
private:
|
|
|
|
bool supports_save_parameters = false;
|
|
|
|
virtual int ModeSense6(cdb_t, vector<uint8_t>&) const = 0;
|
|
virtual int ModeSense10(cdb_t, vector<uint8_t>&) const = 0;
|
|
|
|
void ModeSense6() const;
|
|
void ModeSense10() const;
|
|
void ModeSelect6() const;
|
|
void ModeSelect10() const;
|
|
|
|
void SaveParametersCheck(int) const;
|
|
};
|