]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - wimboot/wimboot-2.7.3/src/int13.h
added Spanish (Latinoamérica) translation (#1865)
[Ventoy.git] / wimboot / wimboot-2.7.3 / src / int13.h
1 #ifndef _INT13_H
2 #define _INT13_H
3
4 /*
5 * Copyright (C) 2012 Michael Brown <mbrown@fensystems.co.uk>.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA.
21 */
22
23 /**
24 * @file
25 *
26 * INT 13 emulation
27 *
28 */
29
30 /** Construct a pointer from a real-mode segment:offset address */
31 #define REAL_PTR( segment, offset ) \
32 ( ( void * ) ( intptr_t ) ( ( (segment) << 4 ) + offset ) )
33
34 /** Get drive parameters */
35 #define INT13_GET_PARAMETERS 0x08
36 /** Get disk type */
37 #define INT13_GET_DISK_TYPE 0x15
38 /** Extensions installation check */
39 #define INT13_EXTENSION_CHECK 0x41
40 /** Extended read */
41 #define INT13_EXTENDED_READ 0x42
42 /** Get extended drive parameters */
43 #define INT13_GET_EXTENDED_PARAMETERS 0x48
44
45 /** Operation completed successfully */
46 #define INT13_STATUS_SUCCESS 0x00
47 /** Invalid function or parameter */
48 #define INT13_STATUS_INVALID 0x01
49 /** Read error */
50 #define INT13_STATUS_READ_ERROR 0x04
51 /** Reset failed */
52 #define INT13_STATUS_RESET_FAILED 0x05
53 /** Write error */
54 #define INT13_STATUS_WRITE_ERROR 0xcc
55
56 /** No such drive */
57 #define INT13_DISK_TYPE_NONE 0x00
58 /** Floppy without change-line support */
59 #define INT13_DISK_TYPE_FDD 0x01
60 /** Floppy with change-line support */
61 #define INT13_DISK_TYPE_FDD_CL 0x02
62 /** Hard disk */
63 #define INT13_DISK_TYPE_HDD 0x03
64
65 /** Extended disk access functions supported */
66 #define INT13_EXTENSION_LINEAR 0x01
67
68 /** INT13 extensions version 1.x */
69 #define INT13_EXTENSION_VER_1_X 0x01
70
71 /** DMA boundary errors handled transparently */
72 #define INT13_FL_DMA_TRANSPARENT 0x01
73
74 /** BIOS drive counter */
75 #define INT13_DRIVE_COUNT ( *( ( ( uint8_t * ) REAL_PTR ( 0x40, 0x75 ) ) ) )
76
77 /** An INT 13 disk address packet */
78 struct int13_disk_address {
79 /** Size of the packet, in bytes */
80 uint8_t bufsize;
81 /** Reserved */
82 uint8_t reserved_a;
83 /** Block count */
84 uint8_t count;
85 /** Reserved */
86 uint8_t reserved_b;
87 /** Data buffer */
88 struct segoff buffer;
89 /** Starting block number */
90 uint64_t lba;
91 /** Data buffer (EDD 3.0+ only) */
92 uint64_t buffer_phys;
93 /** Block count (EDD 4.0+ only) */
94 uint32_t long_count;
95 /** Reserved */
96 uint32_t reserved_c;
97 } __attribute__ (( packed ));
98
99 /** INT 13 disk parameters */
100 struct int13_disk_parameters {
101 /** Size of this structure */
102 uint16_t bufsize;
103 /** Flags */
104 uint16_t flags;
105 /** Number of cylinders */
106 uint32_t cylinders;
107 /** Number of heads */
108 uint32_t heads;
109 /** Number of sectors per track */
110 uint32_t sectors_per_track;
111 /** Total number of sectors on drive */
112 uint64_t sectors;
113 /** Bytes per sector */
114 uint16_t sector_size;
115 } __attribute__ (( packed ));
116
117 extern int initialise_int13 ( void );
118 extern void emulate_int13 ( struct bootapp_callback_params *params );
119
120 #endif /* _INT13_H */