summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/include/int13.h
diff options
context:
space:
mode:
authorMichael Brown2008-07-16 00:19:59 +0200
committerMichael Brown2008-07-16 00:19:59 +0200
commitbb41ec385ce4fa74bc3036a47fc5fa709ce05d9c (patch)
treee997d6f572f66aa1a364e640517dac8e22519863 /src/arch/i386/include/int13.h
parent[udp] Avoid reusing auto-allocated ports after connection close. (diff)
downloadipxe-bb41ec385ce4fa74bc3036a47fc5fa709ce05d9c.tar.gz
ipxe-bb41ec385ce4fa74bc3036a47fc5fa709ce05d9c.tar.xz
ipxe-bb41ec385ce4fa74bc3036a47fc5fa709ce05d9c.zip
[int13] Pairwise swap drive numbers, instead of shifting all drive numbers
Shifting all INT13 drive numbers causes problems on systems that use a sparse drive number space (e.g. qemu BIOS, which uses 0xe0 for the CD-ROM drive). The strategy now is: Each drive is assigned a "natural" drive number, being the next available drive number in the system (based on the BIOS drive count). Each drive is accessed using its specified drive number. If the specified drive number is -1, the natural drive number will be used. Accesses to the specified drive number will be delivered to the emulated drive, masking out any preexisting drive using this number. Accesses to the natural drive number, if different, will be remapped to the masked-out drive. The overall upshot is that, for examples: System has no drives. Emulated INT13 drive gets natural number 0x80 and specified number 0x80. Accesses to drive 0x80 go to the emulated drive, and there is no remapping. System has one drive. Emulated INT13 drive gets natural number 0x81 and specified number 0x80. Accesses to drive 0x80 go to the emulated drive. Accesses to drive 0x81 get remapped to the original drive 0x80.
Diffstat (limited to 'src/arch/i386/include/int13.h')
-rw-r--r--src/arch/i386/include/int13.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/arch/i386/include/int13.h b/src/arch/i386/include/int13.h
index 2a193831..72ca97d7 100644
--- a/src/arch/i386/include/int13.h
+++ b/src/arch/i386/include/int13.h
@@ -69,8 +69,20 @@ struct int13_drive {
/** Underlying block device */
struct block_device *blockdev;
- /** BIOS drive number (0x80-0xff) */
+ /** BIOS in-use drive number (0x80-0xff) */
unsigned int drive;
+ /** BIOS natural drive number (0x80-0xff)
+ *
+ * This is the drive number that would have been assigned by
+ * 'naturally' appending the drive to the end of the BIOS
+ * drive list.
+ *
+ * If the emulated drive replaces a preexisting drive, this is
+ * the drive number that the preexisting drive gets remapped
+ * to.
+ */
+ unsigned int natural_drive;
+
/** Number of cylinders
*
* The cylinder number field in an INT 13 call is ten bits