Skip to content

ATAD: fix device probing for slave device#858

Merged
rickgaiser merged 1 commit into
ps2dev:masterfrom
pcm720:atad-probe-fix
May 29, 2026
Merged

ATAD: fix device probing for slave device#858
rickgaiser merged 1 commit into
ps2dev:masterfrom
pcm720:atad-probe-fix

Conversation

@pcm720
Copy link
Copy Markdown
Contributor

@pcm720 pcm720 commented May 28, 2026

This PR fixes device probing for ATA slave device in ata_init_devices.

ata_device_probe writes to ATA registers after checking nsector, sector, hcyl and lcyl values:

ata_hwport->r_lcyl = 0x55;
ata_hwport->r_hcyl = 0xaa;
lcyl = ata_hwport->r_lcyl & 0xff;
hcyl = ata_hwport->r_hcyl & 0xff;

As it turns out, simply switching from device 0 to device 1 does not clear the ATA controller register values. This causes probing for device 1 to reuse register values from the previous ata_device_probe call.

Resetting the ATA controller before calling ata_device_select fixes this.

Before the change, device 1 was ignored.
After the change, probing correctly handles all cases, including setups with a missing master device.

  hdd: disk0: 0x07744000 sectors, max 0x00200000
  hdd: disk1: 0x01dd7fb0 sectors, max 0x00080000
  hdd: drive status 0, format version 00000002
  hdd: drive status 0, format version 00000002
  hdd: version 0205 driver start. This is OSD version!
  pfs Playstation Filesystem Driver v2.2
ps2fs: (c) 2003 Sjeep, V  ector and Florin Sasu
  pfs Max mount: 4, Max open: 10, Number of buffers: 40
  pfs version 0202 driver start.
  Checking APA header for HDD0: 0
  Checking APA header for HDD1: 0
  hdd0 partitions:
        __mbr
        __net
        __system
        __sysconf
        __common
        __.POPS
  hdd1 partitions:
        __mbr
        __net
        __system
        __sysconf
        __common
        PP.SLUS-20002..RIDGE_RACER_V
        PP.SLUS-20002..RIDGE_RACER_V
        PP.SLUS-20002..RIDGE_RACER_V
  Mounting hdd0:__common to pfs0: 0
  Mounting hdd1:__common to pfs0: 0

@rickgaiser rickgaiser merged commit ff7c5f9 into ps2dev:master May 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants