Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV9: Fix MDMA #10598

Merged
merged 2 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pcsx2/DEV9/ATA/ATA.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class ATA
#endif

int pioMode;
int sdmaMode;
int mdmaMode;
int udmaMode;

Expand Down
13 changes: 3 additions & 10 deletions pcsx2/DEV9/ATA/ATA_Info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,9 @@ void ATA::CreateHDDinfo(u64 sizeSectors)
WriteUInt16(identifyData, &index, static_cast<u16>(curMultipleSectorsSetting | (1 << 8))); //word 59
//Total number of user addressable logical sectors
WriteUInt32(identifyData, &index, nbSectors); //word 60-61
//DMA modes
/*
* bits 0-7: Singleword modes supported (0,1,2)
* bits 8-15: Transfer mode active
*/
if (sdmaMode > 0)
WriteUInt16(identifyData, &index, static_cast<u16>(0x07 | (1 << (sdmaMode + 8)))); //word 62
else
WriteUInt16(identifyData, &index, 0x07); //word 62
//DMA Modes
//SDMA modes (Unsupported by original HDD)
index += 1 * 2; //word 62
//MDMA Modes
/*
* bits 0-7: Multiword modes supported (0,1,2)
* bits 8-15: Transfer mode active
Expand Down
4 changes: 0 additions & 4 deletions pcsx2/DEV9/ATA/ATA_State.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,18 +304,14 @@ void ATA::ResetEnd(bool hard)
if (hard)
{
pioMode = 4;
sdmaMode = -1;
mdmaMode = 2;
udmaMode = -1;
}
else
{
pioMode = 4;
if (udmaMode == -1)
{
sdmaMode = -1;
mdmaMode = 2;
}
}

regControlEnableIRQ = false;
Expand Down
4 changes: 2 additions & 2 deletions pcsx2/DEV9/ATA/Commands/ATA_CmdDMA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void ATA::PostCmdDMADataFromHost()

void ATA::ATAreadDMA8Mem(u8* pMem, int size)
{
if ((udmaMode >= 0) &&
if ((udmaMode >= 0 || mdmaMode >= 0) &&
(dev9.if_ctrl & SPD_IF_ATA_DMAEN) != 0)
{
if (size == 0 || nsector == -1)
Expand All @@ -103,7 +103,7 @@ void ATA::ATAreadDMA8Mem(u8* pMem, int size)

void ATA::ATAwriteDMA8Mem(u8* pMem, int size)
{
if ((udmaMode >= 0) &&
if ((udmaMode >= 0 || mdmaMode >= 0) &&
(dev9.if_ctrl & SPD_IF_ATA_DMAEN) != 0)
{
if (nsector == -1)
Expand Down
11 changes: 0 additions & 11 deletions pcsx2/DEV9/ATA/Commands/ATA_CmdNoData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,35 +101,24 @@ void ATA::HDD_SetFeatures()
//if mode = 1, disable IORDY
DevCon.WriteLn("DEV9: PIO Default");
pioMode = 4;
sdmaMode = -1;
mdmaMode = -1;
udmaMode = -1;
break;
case 0x01: //pio mode (3,4)
DevCon.WriteLn("DEV9: PIO Mode %i", mode);
pioMode = mode;
sdmaMode = -1;
mdmaMode = -1;
udmaMode = -1;
break;
case 0x02: //Single word dma mode (0,1,2)
DevCon.WriteLn("DEV9: SDMA Mode %i", mode);
//pioMode = -1;
sdmaMode = mode;
mdmaMode = -1;
udmaMode = -1;
break;
case 0x04: //Multi word dma mode (0,1,2)
DevCon.WriteLn("DEV9: MDMA Mode %i", mode);
//pioMode = -1;
sdmaMode = -1;
mdmaMode = mode;
udmaMode = -1;
break;
case 0x08: //Ulta dma mode (0,1,2,3,4,5,6)
DevCon.WriteLn("DEV9: UDMA Mode %i", mode);
//pioMode = -1;
sdmaMode = -1;
mdmaMode = -1;
udmaMode = mode;
break;
Expand Down