Improve OpenVMS/VAX compatibility (issue #1117) (#1123)

* Set TB, PER and DTE bits in read/write error recovery page

* Fixed typo

* Added unit test

* Comment update
This commit is contained in:
Uwe Seimet 2023-03-15 22:38:44 +01:00 committed by GitHub
parent b6cc6a23af
commit ef6cd97656
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 3 deletions

View File

@ -396,7 +396,12 @@ void Disk::SetUpModePages(map<int, vector<byte>>& pages, int page, bool changeab
void Disk::AddErrorPage(map<int, vector<byte>>& pages, bool) const
{
// Retry count is 0, limit time uses internal default value
pages[1] = vector<byte>(12);
vector<byte> buf(12);
// TB, PER, DTE (required for OpenVMS/VAX compatibility, see issue #1117)
buf[2] = (byte)0x26;
pages[1] = buf;
}
void Disk::AddFormatPage(map<int, vector<byte>>& pages, bool changeable) const

View File

@ -3,7 +3,7 @@
// SCSI Target Emulator PiSCSI
// for Raspberry Pi
//
// Copyright (C) 2022 Uwe Seimet
// Copyright (C) 2022-2023 Uwe Seimet
//
//---------------------------------------------------------------------------
@ -358,6 +358,7 @@ class MockSCSIHD : public SCSIHD //NOSONAR Ignore inheritance hierarchy depth in
class MockSCSIHD_NEC : public SCSIHD_NEC //NOSONAR Ignore inheritance hierarchy depth in unit tests
{
FRIEND_TEST(ScsiHdNecTest, SetUpModePages);
FRIEND_TEST(ScsiHdNecTest, TestAddErrorPage);
FRIEND_TEST(ScsiHdNecTest, TestAddFormatPage);
FRIEND_TEST(ScsiHdNecTest, TestAddDrivePage);
FRIEND_TEST(PiscsiExecutorTest, ProcessDeviceCmd);

View File

@ -3,7 +3,7 @@
// SCSI Target Emulator PiSCSI
// for Raspberry Pi
//
// Copyright (C) 2022 Uwe Seimet
// Copyright (C) 2022-2023 Uwe Seimet
//
//---------------------------------------------------------------------------
@ -47,6 +47,20 @@ TEST(ScsiHdNecTest, SetUpModePages)
ScsiHdNecTest_SetUpModePages(pages);
}
TEST(ScsiHdNecTest, TestAddErrorPage)
{
map<int, vector<byte>> pages;
MockSCSIHD_NEC hd(0);
hd.SetBlockCount(0x1234);
hd.SetReady(true);
// Non changeable
hd.SetUpModePages(pages, 0x01, false);
EXPECT_EQ(1, pages.size()) << "Unexpected number of mode pages";
const vector<byte>& page_1 = pages[1];
EXPECT_EQ(0x26, to_integer<int>(page_1[2]));
}
TEST(ScsiHdNecTest, TestAddFormatPage)
{
map<int, vector<byte>> pages;