fdc: use FDriveType for floppy drive type

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Blue Swirl 2011-02-12 21:23:12 +00:00
parent 5bbdbb4676
commit d288c7ba7b
3 changed files with 15 additions and 10 deletions

View File

@ -627,7 +627,7 @@ static void fdctrl_handle_tc(void *opaque, int irq, int level)
} }
/* XXX: may change if moved to bdrv */ /* XXX: may change if moved to bdrv */
int fdctrl_get_drive_type(FDCtrl *fdctrl, int drive_num) FDriveType fdctrl_get_drive_type(FDCtrl *fdctrl, int drive_num)
{ {
return fdctrl->drives[drive_num].drive; return fdctrl->drives[drive_num].drive;
} }

View File

@ -1,6 +1,8 @@
#ifndef HW_FDC_H #ifndef HW_FDC_H
#define HW_FDC_H #define HW_FDC_H
#include "blockdev.h"
/* fdc.c */ /* fdc.c */
#define MAX_FD 2 #define MAX_FD 2
@ -11,6 +13,6 @@ FDCtrl *fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
target_phys_addr_t mmio_base, DriveInfo **fds); target_phys_addr_t mmio_base, DriveInfo **fds);
FDCtrl *sun4m_fdctrl_init(qemu_irq irq, target_phys_addr_t io_base, FDCtrl *sun4m_fdctrl_init(qemu_irq irq, target_phys_addr_t io_base,
DriveInfo **fds, qemu_irq *fdc_tc); DriveInfo **fds, qemu_irq *fdc_tc);
int fdctrl_get_drive_type(FDCtrl *fdctrl, int drive_num); FDriveType fdctrl_get_drive_type(FDCtrl *fdctrl, int drive_num);
#endif #endif

19
hw/pc.c
View File

@ -192,23 +192,24 @@ static void pic_irq_request(void *opaque, int irq, int level)
#define REG_EQUIPMENT_BYTE 0x14 #define REG_EQUIPMENT_BYTE 0x14
static int cmos_get_fd_drive_type(int fd0) static int cmos_get_fd_drive_type(FDriveType fd0)
{ {
int val; int val;
switch (fd0) { switch (fd0) {
case 0: case FDRIVE_DRV_144:
/* 1.44 Mb 3"5 drive */ /* 1.44 Mb 3"5 drive */
val = 4; val = 4;
break; break;
case 1: case FDRIVE_DRV_288:
/* 2.88 Mb 3"5 drive */ /* 2.88 Mb 3"5 drive */
val = 5; val = 5;
break; break;
case 2: case FDRIVE_DRV_120:
/* 1.2 Mb 5"5 drive */ /* 1.2 Mb 5"5 drive */
val = 2; val = 2;
break; break;
case FDRIVE_DRV_NONE:
default: default:
val = 0; val = 0;
break; break;
@ -335,8 +336,8 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
BusState *idebus0, BusState *idebus1, BusState *idebus0, BusState *idebus1,
FDCtrl *floppy_controller, ISADevice *s) FDCtrl *floppy_controller, ISADevice *s)
{ {
int val; int val, nb;
int fd0, fd1, nb; FDriveType fd0, fd1;
static pc_cmos_init_late_arg arg; static pc_cmos_init_late_arg arg;
/* various important CMOS locations needed by PC/Bochs bios */ /* various important CMOS locations needed by PC/Bochs bios */
@ -387,10 +388,12 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
val = 0; val = 0;
nb = 0; nb = 0;
if (fd0 < 3) if (fd0 < FDRIVE_DRV_NONE) {
nb++; nb++;
if (fd1 < 3) }
if (fd1 < FDRIVE_DRV_NONE) {
nb++; nb++;
}
switch (nb) { switch (nb) {
case 0: case 0:
break; break;