VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

When I look at the documentation about identify words 60-61(total number of addressable sectors, capped/limited to 2^28-1) and ATA/ATAPI-6 words 100-103 (maximum user LBA address for 48-bit feature set) I see an error:
Both fields say "contain a value that is one greater than the [maximum LBA address in used address space/total number of user addressable sectors]".

If it's capped at the 2^28-1(field at word 60-61) or 2^48-1(field at word 1oo-103) value, the final sector in said range would never be addressable, as the value reported to software is capped to the maximum to fit in those bits (so all ones filling 28 or 48 bits).

The only way the 28-bit LBA can be fully addressable is to make this field be the maximum effective valid LBA address instead of it reporting 1 more than the disk size (causing an overflow, losing the final sector at disks larger or equal than 2^28 sectors (137GB limit error) or 2^48 (48-bit limit error).

Anyone knows the truth about this?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 1 of 2, by wierd_w

User metadata
Rank l33t
Rank
l33t

Is the number '0 initiated'?

0-9 is 10 values.

Reply 2 of 2, by superfury

User metadata
Rank l33t++
Rank
l33t++

When I look at the linux source code, in linux/drivers/ata/libata-core.c, I see it using this ata_id_n_sectors function giving these values literally, so it'd indeed be the literal amount of addressable sectors. That would mean that the fields can't be limited to 28-bits or 48-bits, and indeed would need to include 1 extra bit for the 10000000h value (for full 28-bit addressability and larger disks) and the value of 2^48 for the maximum-sized 48-bit disks (if they exist yet so far)? That'd mean that the all-ones cap that's documented in ATA/ATAPI-6 is actually 1 higher in reality, otherwise it'd always be a sector short on the 28-bit(surpassing 28-bits size or fully addressable) and 48-bit LBA (surpassing or equal to 48-bits of disk space)?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io