Massive IDE clean-ups, and finally implemented ATAPI hard disks.
This commit is contained in:
@@ -41,13 +41,46 @@ enum {
|
||||
IDE_ATAPI
|
||||
};
|
||||
|
||||
#ifdef SCSI_DEVICE_H
|
||||
typedef struct ide_tf_s {
|
||||
union {
|
||||
uint8_t cylprecomp;
|
||||
uint8_t features;
|
||||
};
|
||||
union {
|
||||
uint8_t secount;
|
||||
uint8_t phase;
|
||||
};
|
||||
union {
|
||||
uint16_t cylinder;
|
||||
uint16_t request_length;
|
||||
};
|
||||
union {
|
||||
uint8_t atastat;
|
||||
uint8_t status;
|
||||
};
|
||||
uint8_t error;
|
||||
uint16_t pad;
|
||||
uint32_t pos;
|
||||
} ide_tf_t;
|
||||
|
||||
#ifdef _TIMER_H_
|
||||
typedef struct ide_s {
|
||||
uint8_t selected;
|
||||
#ifdef ANCIENT_CODE
|
||||
/* Task file. */
|
||||
uint8_t cylprecomp;
|
||||
uint8_t secount;
|
||||
uint16_t cylinder;
|
||||
uint8_t atastat;
|
||||
uint8_t error;
|
||||
uint16_t pad;
|
||||
uint32_t pos;
|
||||
#endif
|
||||
|
||||
/* The rest. */
|
||||
uint8_t selected;
|
||||
uint8_t command;
|
||||
uint8_t fdisk;
|
||||
uint8_t head;
|
||||
uint8_t sector;
|
||||
int type;
|
||||
int board;
|
||||
int irqstat;
|
||||
@@ -56,18 +89,12 @@ typedef struct ide_s {
|
||||
int blockcount;
|
||||
int hdd_num;
|
||||
int channel;
|
||||
int pos;
|
||||
int sector_pos;
|
||||
int lba;
|
||||
int reset;
|
||||
int mdma_mode;
|
||||
int do_initial_read;
|
||||
uint32_t secount;
|
||||
uint32_t sector;
|
||||
uint32_t cylinder;
|
||||
uint32_t head;
|
||||
uint32_t drive;
|
||||
uint32_t cylprecomp;
|
||||
uint32_t cfg_spt;
|
||||
uint32_t cfg_hpc;
|
||||
uint32_t lba_addr;
|
||||
@@ -80,11 +107,19 @@ typedef struct ide_s {
|
||||
|
||||
pc_timer_t timer;
|
||||
|
||||
/* Task file. */
|
||||
ide_tf_t * tf;
|
||||
|
||||
/* Stuff mostly used by ATAPI */
|
||||
#ifdef SCSI_DEVICE_H
|
||||
scsi_common_t *sc;
|
||||
#else
|
||||
void * sc;
|
||||
#endif
|
||||
int interrupt_drq;
|
||||
double pending_delay;
|
||||
|
||||
#ifdef SCSI_DEVICE_H
|
||||
int (*get_max)(int ide_has_dma, int type);
|
||||
int (*get_timings)(int ide_has_dma, int type);
|
||||
void (*identify)(struct ide_s *ide, int ide_has_dma);
|
||||
@@ -94,10 +129,22 @@ typedef struct ide_s {
|
||||
uint8_t (*phase_data_out)(scsi_common_t *sc);
|
||||
void (*command_stop)(scsi_common_t *sc);
|
||||
void (*bus_master_error)(scsi_common_t *sc);
|
||||
#else
|
||||
void * get_max;
|
||||
void * get_timings;
|
||||
void * identify;
|
||||
void * stop;
|
||||
void * device_reset;
|
||||
void * phase_data_out;
|
||||
void * command_stop;
|
||||
void * bus_master_error;
|
||||
#endif
|
||||
} ide_t;
|
||||
|
||||
#ifdef EMU_HDC_H
|
||||
extern ide_t *ide_drives[IDE_NUM];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Type:
|
||||
0 = PIO,
|
||||
@@ -155,16 +202,9 @@ extern void ide_set_bus_master(int board,
|
||||
extern void win_cdrom_eject(uint8_t id);
|
||||
extern void win_cdrom_reload(uint8_t id);
|
||||
|
||||
extern void ide_set_base(int board, uint16_t port);
|
||||
extern void ide_set_side(int board, uint16_t port);
|
||||
extern void ide_set_base_addr(int board, int base, uint16_t port);
|
||||
|
||||
extern void ide_set_handlers(uint8_t board);
|
||||
extern void ide_remove_handlers(uint8_t board);
|
||||
|
||||
extern void ide_pri_enable(void);
|
||||
extern void ide_pri_disable(void);
|
||||
extern void ide_sec_enable(void);
|
||||
extern void ide_sec_disable(void);
|
||||
extern void ide_handlers(uint8_t board, int set);
|
||||
|
||||
extern void ide_board_set_force_ata3(int board, int force_ata3);
|
||||
#ifdef EMU_ISAPNP_H
|
||||
@@ -183,4 +223,16 @@ extern void ide_padstr8(uint8_t *buf, int buf_size, const char *src);
|
||||
extern uint8_t ide_read_ali_75(void);
|
||||
extern uint8_t ide_read_ali_76(void);
|
||||
|
||||
/* Legacy #define's. */
|
||||
#define ide_set_base(board, port) ide_set_base_addr(board, 0, port)
|
||||
#define ide_set_side(board, port) ide_set_base_addr(board, 1, port)
|
||||
|
||||
#define ide_pri_enable() ide_handlers(0, 1)
|
||||
#define ide_pri_disable() ide_handlers(0, 0)
|
||||
#define ide_sec_enable() ide_handlers(1, 1)
|
||||
#define ide_sec_disable() ide_handlers(1, 0)
|
||||
|
||||
#define ide_set_handlers(board) ide_handlers(board, 1)
|
||||
#define ide_remove_handlers(board) ide_handlers(board, 0)
|
||||
|
||||
#endif /*EMU_IDE_H*/
|
||||
|
||||
@@ -148,7 +148,8 @@ typedef struct hard_disk_t {
|
||||
uint8_t scsi_id;
|
||||
};
|
||||
uint8_t bus;
|
||||
uint8_t res; /* Reserved for bus mode */
|
||||
uint8_t bus_mode; /* Bit 0 = PIO suported;
|
||||
Bit 1 = DMA supportd. */
|
||||
uint8_t wp; /* Disk has been mounted READ-ONLY */
|
||||
uint8_t pad;
|
||||
uint8_t pad0;
|
||||
|
||||
@@ -128,23 +128,35 @@ typedef struct mo_t {
|
||||
mode_sense_pages_t ms_pages_saved;
|
||||
|
||||
mo_drive_t *drv;
|
||||
#ifdef EMU_IDE_H
|
||||
ide_tf_t * tf;
|
||||
#else
|
||||
void * tf;
|
||||
#endif
|
||||
|
||||
uint8_t *buffer;
|
||||
uint8_t atapi_cdb[16];
|
||||
uint8_t current_cdb[16];
|
||||
uint8_t sense[256];
|
||||
|
||||
uint8_t status;
|
||||
uint8_t phase;
|
||||
uint8_t error;
|
||||
uint8_t id;
|
||||
#ifdef ANCIENT_CODE
|
||||
/* Task file. */
|
||||
uint8_t features;
|
||||
uint8_t phase;
|
||||
uint16_t request_length;
|
||||
uint8_t status;
|
||||
uint8_t error;
|
||||
uint16_t pad;
|
||||
uint32_t pos;
|
||||
#endif
|
||||
|
||||
uint8_t id;
|
||||
uint8_t cur_lun;
|
||||
uint8_t pad0;
|
||||
uint8_t pad1;
|
||||
|
||||
uint16_t request_length;
|
||||
uint16_t max_transfer_len;
|
||||
uint16_t pad2;
|
||||
|
||||
int requested_blocks;
|
||||
int packet_status;
|
||||
@@ -158,7 +170,6 @@ typedef struct mo_t {
|
||||
uint32_t sector_pos;
|
||||
uint32_t sector_len;
|
||||
uint32_t packet_len;
|
||||
uint32_t pos;
|
||||
|
||||
double callback;
|
||||
} mo_t;
|
||||
|
||||
@@ -26,24 +26,36 @@ typedef struct scsi_cdrom_t {
|
||||
/* Common block. */
|
||||
mode_sense_pages_t ms_pages_saved;
|
||||
|
||||
cdrom_t *drv;
|
||||
cdrom_t * drv;
|
||||
#ifdef EMU_IDE_H
|
||||
ide_tf_t *tf;
|
||||
#else
|
||||
void * tf;
|
||||
#endif
|
||||
|
||||
uint8_t *buffer;
|
||||
uint8_t atapi_cdb[16];
|
||||
uint8_t current_cdb[16];
|
||||
uint8_t sense[256];
|
||||
|
||||
uint8_t status;
|
||||
uint8_t phase;
|
||||
uint8_t error;
|
||||
uint8_t id;
|
||||
#ifdef ANCIENT_CODE
|
||||
/* Task file. */
|
||||
uint8_t features;
|
||||
uint8_t phase;
|
||||
uint16_t request_length;
|
||||
uint8_t status;
|
||||
uint8_t error;
|
||||
uint16_t pad;
|
||||
uint32_t pos;
|
||||
#endif
|
||||
|
||||
uint8_t id;
|
||||
uint8_t cur_lun;
|
||||
uint8_t early;
|
||||
uint8_t pad1;
|
||||
|
||||
uint16_t request_length;
|
||||
uint16_t max_transfer_len;
|
||||
uint16_t pad2;
|
||||
|
||||
int requested_blocks;
|
||||
int packet_status;
|
||||
@@ -57,7 +69,6 @@ typedef struct scsi_cdrom_t {
|
||||
uint32_t sector_pos;
|
||||
uint32_t sector_len;
|
||||
uint32_t packet_len;
|
||||
uint32_t pos;
|
||||
|
||||
double callback;
|
||||
|
||||
|
||||
@@ -347,7 +347,12 @@ typedef struct mode_sense_pages_t {
|
||||
typedef struct scsi_common_s {
|
||||
mode_sense_pages_t ms_pages_saved;
|
||||
|
||||
void *priv;
|
||||
void * priv;
|
||||
#ifdef EMU_IDE_H
|
||||
ide_tf_t *tf;
|
||||
#else
|
||||
void * tf;
|
||||
#endif
|
||||
|
||||
uint8_t *temp_buffer;
|
||||
uint8_t atapi_cdb[16]; /* This is atapi_cdb in ATAPI-supporting devices,
|
||||
@@ -355,17 +360,24 @@ typedef struct scsi_common_s {
|
||||
uint8_t current_cdb[16];
|
||||
uint8_t sense[256];
|
||||
|
||||
uint8_t status;
|
||||
uint8_t phase;
|
||||
uint8_t error;
|
||||
uint8_t id;
|
||||
#ifdef ANCIENT_CODE
|
||||
/* Task file. */
|
||||
uint8_t features;
|
||||
uint8_t phase;
|
||||
uint16_t request_length;
|
||||
uint8_t status;
|
||||
uint8_t error;
|
||||
uint16_t pad;
|
||||
uint32_t pos;
|
||||
#endif
|
||||
|
||||
uint8_t id;
|
||||
uint8_t cur_lun;
|
||||
uint8_t pad0;
|
||||
uint8_t pad1;
|
||||
|
||||
uint16_t request_length;
|
||||
uint16_t max_transfer_len;
|
||||
uint16_t pad2;
|
||||
|
||||
int requested_blocks;
|
||||
int packet_status;
|
||||
@@ -379,7 +391,6 @@ typedef struct scsi_common_s {
|
||||
uint32_t sector_pos;
|
||||
uint32_t sector_len;
|
||||
uint32_t packet_len;
|
||||
uint32_t pos;
|
||||
|
||||
double callback;
|
||||
} scsi_common_t;
|
||||
|
||||
@@ -20,38 +20,48 @@ typedef struct scsi_disk_t {
|
||||
mode_sense_pages_t ms_pages_saved;
|
||||
|
||||
hard_disk_t *drv;
|
||||
#ifdef EMU_IDE_H
|
||||
ide_tf_t * tf;
|
||||
#else
|
||||
void * tf;
|
||||
#endif
|
||||
|
||||
uint8_t *temp_buffer;
|
||||
uint8_t pad[16]; /* This is atapi_cdb in ATAPI-supporting devices,
|
||||
and pad in SCSI-only devices. */
|
||||
uint8_t atapi_cdb[16];
|
||||
uint8_t current_cdb[16];
|
||||
uint8_t sense[256];
|
||||
|
||||
uint8_t status;
|
||||
#ifdef ANCIENT_CODE
|
||||
/* Task file. */
|
||||
uint8_t features;
|
||||
uint8_t phase;
|
||||
uint8_t error;
|
||||
uint8_t id;
|
||||
uint8_t pad0;
|
||||
uint8_t cur_lun;
|
||||
uint8_t pad1;
|
||||
uint8_t pad2;
|
||||
|
||||
uint16_t request_length;
|
||||
uint16_t pad4;
|
||||
uint8_t status;
|
||||
uint8_t error;
|
||||
uint16_t pad;
|
||||
uint32_t pos;
|
||||
#endif
|
||||
|
||||
uint8_t id;
|
||||
uint8_t cur_lun;
|
||||
uint8_t pad0;
|
||||
uint8_t pad1;
|
||||
|
||||
uint16_t max_transfer_len;
|
||||
uint16_t pad2;
|
||||
|
||||
int requested_blocks;
|
||||
int packet_status;
|
||||
int total_length;
|
||||
int do_page_save;
|
||||
int unit_attention;
|
||||
int pad5;
|
||||
int request_pos;
|
||||
int pad6;
|
||||
int pad7;
|
||||
|
||||
uint32_t sector_pos;
|
||||
uint32_t sector_len;
|
||||
uint32_t packet_len;
|
||||
uint32_t pos;
|
||||
|
||||
double callback;
|
||||
} scsi_disk_t;
|
||||
|
||||
@@ -74,23 +74,35 @@ typedef struct zip_t {
|
||||
mode_sense_pages_t ms_pages_saved;
|
||||
|
||||
zip_drive_t *drv;
|
||||
#ifdef EMU_IDE_H
|
||||
ide_tf_t * tf;
|
||||
#else
|
||||
void * tf;
|
||||
#endif
|
||||
|
||||
uint8_t *buffer;
|
||||
uint8_t atapi_cdb[16];
|
||||
uint8_t current_cdb[16];
|
||||
uint8_t sense[256];
|
||||
|
||||
uint8_t status;
|
||||
uint8_t phase;
|
||||
uint8_t error;
|
||||
uint8_t id;
|
||||
#ifdef ANCIENT_CODE
|
||||
/* Task file. */
|
||||
uint8_t features;
|
||||
uint8_t phase;
|
||||
uint16_t request_length;
|
||||
uint8_t status;
|
||||
uint8_t error;
|
||||
uint16_t pad;
|
||||
uint32_t pos;
|
||||
#endif
|
||||
|
||||
uint8_t id;
|
||||
uint8_t cur_lun;
|
||||
uint8_t pad0;
|
||||
uint8_t pad1;
|
||||
|
||||
uint16_t request_length;
|
||||
uint16_t max_transfer_len;
|
||||
uint16_t pad2;
|
||||
|
||||
int requested_blocks;
|
||||
int packet_status;
|
||||
@@ -104,7 +116,6 @@ typedef struct zip_t {
|
||||
uint32_t sector_pos;
|
||||
uint32_t sector_len;
|
||||
uint32_t packet_len;
|
||||
uint32_t pos;
|
||||
|
||||
double callback;
|
||||
} zip_t;
|
||||
|
||||
Reference in New Issue
Block a user