4 #include "types.h" // u32
7 /****************************************************************
9 ****************************************************************/
14 struct drive_s *drive_gf;
19 #define CMD_RESET 0x00
21 #define CMD_WRITE 0x03
22 #define CMD_VERIFY 0x04
23 #define CMD_FORMAT 0x05
25 #define CMD_ISREADY 0x10
28 /****************************************************************
30 ****************************************************************/
40 u8 type; // Driver type (DTYPE_*)
41 u8 floppy_type; // Type of floppy (only for floppy drives).
42 struct chs_s lchs; // Logical CHS
43 u64 sectors; // Total sectors count
44 u32 cntl_id; // Unique id for a given driver type.
45 u8 removable; // Is media removable (currently unused)
48 u8 translation; // type of translation
49 u16 blksize; // block size
50 struct chs_s pchs; // Physical CHS
53 #define DISK_SECTOR_SIZE 512
54 #define CDROM_SECTOR_SIZE 2048
56 #define DTYPE_NONE 0x00
57 #define DTYPE_FLOPPY 0x10
58 #define DTYPE_ATA 0x20
59 #define DTYPE_ATA_ATAPI 0x21
60 #define DTYPE_RAMDISK 0x30
61 #define DTYPE_CDEMU 0x40
62 #define DTYPE_AHCI 0x50
63 #define DTYPE_AHCI_ATAPI 0x51
64 #define DTYPE_VIRTIO_SCSI 0x60
65 #define DTYPE_VIRTIO_BLK 0x61
66 #define DTYPE_USB 0x70
67 #define DTYPE_USB_32 0x71
68 #define DTYPE_UAS 0x72
69 #define DTYPE_UAS_32 0x73
70 #define DTYPE_LSI_SCSI 0x80
71 #define DTYPE_ESP_SCSI 0x81
72 #define DTYPE_MEGASAS 0x82
73 #define DTYPE_PVSCSI 0x83
74 #define DTYPE_SDCARD 0x90
76 #define MAXDESCSIZE 80
78 #define TRANSLATION_NONE 0
79 #define TRANSLATION_LBA 1
80 #define TRANSLATION_LARGE 2
81 #define TRANSLATION_RECHS 3
83 #define EXTTYPE_FLOPPY 0
87 #define EXTSTART_HD 0x80
88 #define EXTSTART_CD 0xE0
91 /****************************************************************
93 ****************************************************************/
96 extern u8 FloppyCount, CDCount;
97 extern u8 *bounce_buf_fl;
98 struct drive_s *getDrive(u8 exttype, u8 extdriveoffset);
99 int getDriveId(u8 exttype, struct drive_s *drive);
100 void map_floppy_drive(struct drive_s *drive);
101 void map_hd_drive(struct drive_s *drive);
102 void map_cd_drive(struct drive_s *drive);
104 int fill_edd(u16 seg, struct int13dpt_s *param_far, struct drive_s *drive_gf);
105 int process_op(struct disk_op_s *op);
106 int send_disk_op(struct disk_op_s *op);
107 int create_bounce_buf(void);