Forgot tar.c
[grub2/jjazz.git] / include / grub / i386 / pc / biosdisk.h
blob64d4f217f698fd43a898be38f3278297ac64f3fd
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2002,2005,2007,2008 Free Software Foundation, Inc.
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.
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.
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/>.
19 #ifndef GRUB_BIOSDISK_MACHINE_HEADER
20 #define GRUB_BIOSDISK_MACHINE_HEADER 1
22 #include <grub/symbol.h>
23 #include <grub/types.h>
25 #define GRUB_BIOSDISK_FLAG_LBA 1
26 #define GRUB_BIOSDISK_FLAG_CDROM 2
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
34 #define GRUB_BIOSDISK_CDTYPE_MASK 0xF
36 struct grub_biosdisk_data
38 int drive;
39 unsigned long cylinders;
40 unsigned long heads;
41 unsigned long sectors;
42 unsigned long flags;
45 /* Drive Parameters. */
46 struct grub_biosdisk_drp
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 */
57 union
59 grub_uint32_t EDD_configuration_parameters;
61 /* Pointer to the Device Parameter Table Extension (ver 3.0+). */
62 grub_uint32_t dpte_pointer;
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[8];
73 grub_uint8_t reserved2;
74 grub_uint8_t checksum;
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 } __attribute__ ((packed));
82 struct grub_biosdisk_cdrp
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 } __attribute__ ((packed));
99 /* Disk Address Packet. */
100 struct grub_biosdisk_dap
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 } __attribute__ ((packed));
109 int EXPORT_FUNC(grub_biosdisk_rw_int13_extensions) (int ah, int drive, void *dap);
110 int EXPORT_FUNC(grub_biosdisk_rw_standard) (int ah, int drive, int coff, int hoff,
111 int soff, int nsec, int segment);
112 int EXPORT_FUNC(grub_biosdisk_check_int13_extensions) (int drive);
113 int EXPORT_FUNC(grub_biosdisk_get_diskinfo_int13_extensions) (int drive,
114 void *drp);
115 int EXPORT_FUNC(grub_biosdisk_get_cdinfo_int13_extensions) (int drive,
116 void *cdrp);
117 int EXPORT_FUNC(grub_biosdisk_get_diskinfo_standard) (int drive,
118 unsigned long *cylinders,
119 unsigned long *heads,
120 unsigned long *sectors);
121 int EXPORT_FUNC(grub_biosdisk_get_num_floppies) (void);
123 void grub_biosdisk_init (void);
124 void grub_biosdisk_fini (void);
126 #endif /* ! GRUB_BIOSDISK_MACHINE_HEADER */