Initial merge of (incomplete) Banana Pi updates (#993)

This commit is contained in:
akuker
2022-12-02 22:20:27 -06:00
committed by GitHub
parent a403ec3ded
commit eb71c31cf1
78 changed files with 8367 additions and 2881 deletions
+49 -49
View File
@@ -34,26 +34,26 @@ TEST(ScsiControllerTest, Process)
auto controller_manager = make_shared<ControllerManager>(*bus);
MockScsiController controller(controller_manager, 0);
controller.SetPhase(BUS::phase_t::reserved);
controller.SetPhase(phase_t::reserved);
ON_CALL(*bus, GetRST).WillByDefault(Return(true));
EXPECT_CALL(*bus, Acquire);
EXPECT_CALL(*bus, GetRST);
EXPECT_CALL(*bus, Reset);
EXPECT_CALL(controller, Reset);
EXPECT_EQ(BUS::phase_t::reserved, controller.Process(0));
EXPECT_EQ(phase_t::reserved, controller.Process(0));
controller.SetPhase(BUS::phase_t::busfree);
controller.SetPhase(phase_t::busfree);
ON_CALL(*bus, GetRST).WillByDefault(Return(false));
EXPECT_CALL(*bus, Acquire);
EXPECT_CALL(*bus, GetRST);
EXPECT_EQ(BUS::phase_t::busfree, controller.Process(0));
EXPECT_EQ(phase_t::busfree, controller.Process(0));
controller.SetPhase(BUS::phase_t::reserved);
controller.SetPhase(phase_t::reserved);
EXPECT_CALL(*bus, Acquire);
EXPECT_CALL(*bus, GetRST);
EXPECT_CALL(*bus, Reset);
EXPECT_CALL(controller, Reset);
EXPECT_EQ(BUS::phase_t::busfree, controller.Process(0));
EXPECT_EQ(phase_t::busfree, controller.Process(0));
}
TEST(ScsiControllerTest, BusFree)
@@ -62,30 +62,30 @@ TEST(ScsiControllerTest, BusFree)
auto controller_manager = make_shared<ControllerManager>(*bus);
MockScsiController controller(controller_manager, 0);
controller.SetPhase(BUS::phase_t::busfree);
controller.SetPhase(phase_t::busfree);
controller.BusFree();
EXPECT_EQ(BUS::phase_t::busfree, controller.GetPhase());
EXPECT_EQ(phase_t::busfree, controller.GetPhase());
controller.SetStatus(status::CHECK_CONDITION);
controller.SetPhase(BUS::phase_t::reserved);
controller.SetPhase(phase_t::reserved);
controller.BusFree();
EXPECT_EQ(BUS::phase_t::busfree, controller.GetPhase());
EXPECT_EQ(phase_t::busfree, controller.GetPhase());
EXPECT_EQ(status::GOOD, controller.GetStatus());
controller.ScheduleShutdown(AbstractController::rascsi_shutdown_mode::NONE);
controller.SetPhase(BUS::phase_t::reserved);
controller.SetPhase(phase_t::reserved);
controller.BusFree();
controller.ScheduleShutdown(AbstractController::rascsi_shutdown_mode::STOP_PI);
controller.SetPhase(BUS::phase_t::reserved);
controller.SetPhase(phase_t::reserved);
controller.BusFree();
controller.ScheduleShutdown(AbstractController::rascsi_shutdown_mode::RESTART_PI);
controller.SetPhase(BUS::phase_t::reserved);
controller.SetPhase(phase_t::reserved);
controller.BusFree();
controller.ScheduleShutdown(AbstractController::rascsi_shutdown_mode::STOP_RASCSI);
controller.SetPhase(BUS::phase_t::reserved);
controller.SetPhase(phase_t::reserved);
EXPECT_EXIT(controller.BusFree(), ExitedWithCode(EXIT_SUCCESS), "");
}
@@ -95,55 +95,55 @@ TEST(ScsiControllerTest, Selection)
auto controller_manager = make_shared<ControllerManager>(*bus);
auto controller = make_shared<MockScsiController>(controller_manager, 0);
controller->SetPhase(BUS::phase_t::selection);
controller->SetPhase(phase_t::selection);
ON_CALL(*bus, GetSEL).WillByDefault(Return(true));
ON_CALL(*bus, GetBSY).WillByDefault(Return(true));
EXPECT_CALL(*bus, GetATN).Times(0);
controller->Selection();
EXPECT_EQ(BUS::phase_t::selection, controller->GetPhase());
EXPECT_EQ(phase_t::selection, controller->GetPhase());
ON_CALL(*bus, GetSEL).WillByDefault(Return(true));
ON_CALL(*bus, GetBSY).WillByDefault(Return(false));
EXPECT_CALL(*bus, GetATN).Times(0);
EXPECT_CALL(*controller, Status);
controller->Selection();
EXPECT_EQ(BUS::phase_t::selection, controller->GetPhase());
EXPECT_EQ(phase_t::selection, controller->GetPhase());
ON_CALL(*bus, GetSEL).WillByDefault(Return(false));
ON_CALL(*bus, GetBSY).WillByDefault(Return(false));
EXPECT_CALL(*bus, GetATN).Times(0);
controller->Selection();
EXPECT_EQ(BUS::phase_t::selection, controller->GetPhase());
EXPECT_EQ(phase_t::selection, controller->GetPhase());
ON_CALL(*bus, GetSEL).WillByDefault(Return(false));
ON_CALL(*bus, GetBSY).WillByDefault(Return(true));
ON_CALL(*bus, GetATN).WillByDefault(Return(false));
EXPECT_CALL(*bus, GetATN);
controller->Selection();
EXPECT_EQ(BUS::phase_t::command, controller->GetPhase());
EXPECT_EQ(phase_t::command, controller->GetPhase());
controller->SetPhase(BUS::phase_t::selection);
controller->SetPhase(phase_t::selection);
ON_CALL(*bus, GetSEL).WillByDefault(Return(false));
ON_CALL(*bus, GetBSY).WillByDefault(Return(true));
ON_CALL(*bus, GetATN).WillByDefault(Return(true));
EXPECT_CALL(*bus, GetATN);
controller->Selection();
EXPECT_EQ(BUS::phase_t::msgout, controller->GetPhase());
EXPECT_EQ(phase_t::msgout, controller->GetPhase());
controller->SetPhase(BUS::phase_t::reserved);
controller->SetPhase(phase_t::reserved);
ON_CALL(*bus, GetDAT).WillByDefault(Return(0));
controller->Selection();
EXPECT_EQ(BUS::phase_t::reserved, controller->GetPhase());
EXPECT_EQ(phase_t::reserved, controller->GetPhase());
ON_CALL(*bus, GetDAT).WillByDefault(Return(1));
controller->Selection();
EXPECT_EQ(BUS::phase_t::reserved, controller->GetPhase()) << "There is no device that can be selected";
EXPECT_EQ(phase_t::reserved, controller->GetPhase()) << "There is no device that can be selected";
auto device = make_shared<MockPrimaryDevice>(0);
controller->AddDevice(device);
EXPECT_CALL(*bus, SetBSY(true));
controller->Selection();
EXPECT_EQ(BUS::phase_t::selection, controller->GetPhase());
EXPECT_EQ(phase_t::selection, controller->GetPhase());
}
TEST(ScsiControllerTest, Command)
@@ -152,26 +152,26 @@ TEST(ScsiControllerTest, Command)
auto controller_manager = make_shared<ControllerManager>(*bus);
MockScsiController controller(controller_manager, 0);
controller.SetPhase(BUS::phase_t::command);
controller.SetPhase(phase_t::command);
EXPECT_CALL(controller, Status);
controller.Command();
EXPECT_EQ(BUS::phase_t::command, controller.GetPhase());
EXPECT_EQ(phase_t::command, controller.GetPhase());
controller.SetPhase(BUS::phase_t::reserved);
controller.SetPhase(phase_t::reserved);
EXPECT_CALL(*bus, SetMSG(false));
EXPECT_CALL(*bus, SetCD(true));
EXPECT_CALL(*bus, SetIO(false));
controller.Command();
EXPECT_EQ(BUS::phase_t::command, controller.GetPhase());
EXPECT_EQ(phase_t::command, controller.GetPhase());
controller.SetPhase(BUS::phase_t::reserved);
controller.SetPhase(phase_t::reserved);
ON_CALL(*bus, CommandHandShake).WillByDefault(Return(6));
EXPECT_CALL(*bus, SetMSG(false));
EXPECT_CALL(*bus, SetCD(true));
EXPECT_CALL(*bus, SetIO(false));
EXPECT_CALL(controller, Execute);
controller.Command();
EXPECT_EQ(BUS::phase_t::command, controller.GetPhase());
EXPECT_EQ(phase_t::command, controller.GetPhase());
}
TEST(ScsiControllerTest, MsgIn)
@@ -180,12 +180,12 @@ TEST(ScsiControllerTest, MsgIn)
auto controller_manager = make_shared<ControllerManager>(*bus);
MockScsiController controller(controller_manager, 0);
controller.SetPhase(BUS::phase_t::reserved);
controller.SetPhase(phase_t::reserved);
EXPECT_CALL(*bus, SetMSG(true));
EXPECT_CALL(*bus, SetCD(true));
EXPECT_CALL(*bus, SetIO(true));
controller.MsgIn();
EXPECT_EQ(BUS::phase_t::msgin, controller.GetPhase());
EXPECT_EQ(phase_t::msgin, controller.GetPhase());
EXPECT_FALSE(controller.HasValidLength());
EXPECT_EQ(0, controller.GetOffset());
}
@@ -196,12 +196,12 @@ TEST(ScsiControllerTest, MsgOut)
auto controller_manager = make_shared<ControllerManager>(*bus);
MockScsiController controller(controller_manager, 0);
controller.SetPhase(BUS::phase_t::reserved);
controller.SetPhase(phase_t::reserved);
EXPECT_CALL(*bus, SetMSG(true));
EXPECT_CALL(*bus, SetCD(true));
EXPECT_CALL(*bus, SetIO(false));
controller.MsgOut();
EXPECT_EQ(BUS::phase_t::msgout, controller.GetPhase());
EXPECT_EQ(phase_t::msgout, controller.GetPhase());
EXPECT_EQ(1, controller.GetLength());
EXPECT_EQ(0, controller.GetOffset());
}
@@ -212,18 +212,18 @@ TEST(ScsiControllerTest, DataIn)
auto controller_manager = make_shared<ControllerManager>(*bus);
MockScsiController controller(controller_manager, 0);
controller.SetPhase(BUS::phase_t::reserved);
controller.SetPhase(phase_t::reserved);
controller.SetLength(0);
EXPECT_CALL(controller, Status);
controller.DataIn();
EXPECT_EQ(BUS::phase_t::reserved, controller.GetPhase());
EXPECT_EQ(phase_t::reserved, controller.GetPhase());
controller.SetLength(1);
EXPECT_CALL(*bus, SetMSG(false));
EXPECT_CALL(*bus, SetCD(false));
EXPECT_CALL(*bus, SetIO(true));
controller.DataIn();
EXPECT_EQ(BUS::phase_t::datain, controller.GetPhase());
EXPECT_EQ(phase_t::datain, controller.GetPhase());
EXPECT_EQ(0, controller.GetOffset());
}
@@ -233,18 +233,18 @@ TEST(ScsiControllerTest, DataOut)
auto controller_manager = make_shared<ControllerManager>(*bus);
MockScsiController controller(controller_manager, 0);
controller.SetPhase(BUS::phase_t::reserved);
controller.SetPhase(phase_t::reserved);
controller.SetLength(0);
EXPECT_CALL(controller, Status);
controller.DataOut();
EXPECT_EQ(BUS::phase_t::reserved, controller.GetPhase());
EXPECT_EQ(phase_t::reserved, controller.GetPhase());
controller.SetLength(1);
EXPECT_CALL(*bus, SetMSG(false));
EXPECT_CALL(*bus, SetCD(false));
EXPECT_CALL(*bus, SetIO(false));
controller.DataOut();
EXPECT_EQ(BUS::phase_t::dataout, controller.GetPhase());
EXPECT_EQ(phase_t::dataout, controller.GetPhase());
EXPECT_EQ(0, controller.GetOffset());
}
@@ -255,33 +255,33 @@ TEST(ScsiControllerTest, Error)
MockScsiController controller(controller_manager, 0);
ON_CALL(*bus, GetRST).WillByDefault(Return(true));
controller.SetPhase(BUS::phase_t::reserved);
controller.SetPhase(phase_t::reserved);
EXPECT_CALL(*bus, Acquire);
EXPECT_CALL(*bus, GetRST());
EXPECT_CALL(*bus, Reset);
EXPECT_CALL(controller, Reset);
controller.Error(sense_key::ABORTED_COMMAND, asc::NO_ADDITIONAL_SENSE_INFORMATION, status::RESERVATION_CONFLICT);
EXPECT_EQ(status::GOOD, controller.GetStatus());
EXPECT_EQ(BUS::phase_t::reserved, controller.GetPhase());
EXPECT_EQ(phase_t::reserved, controller.GetPhase());
ON_CALL(*bus, GetRST).WillByDefault(Return(false));
controller.SetPhase(BUS::phase_t::status);
controller.SetPhase(phase_t::status);
EXPECT_CALL(*bus, Acquire);
EXPECT_CALL(*bus, GetRST());
EXPECT_CALL(*bus, Reset).Times(0);
EXPECT_CALL(controller, Reset).Times(0);
controller.Error(sense_key::ABORTED_COMMAND, asc::NO_ADDITIONAL_SENSE_INFORMATION, status::RESERVATION_CONFLICT);
EXPECT_EQ(BUS::phase_t::busfree, controller.GetPhase());
EXPECT_EQ(phase_t::busfree, controller.GetPhase());
controller.SetPhase(BUS::phase_t::msgin);
controller.SetPhase(phase_t::msgin);
EXPECT_CALL(*bus, Acquire);
EXPECT_CALL(*bus, GetRST());
EXPECT_CALL(*bus, Reset).Times(0);
EXPECT_CALL(controller, Reset).Times(0);
controller.Error(sense_key::ABORTED_COMMAND, asc::NO_ADDITIONAL_SENSE_INFORMATION, status::RESERVATION_CONFLICT);
EXPECT_EQ(BUS::phase_t::busfree, controller.GetPhase());
EXPECT_EQ(phase_t::busfree, controller.GetPhase());
controller.SetPhase(BUS::phase_t::reserved);
controller.SetPhase(phase_t::reserved);
EXPECT_CALL(*bus, Acquire);
EXPECT_CALL(*bus, GetRST());
EXPECT_CALL(*bus, Reset).Times(0);
@@ -289,7 +289,7 @@ TEST(ScsiControllerTest, Error)
EXPECT_CALL(controller, Status);
controller.Error(sense_key::ABORTED_COMMAND, asc::NO_ADDITIONAL_SENSE_INFORMATION, status::RESERVATION_CONFLICT);
EXPECT_EQ(status::RESERVATION_CONFLICT, controller.GetStatus());
EXPECT_EQ(BUS::phase_t::reserved, controller.GetPhase());
EXPECT_EQ(phase_t::reserved, controller.GetPhase());
}
TEST(ScsiControllerTest, RequestSense)