Add additional int15 handlers for disk drives.
[seabios.git] / src / disk.h
1 // Definitions for X86 bios disks.
2 //
3 // Copyright (C) 2008  Kevin O'Connor <kevin@koconnor.net>
4 //
5 // This file may be distributed under the terms of the GNU GPLv3 license.
6 #ifndef __DISK_H
7 #define __DISK_H
8
9 #include "ioport.h" // outb
10 #include "biosvar.h" // struct bregs
11
12 #define DISK_RET_SUCCESS       0x00
13 #define DISK_RET_EPARAM        0x01
14 #define DISK_RET_ECHANGED      0x06
15 #define DISK_RET_EBOUNDARY     0x09
16 #define DISK_RET_EBADTRACK     0x0c
17 #define DISK_RET_ECONTROLLER   0x20
18 #define DISK_RET_ETIMEOUT      0x80
19 #define DISK_RET_ENOTREMOVABLE 0xb2
20 #define DISK_RET_EMEDIA        0xC0
21 #define DISK_RET_ENOTREADY     0xAA
22
23 // Bios disk structures.
24 struct int13ext_s {
25     u8  size;
26     u8  reserved;
27     u16 count;
28     u16 offset;
29     u16 segment;
30     u32 lba1;
31     u32 lba2;
32 };
33
34 #define GET_INT13EXT(regs,var)                                          \
35     GET_FARVAR((regs)->ds, ((struct int13ext_s*)((regs)->si+0))->var)
36 #define SET_INT13EXT(regs,var,val)                                      \
37     SET_FARVAR((regs)->ds, ((struct int13ext_s*)((regs)->si+0))->var, (val))
38
39 // Disk Physical Table definition
40 struct int13dpt_s {
41     u16 size;
42     u16 infos;
43     u32 cylinders;
44     u32 heads;
45     u32 spt;
46     u32 sector_count1;
47     u32 sector_count2;
48     u16 blksize;
49     u16 dpte_offset;
50     u16 dpte_segment;
51     u16 key;
52     u8  dpi_length;
53     u8  reserved1;
54     u16 reserved2;
55     u8  host_bus[4];
56     u8  iface_type[8];
57     u8  iface_path[8];
58     u8  device_path[8];
59     u8  reserved3;
60     u8  checksum;
61 };
62
63 #define GET_INT13DPT(regs,var)                                          \
64     GET_FARVAR((regs)->ds, ((struct int13dpt_s*)((regs)->si+0))->var)
65 #define SET_INT13DPT(regs,var,val)                                      \
66     SET_FARVAR((regs)->ds, ((struct int13dpt_s*)((regs)->si+0))->var, (val))
67
68
69 // floppy.c
70 void floppy_13(struct bregs *regs, u8 drive);
71 void floppy_tick();
72
73 #endif // disk.h