diff options
author | John Snow | 2020-07-24 07:22:58 +0200 |
---|---|---|
committer | John Snow | 2020-10-01 19:04:16 +0200 |
commit | 0c7515e1c47372ae5d53f2e281b2ccd425ebbcc6 (patch) | |
tree | 43880fdaf697d981f71910e5c1d9291e128a1caf /include/hw | |
parent | ide: reorder set/get sector functions (diff) | |
download | qemu-0c7515e1c47372ae5d53f2e281b2ccd425ebbcc6.tar.gz qemu-0c7515e1c47372ae5d53f2e281b2ccd425ebbcc6.tar.xz qemu-0c7515e1c47372ae5d53f2e281b2ccd425ebbcc6.zip |
ide: remove magic constants from the device register
(In QEMU, we call this the "select" register.)
My memory isn't good enough to memorize what these magic runes
do. Label them to prevent mixups from happening in the future.
Side note: I assume it's safe to always set 0xA0 even though ATA2 claims
these bits are reserved, because ATA3 immediately reinstated that these
bits should be always on. ATA4 and subsequent specs only claim that the
fields are obsolete, so I assume it's safe to leave these set and that
it should work with the widest array of guests.
Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'include/hw')
-rw-r--r-- | include/hw/ide/internal.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h index 5b7b0e47e6..2d09162eeb 100644 --- a/include/hw/ide/internal.h +++ b/include/hw/ide/internal.h @@ -29,6 +29,17 @@ OBJECT_DECLARE_SIMPLE_TYPE(IDEBus, IDE_BUS) #define MAX_IDE_DEVS 2 +/* Device/Head ("select") Register */ +#define ATA_DEV_SELECT 0x10 +/* ATA1,3: Defined as '1'. + * ATA2: Reserved. + * ATA3-7: obsolete. */ +#define ATA_DEV_ALWAYS_ON 0xA0 +#define ATA_DEV_LBA 0x40 +#define ATA_DEV_LBA_MSB 0x0F /* LBA 24:27 */ +#define ATA_DEV_HS 0x0F /* HS 3:0 */ + + /* Bits of HD_STATUS */ #define ERR_STAT 0x01 #define INDEX_STAT 0x02 |