Revision 6ac0e82d hw/pc.c
b/hw/pc.c | ||
---|---|---|
152 | 152 |
rtc_set_memory(s, info_ofs + 8, sectors); |
153 | 153 |
} |
154 | 154 |
|
155 |
/* convert boot_device letter to something recognizable by the bios */ |
|
156 |
static int boot_device2nibble(char boot_device) |
|
157 |
{ |
|
158 |
switch(boot_device) { |
|
159 |
case 'a': |
|
160 |
case 'b': |
|
161 |
return 0x01; /* floppy boot */ |
|
162 |
case 'c': |
|
163 |
return 0x02; /* hard drive boot */ |
|
164 |
case 'd': |
|
165 |
return 0x03; /* CD-ROM boot */ |
|
166 |
case 'n': |
|
167 |
return 0x04; /* Network boot */ |
|
168 |
} |
|
169 |
return 0; |
|
170 |
} |
|
171 |
|
|
155 | 172 |
/* hd_table must contain 4 block drivers */ |
156 |
static void cmos_init(int ram_size, int boot_device, BlockDriverState **hd_table)
|
|
173 |
static void cmos_init(int ram_size, const char *boot_device, BlockDriverState **hd_table)
|
|
157 | 174 |
{ |
158 | 175 |
RTCState *s = rtc_state; |
159 | 176 |
int val; |
... | ... | |
184 | 201 |
rtc_set_memory(s, 0x34, val); |
185 | 202 |
rtc_set_memory(s, 0x35, val >> 8); |
186 | 203 |
|
187 |
switch(boot_device) { |
|
188 |
case 'a': |
|
189 |
case 'b': |
|
190 |
rtc_set_memory(s, 0x3d, 0x01); /* floppy boot */ |
|
191 |
if (!fd_bootchk) |
|
192 |
rtc_set_memory(s, 0x38, 0x01); /* disable signature check */ |
|
193 |
break; |
|
194 |
default: |
|
195 |
case 'c': |
|
196 |
rtc_set_memory(s, 0x3d, 0x02); /* hard drive boot */ |
|
197 |
break; |
|
198 |
case 'd': |
|
199 |
rtc_set_memory(s, 0x3d, 0x03); /* CD-ROM boot */ |
|
200 |
break; |
|
201 |
case 'n': |
|
202 |
rtc_set_memory(s, 0x3d, 0x04); /* Network boot */ |
|
203 |
break; |
|
204 |
} |
|
204 |
/* set boot devices, and disable floppy signature check if requested */ |
|
205 |
rtc_set_memory(s, 0x3d, |
|
206 |
boot_device2nibble(boot_device[1]) << 4 | |
|
207 |
boot_device2nibble(boot_device[0]) ); |
|
208 |
rtc_set_memory(s, 0x38, |
|
209 |
boot_device2nibble(boot_device[2]) << 4 | (fd_bootchk ? 0x0 : 0x1)); |
|
205 | 210 |
|
206 | 211 |
/* floppy type */ |
207 | 212 |
|
... | ... | |
663 | 668 |
} |
664 | 669 |
|
665 | 670 |
/* PC hardware initialisation */ |
666 |
static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
|
|
671 |
static void pc_init1(int ram_size, int vga_ram_size, const char *boot_device,
|
|
667 | 672 |
DisplayState *ds, const char **fd_filename, int snapshot, |
668 | 673 |
const char *kernel_filename, const char *kernel_cmdline, |
669 | 674 |
const char *initrd_filename, |
... | ... | |
940 | 945 |
#endif |
941 | 946 |
} |
942 | 947 |
|
943 |
static void pc_init_pci(int ram_size, int vga_ram_size, int boot_device,
|
|
948 |
static void pc_init_pci(int ram_size, int vga_ram_size, const char *boot_device,
|
|
944 | 949 |
DisplayState *ds, const char **fd_filename, |
945 | 950 |
int snapshot, |
946 | 951 |
const char *kernel_filename, |
... | ... | |
954 | 959 |
initrd_filename, 1); |
955 | 960 |
} |
956 | 961 |
|
957 |
static void pc_init_isa(int ram_size, int vga_ram_size, int boot_device,
|
|
962 |
static void pc_init_isa(int ram_size, int vga_ram_size, const char *boot_device,
|
|
958 | 963 |
DisplayState *ds, const char **fd_filename, |
959 | 964 |
int snapshot, |
960 | 965 |
const char *kernel_filename, |
Also available in: Unified diff