summary refs log tree commit diff stats
path: root/include/hw/ide/internal.h
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2020-07-24 01:22:58 -0400
committerJohn Snow <jsnow@redhat.com>2020-10-01 13:04:16 -0400
commit0c7515e1c47372ae5d53f2e281b2ccd425ebbcc6 (patch)
tree43880fdaf697d981f71910e5c1d9291e128a1caf /include/hw/ide/internal.h
parent14ee9b53adc2f2e7f60f8ee0e906489785c8db13 (diff)
downloadfocaccia-qemu-0c7515e1c47372ae5d53f2e281b2ccd425ebbcc6.tar.gz
focaccia-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/ide/internal.h')
-rw-r--r--include/hw/ide/internal.h11
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