summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/include
diff options
context:
space:
mode:
authorMichael Brown2006-09-09 00:22:03 +0200
committerMichael Brown2006-09-09 00:22:03 +0200
commit0566ab2a2f814ae486032d603588933cbea8a387 (patch)
tree3920b21ec5f38154bda9ce6247ed13d09efbb273 /src/arch/i386/include
parentFix gcc-induced reference to memcpy (diff)
downloadipxe-0566ab2a2f814ae486032d603588933cbea8a387.tar.gz
ipxe-0566ab2a2f814ae486032d603588933cbea8a387.tar.xz
ipxe-0566ab2a2f814ae486032d603588933cbea8a387.zip
Added geometry-guessing code based on the partition table
Diffstat (limited to 'src/arch/i386/include')
-rw-r--r--src/arch/i386/include/int13.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/arch/i386/include/int13.h b/src/arch/i386/include/int13.h
index 0525229da..16802a014 100644
--- a/src/arch/i386/include/int13.h
+++ b/src/arch/i386/include/int13.h
@@ -201,6 +201,45 @@ struct int13_disk_parameters {
/** @} */
+/** A C/H/S address within a partition table entry */
+struct partition_chs {
+ /** Head number */
+ uint8_t head;
+ /** Sector number, plus high 2 bits of cylinder number */
+ uint8_t cyl_sector;
+ /** Low 8 bits of cylinder number */
+ uint8_t cyl;
+} __attribute__ (( packed ));
+
+#define PART_HEAD(chs) ( (chs).head )
+#define PART_SECTOR(chs) ( (chs).cyl_sector & 0x3f )
+#define PART_CYLINDER(chs) ( (chs).cyl | ( ( (chs).cyl_sector & 0xc0 ) << 2 ) )
+
+/** A partition table entry within the MBR */
+struct partition_table_entry {
+ /** Bootable flag */
+ uint8_t bootable;
+ /** C/H/S start address */
+ struct partition_chs chs_start;
+ /** System indicator (partition type) */
+ uint8_t type;
+ /** C/H/S end address */
+ struct partition_chs chs_end;
+ /** Linear start address */
+ uint32_t start;
+ /** Linear length */
+ uint32_t length;
+} __attribute__ (( packed ));
+
+/** A Master Boot Record */
+struct master_boot_record {
+ uint8_t pad[446];
+ /** Partition table */
+ struct partition_table_entry partitions[4];
+ /** 0x55aa MBR signature */
+ uint16_t signature;
+} __attribute__ (( packed ));
+
extern void register_int13_drive ( struct int13_drive *drive );
extern void unregister_int13_drive ( struct int13_drive *drive );
extern int int13_boot ( unsigned int drive );