4 #include "types.h" // u32
7 /****************************************************************
9 ****************************************************************/
13 struct drive_s *drive_gf;
17 // Commands: READ, WRITE, VERIFY, SEEK, FORMAT
27 #define CMD_RESET 0x00
29 #define CMD_WRITE 0x03
30 #define CMD_VERIFY 0x04
31 #define CMD_FORMAT 0x05
33 #define CMD_ISREADY 0x10
37 /****************************************************************
39 ****************************************************************/
49 u8 type; // Driver type (DTYPE_*)
50 u8 floppy_type; // Type of floppy (only for floppy drives).
51 struct chs_s lchs; // Logical CHS
52 u64 sectors; // Total sectors count
53 u32 cntl_id; // Unique id for a given driver type.
54 u8 removable; // Is media removable (currently unused)
57 u8 translation; // type of translation
58 u16 blksize; // block size
59 struct chs_s pchs; // Physical CHS
62 #define DISK_SECTOR_SIZE 512
63 #define CDROM_SECTOR_SIZE 2048
65 #define DTYPE_NONE 0x00
66 #define DTYPE_FLOPPY 0x10
67 #define DTYPE_ATA 0x20
68 #define DTYPE_ATA_ATAPI 0x21
69 #define DTYPE_RAMDISK 0x30
70 #define DTYPE_CDEMU 0x40
71 #define DTYPE_AHCI 0x50
72 #define DTYPE_AHCI_ATAPI 0x51
73 #define DTYPE_VIRTIO_SCSI 0x60
74 #define DTYPE_VIRTIO_BLK 0x61
75 #define DTYPE_USB 0x70
76 #define DTYPE_USB_32 0x71
77 #define DTYPE_UAS 0x72
78 #define DTYPE_UAS_32 0x73
79 #define DTYPE_LSI_SCSI 0x80
80 #define DTYPE_ESP_SCSI 0x81
81 #define DTYPE_MEGASAS 0x82
82 #define DTYPE_PVSCSI 0x83
83 #define DTYPE_SDCARD 0x90
85 #define MAXDESCSIZE 80
87 #define TRANSLATION_NONE 0
88 #define TRANSLATION_LBA 1
89 #define TRANSLATION_LARGE 2
90 #define TRANSLATION_RECHS 3
92 #define EXTTYPE_FLOPPY 0
96 #define EXTSTART_HD 0x80
97 #define EXTSTART_CD 0xE0
100 /****************************************************************
102 ****************************************************************/
105 extern u8 FloppyCount, CDCount;
106 extern u8 *bounce_buf_fl;
107 struct drive_s *getDrive(u8 exttype, u8 extdriveoffset);
108 int getDriveId(u8 exttype, struct drive_s *drive);
109 void map_floppy_drive(struct drive_s *drive);
110 void map_hd_drive(struct drive_s *drive);
111 void map_cd_drive(struct drive_s *drive);
113 int fill_edd(struct segoff_s edd, struct drive_s *drive_gf);
114 int default_process_op(struct disk_op_s *op);
115 int process_op(struct disk_op_s *op);
116 int send_disk_op(struct disk_op_s *op);
117 int create_bounce_buf(void);