]> git.proxmox.com Git - grub2.git/blob - include/grub/i386/pc/biosdisk.h
Add gcc_struct to all packed structures when compiling with mingw.
[grub2.git] / include / grub / i386 / pc / biosdisk.h
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2002,2005,2007,2008 Free Software Foundation, Inc.
4 *
5 * GRUB 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, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #ifndef GRUB_BIOSDISK_MACHINE_HEADER
20 #define GRUB_BIOSDISK_MACHINE_HEADER 1
21
22 #include <grub/symbol.h>
23 #include <grub/types.h>
24
25 #define GRUB_BIOSDISK_FLAG_LBA 1
26 #define GRUB_BIOSDISK_FLAG_CDROM 2
27
28 #define GRUB_BIOSDISK_CDTYPE_NO_EMUL 0
29 #define GRUB_BIOSDISK_CDTYPE_1_2_M 1
30 #define GRUB_BIOSDISK_CDTYPE_1_44_M 2
31 #define GRUB_BIOSDISK_CDTYPE_2_88_M 3
32 #define GRUB_BIOSDISK_CDTYPE_HARDDISK 4
33
34 #define GRUB_BIOSDISK_CDTYPE_MASK 0xF
35
36 struct grub_biosdisk_data
37 {
38 int drive;
39 unsigned long cylinders;
40 unsigned long heads;
41 unsigned long sectors;
42 unsigned long flags;
43 };
44
45 /* Drive Parameters. */
46 struct grub_biosdisk_drp
47 {
48 grub_uint16_t size;
49 grub_uint16_t flags;
50 grub_uint32_t cylinders;
51 grub_uint32_t heads;
52 grub_uint32_t sectors;
53 grub_uint64_t total_sectors;
54 grub_uint16_t bytes_per_sector;
55 /* ver 2.0 or higher */
56
57 union
58 {
59 grub_uint32_t EDD_configuration_parameters;
60
61 /* Pointer to the Device Parameter Table Extension (ver 3.0+). */
62 grub_uint32_t dpte_pointer;
63 };
64
65 /* ver 3.0 or higher */
66 grub_uint16_t signature_dpi;
67 grub_uint8_t length_dpi;
68 grub_uint8_t reserved[3];
69 grub_uint8_t name_of_host_bus[4];
70 grub_uint8_t name_of_interface_type[8];
71 grub_uint8_t interface_path[8];
72 grub_uint8_t device_path[16];
73 grub_uint8_t reserved2;
74 grub_uint8_t checksum;
75
76 /* XXX: This is necessary, because the BIOS of Thinkpad X20
77 writes a garbage to the tail of drive parameters,
78 regardless of a size specified in a caller. */
79 grub_uint8_t dummy[16];
80 } GRUB_PACKED;
81
82 struct grub_biosdisk_cdrp
83 {
84 grub_uint8_t size;
85 grub_uint8_t media_type;
86 grub_uint8_t drive_no;
87 grub_uint8_t controller_no;
88 grub_uint32_t image_lba;
89 grub_uint16_t device_spec;
90 grub_uint16_t cache_seg;
91 grub_uint16_t load_seg;
92 grub_uint16_t length_sec512;
93 grub_uint8_t cylinders;
94 grub_uint8_t sectors;
95 grub_uint8_t heads;
96 grub_uint8_t dummy[16];
97 } GRUB_PACKED;
98
99 /* Disk Address Packet. */
100 struct grub_biosdisk_dap
101 {
102 grub_uint8_t length;
103 grub_uint8_t reserved;
104 grub_uint16_t blocks;
105 grub_uint32_t buffer;
106 grub_uint64_t block;
107 } GRUB_PACKED;
108
109 #endif /* ! GRUB_BIOSDISK_MACHINE_HEADER */