source: bootcd/isolinux/syslinux-6.03/memdisk/mstructs.h @ e16e8f2

Last change on this file since e16e8f2 was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 5.0 KB
Line 
1/* ----------------------------------------------------------------------- *
2 *
3 *   Copyright 2001-2009 H. Peter Anvin - All Rights Reserved
4 *   Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
5 *   Portions copyright 2009-2010 Shao Miller
6 *                                [El Torito code, mBFT, "safe hook"]
7 *
8 *   This program is free software; you can redistribute it and/or modify
9 *   it under the terms of the GNU General Public License as published by
10 *   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
11 *   Boston MA 02111-1307, USA; either version 2 of the License, or
12 *   (at your option) any later version; incorporated herein by reference.
13 *
14 * ----------------------------------------------------------------------- */
15
16/* These structures are common to MEMDISK and MDISKCHK.COM */
17
18#include <stdint.h>
19#include "compiler.h"
20
21struct seg_off {
22    uint16_t offset;
23    uint16_t segment;
24};
25
26typedef union {
27    struct seg_off seg_off;
28    uint32_t uint32;
29} real_addr_t;
30
31/* Forward declaration */
32struct mBFT;
33
34MEMDISK_PACKED_PREFIX
35struct safe_hook {
36    uint8_t jump[3];            /* Max. three bytes for jump */
37    uint8_t signature[8];       /* "$INT13SF" */
38    uint8_t vendor[8];          /* "MEMDISK " */
39    real_addr_t old_hook;       /* SEG:OFF for previous INT 13h hook */
40    uint32_t flags;             /* "Safe hook" flags */
41    /* The next field is a MEMDISK extension to the "safe hook" structure */
42    uint32_t mbft;
43} MEMDISK_PACKED_POSTFIX;
44
45struct memdisk_header {
46    uint16_t int13_offs;
47    uint16_t int15_offs;
48    uint16_t patch_offs;
49    uint16_t total_size;
50    uint16_t iret_offs;
51    struct safe_hook safe_hook;
52};
53
54MEMDISK_PACKED_PREFIX
55/* EDD disk parameter table */
56struct edd_dpt {
57    uint16_t len;               /* Length of table */
58    uint16_t flags;             /* Information flags */
59    uint32_t c;                 /* Physical cylinders (count!) */
60    uint32_t h;                 /* Physical heads (count!) */
61    uint32_t s;                 /* Physical sectors/track (count!) */
62    uint64_t sectors;           /* Total sectors */
63    uint16_t bytespersec;       /* Bytes/sector */
64    real_addr_t dpte;           /* DPTE pointer */
65    uint16_t dpikey;            /* Device Path Info magic */
66    uint8_t  dpilen;            /* Device Path Info length */
67    uint8_t  res1;              /* Reserved */
68    uint16_t res2;              /* Reserved */
69    uint8_t  bustype[4];        /* Host bus type */
70    uint8_t  inttype[8];        /* Interface type */
71    uint64_t intpath;           /* Interface path */
72    uint64_t devpath[2];        /* Device path (double QuadWord!) */
73    uint8_t  res3;              /* Reserved */
74    uint8_t  chksum;            /* DPI checksum */
75} MEMDISK_PACKED_POSTFIX;
76
77/* Requirement for struct edd4_cd_pkt */
78#include "../memdisk/eltorito.h"
79
80/* Official MEMDISK Info structure ("MDI") */
81MEMDISK_PACKED_PREFIX
82struct mdi {
83    const uint16_t bytes;
84    const uint8_t version_minor;
85    const uint8_t version_major;
86
87    uint32_t diskbuf;
88    uint32_t disksize;
89    real_addr_t cmdline;
90
91    real_addr_t oldint13;
92    real_addr_t oldint15;
93
94    uint16_t olddosmem;
95    uint8_t bootloaderid;
96    uint8_t sector_shift;
97
98    uint16_t dpt_ptr;
99} MEMDISK_PACKED_POSTFIX;
100
101/* Requirement for struct acpi_description_header */
102#include "../memdisk/acpi.h"
103
104MEMDISK_PACKED_PREFIX
105struct mBFT {
106    struct acpi_description_header acpi;
107    uint32_t safe_hook;         /* "Safe hook" physical address */
108    struct mdi mdi;
109} MEMDISK_PACKED_POSTFIX;
110
111/* The Disk Parameter Table may be required */
112typedef union {
113    struct hd_dpt {
114        uint16_t max_cyl;       /* Max cylinder */
115        uint8_t max_head;       /* Max head */
116        uint8_t junk1[5];       /* Obsolete junk, leave at zero */
117        uint8_t ctrl;           /* Control byte */
118        uint8_t junk2[7];       /* More obsolete junk */
119    } hd;
120    struct fd_dpt {
121        uint8_t specify1;       /* "First specify byte" */
122        uint8_t specify2;       /* "Second specify byte" */
123        uint8_t delay;          /* Delay until motor turn off */
124        uint8_t bps;            /* Bytes/sector (02h = 512) */
125
126        uint8_t sectors;        /* Sectors/track */
127        uint8_t isgap;          /* Length of intersector gap */
128        uint8_t dlen;           /* Data length (0FFh) */
129        uint8_t fgap;           /* Formatting gap */
130
131        uint8_t ffill;          /* Format fill byte */
132        uint8_t settle;         /* Head settle time (ms) */
133        uint8_t mstart;         /* Motor start time */
134        uint8_t maxtrack;       /* Maximum track number */
135
136        uint8_t rate;           /* Data transfer rate */
137        uint8_t cmos;           /* CMOS type */
138        uint8_t pad[2];
139
140        uint32_t old_fd_dpt;    /* Extension: pointer to old INT 1Eh */
141    } fd;
142} dpt_t;
143
144MEMDISK_PACKED_PREFIX
145struct patch_area {
146    struct mdi mdi;
147
148    uint8_t driveshiftlimit;    /* Do not shift drives above this region */
149    uint8_t _pad2;              /* Pad to DWORD */
150    uint16_t _pad3;             /* Pad to QWORD */
151
152    uint16_t memint1588;
153
154    uint16_t cylinders;
155    uint16_t heads;
156    uint32_t sectors;
157
158    uint32_t mem1mb;
159    uint32_t mem16mb;
160
161    uint8_t driveno;
162    uint8_t drivetype;
163    uint8_t drivecnt;
164    uint8_t configflags;
165
166#define CONFIG_READONLY 0x01
167#define CONFIG_RAW      0x02
168#define CONFIG_SAFEINT  0x04
169#define CONFIG_BIGRAW   0x08    /* MUST be 8! */
170#define CONFIG_MODEMASK 0x0e
171
172    uint16_t mystack;
173    uint16_t statusptr;
174
175    dpt_t dpt;
176    struct edd_dpt edd_dpt;
177    struct edd4_cd_pkt cd_pkt;  /* Only really in a memdisk_iso_* hook */
178} MEMDISK_PACKED_POSTFIX;
Note: See TracBrowser for help on using the repository browser.