Commit 777428f2d23cfc62326933398c009b7955eed011
1 parent
5b60212f
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
Showing
1 changed file
with
25 additions
and
29 deletions
hw/pc.c
... | ... | @@ -76,6 +76,30 @@ static inline int to_bcd(RTCState *s, int a) |
76 | 76 | return ((a / 10) << 4) | (a % 10); |
77 | 77 | } |
78 | 78 | |
79 | +static int cmos_get_fd_drive_type(int fd0) | |
80 | +{ | |
81 | + int val; | |
82 | + | |
83 | + switch (fd0) { | |
84 | + case 0: | |
85 | + /* 1.44 Mb 3"5 drive */ | |
86 | + val = 4; | |
87 | + break; | |
88 | + case 1: | |
89 | + /* 2.88 Mb 3"5 drive */ | |
90 | + val = 5; | |
91 | + break; | |
92 | + case 2: | |
93 | + /* 1.2 Mb 5"5 drive */ | |
94 | + val = 2; | |
95 | + break; | |
96 | + default: | |
97 | + val = 0; | |
98 | + break; | |
99 | + } | |
100 | + return val; | |
101 | +} | |
102 | + | |
79 | 103 | static void cmos_init(int ram_size, int boot_device) |
80 | 104 | { |
81 | 105 | RTCState *s = rtc_state; |
... | ... | @@ -133,35 +157,7 @@ static void cmos_init(int ram_size, int boot_device) |
133 | 157 | fd0 = fdctrl_get_drive_type(floppy_controller, 0); |
134 | 158 | fd1 = fdctrl_get_drive_type(floppy_controller, 1); |
135 | 159 | |
136 | - val = 0; | |
137 | - switch (fd0) { | |
138 | - case 0: | |
139 | - /* 1.44 Mb 3"5 drive */ | |
140 | - val |= 0x40; | |
141 | - break; | |
142 | - case 1: | |
143 | - /* 2.88 Mb 3"5 drive */ | |
144 | - val |= 0x60; | |
145 | - break; | |
146 | - case 2: | |
147 | - /* 1.2 Mb 5"5 drive */ | |
148 | - val |= 0x20; | |
149 | - break; | |
150 | - } | |
151 | - switch (fd1) { | |
152 | - case 0: | |
153 | - /* 1.44 Mb 3"5 drive */ | |
154 | - val |= 0x04; | |
155 | - break; | |
156 | - case 1: | |
157 | - /* 2.88 Mb 3"5 drive */ | |
158 | - val |= 0x06; | |
159 | - break; | |
160 | - case 2: | |
161 | - /* 1.2 Mb 5"5 drive */ | |
162 | - val |= 0x02; | |
163 | - break; | |
164 | - } | |
160 | + val = (cmos_get_fd_drive_type(fd0) << 4) | cmos_get_fd_drive_type(fd1); | |
165 | 161 | rtc_set_memory(s, 0x10, val); |
166 | 162 | |
167 | 163 | val = 0; | ... | ... |