diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-05-23 16:26:20 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-05-23 16:26:20 +0000 |
commit | 777428f2d23cfc62326933398c009b7955eed011 (patch) | |
tree | e464455b141026656f46f96c432df87d6513b675 /hw/pc.c | |
parent | 5b60212f2addaf6ccc7c5884c0605a1ccd413c48 (diff) | |
download | qemu-777428f2d23cfc62326933398c009b7955eed011.zip qemu-777428f2d23cfc62326933398c009b7955eed011.tar.gz qemu-777428f2d23cfc62326933398c009b7955eed011.tar.bz2 |
fixed 2.88 MB boot (aka FreeBSD 5.2.1 boot fix)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@849 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/pc.c')
-rw-r--r-- | hw/pc.c | 54 |
1 files changed, 25 insertions, 29 deletions
@@ -76,6 +76,30 @@ static inline int to_bcd(RTCState *s, int a) return ((a / 10) << 4) | (a % 10); } +static int cmos_get_fd_drive_type(int fd0) +{ + int val; + + switch (fd0) { + case 0: + /* 1.44 Mb 3"5 drive */ + val = 4; + break; + case 1: + /* 2.88 Mb 3"5 drive */ + val = 5; + break; + case 2: + /* 1.2 Mb 5"5 drive */ + val = 2; + break; + default: + val = 0; + break; + } + return val; +} + static void cmos_init(int ram_size, int boot_device) { RTCState *s = rtc_state; @@ -133,35 +157,7 @@ static void cmos_init(int ram_size, int boot_device) fd0 = fdctrl_get_drive_type(floppy_controller, 0); fd1 = fdctrl_get_drive_type(floppy_controller, 1); - val = 0; - switch (fd0) { - case 0: - /* 1.44 Mb 3"5 drive */ - val |= 0x40; - break; - case 1: - /* 2.88 Mb 3"5 drive */ - val |= 0x60; - break; - case 2: - /* 1.2 Mb 5"5 drive */ - val |= 0x20; - break; - } - switch (fd1) { - case 0: - /* 1.44 Mb 3"5 drive */ - val |= 0x04; - break; - case 1: - /* 2.88 Mb 3"5 drive */ - val |= 0x06; - break; - case 2: - /* 1.2 Mb 5"5 drive */ - val |= 0x02; - break; - } + val = (cmos_get_fd_drive_type(fd0) << 4) | cmos_get_fd_drive_type(fd1); rtc_set_memory(s, 0x10, val); val = 0; |