More generic boot devices specification, allowing more devices to be specified

and avoiding per-target hardcoded limitations.
The machine implementations can then check if the given devices match the
actual hardware implementation and firmware API.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3577 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
j_mayer 2007-11-11 01:50:45 +00:00
parent aba9ee8726
commit 28c5af54c6
5 changed files with 125 additions and 51 deletions

22
hw/pc.c
View file

@ -173,6 +173,7 @@ static int boot_device2nibble(char boot_device)
static void cmos_init(int ram_size, const char *boot_device, BlockDriverState **hd_table)
{
RTCState *s = rtc_state;
int nbds, bds[3] = { 0, };
int val;
int fd0, fd1, nb;
int i;
@ -202,11 +203,22 @@ static void cmos_init(int ram_size, const char *boot_device, BlockDriverState **
rtc_set_memory(s, 0x35, val >> 8);
/* set boot devices, and disable floppy signature check if requested */
rtc_set_memory(s, 0x3d,
boot_device2nibble(boot_device[1]) << 4 |
boot_device2nibble(boot_device[0]) );
rtc_set_memory(s, 0x38,
boot_device2nibble(boot_device[2]) << 4 | (fd_bootchk ? 0x0 : 0x1));
#define PC_MAX_BOOT_DEVICES 3
nbds = strlen(boot_device);
if (nbds > PC_MAX_BOOT_DEVICES) {
fprintf(stderr, "Too many boot devices for PC\n");
exit(1);
}
for (i = 0; i < nbds; i++) {
bds[i] = boot_device2nibble(boot_device[i]);
if (bds[i] == 0) {
fprintf(stderr, "Invalid boot device for PC: '%c'\n",
boot_device[i]);
exit(1);
}
}
rtc_set_memory(s, 0x3d, (bds[1] << 4) | bds[0]);
rtc_set_memory(s, 0x38, (bds[2] << 4) | (fd_bootchk ? 0x0 : 0x1));
/* floppy type */