Merge remote branch 'pam/hdt-0.3.6'
[profile/ivi/syslinux.git] / memdisk / eltorito.h
1 /* ----------------------------------------------------------------------- *
2  *
3  *   Copyright 2009 Shao Miller - All Rights Reserved
4  *
5  *   This program is free software; you can redistribute it and/or modify
6  *   it under the terms of the GNU General Public License as published by
7  *   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8  *   Boston MA 02111-1307, USA; either version 2 of the License, or
9  *   (at your option) any later version; incorporated herein by reference.
10  *
11  * ----------------------------------------------------------------------- */
12
13 /*
14  * eltorito.h
15  *
16  * EDD-4 El Torito structures and debugging routines
17  */
18
19 #include <stdint.h>
20
21 /*
22  * Uncomment for El Torito debugging
23  *
24  * #define DBG_ELTORITO 1
25  */
26
27 #ifdef DBG_ELTORITO
28 extern void eltorito_dump(uint32_t);
29 #endif
30
31 /* EDD-4 Bootable Optical Disc Drive Boot Volume Descriptor */
32 struct edd4_bvd {
33     uint8_t boot_rec_ind;       /* Boot Record Indicator */
34     uint8_t iso9660_id[5];      /* ISO9660 ID            */
35     uint8_t ver;                /* Descriptor Version    */
36     uint8_t eltorito[32];       /* "EL TORITO" etc.      */
37     uint8_t res1[32];           /* Reserved              */
38     uint32_t boot_cat;          /* Boot catalog sector   */
39     uint8_t res2[1973];         /* Reserved              */
40 } __attribute__ ((packed));
41
42 struct validation_entry {
43     uint8_t header_id;          /* Header ID                      */
44     uint8_t platform_id;        /* Platform ID                    */
45     uint16_t res1;              /* Reserved                       */
46     uint8_t id_string[24];      /* Manufacturer                   */
47     uint16_t checksum;          /* Sums with whole record to zero */
48     uint8_t key55;              /* Key byte 0x55                  */
49     uint8_t keyAA;              /* Key byte 0xAA                  */
50 } __attribute__ ((packed));
51
52 struct initial_entry {
53     uint8_t header_id;          /* Header ID                */
54     uint8_t media_type;         /* Media type               */
55     uint16_t load_seg;          /* Load segment             */
56     uint8_t system_type;        /* (Filesystem ID)          */
57     uint8_t res1;               /* Reserved                 */
58     uint16_t sect_count;        /* Emulated sectors to load */
59     uint32_t load_block;        /* Starting sector of image */
60     uint8_t res2[4];            /* Reserved                 */
61 } __attribute__ ((packed));
62
63 /* EDD-4 Bootable Optical Disc Drive Boot Catalog (fixed-size portions) */
64 struct edd4_bootcat {
65     struct validation_entry validation_entry;
66     struct initial_entry initial_entry;
67 } __attribute__ ((packed));
68
69 /* EDD-4 CD Specification Packet */
70 struct edd4_cd_pkt {
71     uint8_t size;               /* Packet size                     */
72     uint8_t type;               /* Boot media type (flags)         */
73     uint8_t driveno;            /* INT 13h drive number            */
74     uint8_t controller;         /* Controller index                */
75     uint32_t start;             /* Starting LBA of image           */
76     uint16_t devno;             /* Device number                   */
77     uint16_t userbuf;           /* User buffer segment             */
78     uint16_t load_seg;          /* Load segment                    */
79     uint16_t sect_count;        /* Emulated sectors to load        */
80     uint8_t geom1;              /* Cylinders bits 0 thru 7         */
81     uint8_t geom2;              /* Sects/track 0 thru 5, cyls 8, 9 */
82     uint8_t geom3;              /* Heads                           */
83 } __attribute__ ((packed));