2012-02-22 08:18:51 +01:00
|
|
|
/*
|
|
|
|
* QEMU PC System Firmware
|
|
|
|
*
|
|
|
|
* Copyright (c) 2003-2004 Fabrice Bellard
|
|
|
|
* Copyright (c) 2011-2012 Intel Corporation
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2012-12-17 18:20:04 +01:00
|
|
|
#include "sysemu/blockdev.h"
|
2013-02-04 11:37:52 +01:00
|
|
|
#include "qemu/error-report.h"
|
2013-02-04 15:40:22 +01:00
|
|
|
#include "hw/sysbus.h"
|
|
|
|
#include "hw/hw.h"
|
2013-02-05 17:06:20 +01:00
|
|
|
#include "hw/i386/pc.h"
|
2012-02-22 08:18:53 +01:00
|
|
|
#include "hw/boards.h"
|
2013-02-04 15:40:22 +01:00
|
|
|
#include "hw/loader.h"
|
2012-12-17 18:20:04 +01:00
|
|
|
#include "sysemu/sysemu.h"
|
2013-02-05 17:06:20 +01:00
|
|
|
#include "hw/block/flash.h"
|
2012-12-17 18:20:04 +01:00
|
|
|
#include "sysemu/kvm.h"
|
2012-02-22 08:18:51 +01:00
|
|
|
|
|
|
|
#define BIOS_FILENAME "bios.bin"
|
|
|
|
|
2012-02-22 08:18:52 +01:00
|
|
|
typedef struct PcSysFwDevice {
|
|
|
|
SysBusDevice busdev;
|
|
|
|
uint8_t rom_only;
|
|
|
|
} PcSysFwDevice;
|
|
|
|
|
2012-02-22 08:18:53 +01:00
|
|
|
static void pc_isa_bios_init(MemoryRegion *rom_memory,
|
|
|
|
MemoryRegion *flash_mem,
|
|
|
|
int ram_size)
|
|
|
|
{
|
|
|
|
int isa_bios_size;
|
|
|
|
MemoryRegion *isa_bios;
|
|
|
|
uint64_t flash_size;
|
|
|
|
void *flash_ptr, *isa_bios_ptr;
|
|
|
|
|
|
|
|
flash_size = memory_region_size(flash_mem);
|
|
|
|
|
|
|
|
/* map the last 128KB of the BIOS in ISA space */
|
|
|
|
isa_bios_size = flash_size;
|
|
|
|
if (isa_bios_size > (128 * 1024)) {
|
|
|
|
isa_bios_size = 128 * 1024;
|
|
|
|
}
|
|
|
|
isa_bios = g_malloc(sizeof(*isa_bios));
|
|
|
|
memory_region_init_ram(isa_bios, "isa-bios", isa_bios_size);
|
|
|
|
vmstate_register_ram_global(isa_bios);
|
|
|
|
memory_region_add_subregion_overlap(rom_memory,
|
|
|
|
0x100000 - isa_bios_size,
|
|
|
|
isa_bios,
|
|
|
|
1);
|
|
|
|
|
|
|
|
/* copy ISA rom image from top of flash memory */
|
|
|
|
flash_ptr = memory_region_get_ram_ptr(flash_mem);
|
|
|
|
isa_bios_ptr = memory_region_get_ram_ptr(isa_bios);
|
|
|
|
memcpy(isa_bios_ptr,
|
|
|
|
((uint8_t*)flash_ptr) + (flash_size - isa_bios_size),
|
|
|
|
isa_bios_size);
|
|
|
|
|
|
|
|
memory_region_set_readonly(isa_bios, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void pc_fw_add_pflash_drv(void)
|
|
|
|
{
|
|
|
|
QemuOpts *opts;
|
|
|
|
QEMUMachine *machine;
|
|
|
|
char *filename;
|
|
|
|
|
|
|
|
if (bios_name == NULL) {
|
|
|
|
bios_name = BIOS_FILENAME;
|
|
|
|
}
|
|
|
|
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
|
2012-12-05 15:28:05 +01:00
|
|
|
if (!filename) {
|
|
|
|
error_report("Can't open BIOS image %s", bios_name);
|
|
|
|
exit(1);
|
|
|
|
}
|
2012-02-22 08:18:53 +01:00
|
|
|
|
|
|
|
opts = drive_add(IF_PFLASH, -1, filename, "readonly=on");
|
2012-04-28 04:20:20 +02:00
|
|
|
|
|
|
|
g_free(filename);
|
|
|
|
|
2012-02-22 08:18:53 +01:00
|
|
|
if (opts == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
machine = find_default_machine();
|
|
|
|
if (machine == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-11-20 15:30:34 +01:00
|
|
|
if (!drive_init(opts, machine->block_default_type)) {
|
2012-11-23 19:12:18 +01:00
|
|
|
qemu_opts_del(opts);
|
|
|
|
}
|
2012-02-22 08:18:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void pc_system_flash_init(MemoryRegion *rom_memory,
|
|
|
|
DriveInfo *pflash_drv)
|
|
|
|
{
|
|
|
|
BlockDriverState *bdrv;
|
|
|
|
int64_t size;
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr phys_addr;
|
2012-02-22 08:18:53 +01:00
|
|
|
int sector_bits, sector_size;
|
|
|
|
pflash_t *system_flash;
|
|
|
|
MemoryRegion *flash_mem;
|
|
|
|
|
|
|
|
bdrv = pflash_drv->bdrv;
|
|
|
|
size = bdrv_getlength(pflash_drv->bdrv);
|
|
|
|
sector_bits = 12;
|
|
|
|
sector_size = 1 << sector_bits;
|
|
|
|
|
|
|
|
if ((size % sector_size) != 0) {
|
|
|
|
fprintf(stderr,
|
|
|
|
"qemu: PC system firmware (pflash) must be a multiple of 0x%x\n",
|
|
|
|
sector_size);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
phys_addr = 0x100000000ULL - size;
|
|
|
|
system_flash = pflash_cfi01_register(phys_addr, NULL, "system.flash", size,
|
|
|
|
bdrv, sector_size, size >> sector_bits,
|
|
|
|
1, 0x0000, 0x0000, 0x0000, 0x0000, 0);
|
|
|
|
flash_mem = pflash_cfi01_get_memory(system_flash);
|
|
|
|
|
|
|
|
pc_isa_bios_init(rom_memory, flash_mem, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void old_pc_system_rom_init(MemoryRegion *rom_memory)
|
2012-02-22 08:18:51 +01:00
|
|
|
{
|
|
|
|
char *filename;
|
|
|
|
MemoryRegion *bios, *isa_bios;
|
|
|
|
int bios_size, isa_bios_size;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* BIOS load */
|
|
|
|
if (bios_name == NULL) {
|
|
|
|
bios_name = BIOS_FILENAME;
|
|
|
|
}
|
|
|
|
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
|
|
|
|
if (filename) {
|
|
|
|
bios_size = get_image_size(filename);
|
|
|
|
} else {
|
|
|
|
bios_size = -1;
|
|
|
|
}
|
|
|
|
if (bios_size <= 0 ||
|
|
|
|
(bios_size % 65536) != 0) {
|
|
|
|
goto bios_error;
|
|
|
|
}
|
|
|
|
bios = g_malloc(sizeof(*bios));
|
|
|
|
memory_region_init_ram(bios, "pc.bios", bios_size);
|
|
|
|
vmstate_register_ram_global(bios);
|
|
|
|
memory_region_set_readonly(bios, true);
|
|
|
|
ret = rom_add_file_fixed(bios_name, (uint32_t)(-bios_size), -1);
|
|
|
|
if (ret != 0) {
|
|
|
|
bios_error:
|
|
|
|
fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_name);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
if (filename) {
|
|
|
|
g_free(filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* map the last 128KB of the BIOS in ISA space */
|
|
|
|
isa_bios_size = bios_size;
|
|
|
|
if (isa_bios_size > (128 * 1024)) {
|
|
|
|
isa_bios_size = 128 * 1024;
|
|
|
|
}
|
|
|
|
isa_bios = g_malloc(sizeof(*isa_bios));
|
|
|
|
memory_region_init_alias(isa_bios, "isa-bios", bios,
|
|
|
|
bios_size - isa_bios_size, isa_bios_size);
|
|
|
|
memory_region_add_subregion_overlap(rom_memory,
|
|
|
|
0x100000 - isa_bios_size,
|
|
|
|
isa_bios,
|
|
|
|
1);
|
|
|
|
memory_region_set_readonly(isa_bios, true);
|
|
|
|
|
|
|
|
/* map all the bios at the top of memory */
|
|
|
|
memory_region_add_subregion(rom_memory,
|
|
|
|
(uint32_t)(-bios_size),
|
|
|
|
bios);
|
|
|
|
}
|
|
|
|
|
pc: Kill the "use flash device for BIOS unless KVM" misfeature
Use of a flash memory device for the BIOS was added in series "[PATCH
v10 0/8] PC system flash support", commit 4732dca..1b89faf, v1.1.
Flash vs. ROM is a guest-visible difference. Thus, flash use had to
be suppressed for machine types pc-1.0 and older. This was
accomplished by adding a dummy device "pc-sysfw" with property
"rom_only":
* Non-zero rom_only means "use ROM". Default for pc-1.0 and older.
* Zero rom_only means "maybe use flash". Default for newer machines.
Not only is the dummy device ugly, it was also retroactively added to
the older machine types! Fortunately, it's not guest-visible (thus no
immediate guest ABI breakage), and has no vmstate (thus no immediate
migration breakage). Breakage occurs only if the user unwisely
enables flash by setting rom_only to zero. Patch review FAIL #1.
Why "maybe use flash"? Flash didn't (and still doesn't) work with
KVM. Therefore, rom_only=0 really means "use flash, except when KVM
is enabled, use ROM". This is a Bad Idea, because it makes enabling/
disabling KVM guest-visible. Patch review FAIL #2.
Aside: it also precludes migrating between KVM on and off, but that's
not possible for other reasons anyway.
Fix as follows:
1. Change the meaning of rom_only=0 to mean "use flash, no ifs, buts,
or maybes" for pc-i440fx-1.5 and pc-q35-1.5. Don't change anything
for older machines (to remain bug-compatible).
2. Change the default value from 0 to 1 for these machines.
Necessary, because 0 doesn't work with KVM. Once it does, we can flip
the default back to 0.
3. Don't revert the retroactive addition of device "pc-sysfw" to older
machine types. Seems not worth the trouble.
4. Add a TODO comment asking for device "pc-sysfw" to be dropped once
flash works with KVM.
Net effect is that you get a BIOS ROM again even when KVM is disabled,
just like for machines predating the introduction of flash.
To get flash instead, use "--global pc-sysfw.rom_only=0".
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1365780303-26398-4-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-12 17:25:03 +02:00
|
|
|
/*
|
|
|
|
* Bug-compatible flash vs. ROM selection enabled?
|
|
|
|
* A few older machines enable this.
|
|
|
|
*/
|
|
|
|
bool pc_sysfw_flash_vs_rom_bug_compatible;
|
|
|
|
|
2012-02-22 08:18:51 +01:00
|
|
|
void pc_system_firmware_init(MemoryRegion *rom_memory)
|
|
|
|
{
|
2012-02-22 08:18:53 +01:00
|
|
|
DriveInfo *pflash_drv;
|
2012-02-22 08:18:52 +01:00
|
|
|
PcSysFwDevice *sysfw_dev;
|
|
|
|
|
pc: Kill the "use flash device for BIOS unless KVM" misfeature
Use of a flash memory device for the BIOS was added in series "[PATCH
v10 0/8] PC system flash support", commit 4732dca..1b89faf, v1.1.
Flash vs. ROM is a guest-visible difference. Thus, flash use had to
be suppressed for machine types pc-1.0 and older. This was
accomplished by adding a dummy device "pc-sysfw" with property
"rom_only":
* Non-zero rom_only means "use ROM". Default for pc-1.0 and older.
* Zero rom_only means "maybe use flash". Default for newer machines.
Not only is the dummy device ugly, it was also retroactively added to
the older machine types! Fortunately, it's not guest-visible (thus no
immediate guest ABI breakage), and has no vmstate (thus no immediate
migration breakage). Breakage occurs only if the user unwisely
enables flash by setting rom_only to zero. Patch review FAIL #1.
Why "maybe use flash"? Flash didn't (and still doesn't) work with
KVM. Therefore, rom_only=0 really means "use flash, except when KVM
is enabled, use ROM". This is a Bad Idea, because it makes enabling/
disabling KVM guest-visible. Patch review FAIL #2.
Aside: it also precludes migrating between KVM on and off, but that's
not possible for other reasons anyway.
Fix as follows:
1. Change the meaning of rom_only=0 to mean "use flash, no ifs, buts,
or maybes" for pc-i440fx-1.5 and pc-q35-1.5. Don't change anything
for older machines (to remain bug-compatible).
2. Change the default value from 0 to 1 for these machines.
Necessary, because 0 doesn't work with KVM. Once it does, we can flip
the default back to 0.
3. Don't revert the retroactive addition of device "pc-sysfw" to older
machine types. Seems not worth the trouble.
4. Add a TODO comment asking for device "pc-sysfw" to be dropped once
flash works with KVM.
Net effect is that you get a BIOS ROM again even when KVM is disabled,
just like for machines predating the introduction of flash.
To get flash instead, use "--global pc-sysfw.rom_only=0".
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1365780303-26398-4-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-12 17:25:03 +02:00
|
|
|
/*
|
|
|
|
* TODO This device exists only so that users can switch between
|
|
|
|
* use of flash and ROM for the BIOS. The ability to switch was
|
|
|
|
* created because flash doesn't work with KVM. Once it does, we
|
2013-05-10 14:38:03 +02:00
|
|
|
* should drop this device.
|
pc: Kill the "use flash device for BIOS unless KVM" misfeature
Use of a flash memory device for the BIOS was added in series "[PATCH
v10 0/8] PC system flash support", commit 4732dca..1b89faf, v1.1.
Flash vs. ROM is a guest-visible difference. Thus, flash use had to
be suppressed for machine types pc-1.0 and older. This was
accomplished by adding a dummy device "pc-sysfw" with property
"rom_only":
* Non-zero rom_only means "use ROM". Default for pc-1.0 and older.
* Zero rom_only means "maybe use flash". Default for newer machines.
Not only is the dummy device ugly, it was also retroactively added to
the older machine types! Fortunately, it's not guest-visible (thus no
immediate guest ABI breakage), and has no vmstate (thus no immediate
migration breakage). Breakage occurs only if the user unwisely
enables flash by setting rom_only to zero. Patch review FAIL #1.
Why "maybe use flash"? Flash didn't (and still doesn't) work with
KVM. Therefore, rom_only=0 really means "use flash, except when KVM
is enabled, use ROM". This is a Bad Idea, because it makes enabling/
disabling KVM guest-visible. Patch review FAIL #2.
Aside: it also precludes migrating between KVM on and off, but that's
not possible for other reasons anyway.
Fix as follows:
1. Change the meaning of rom_only=0 to mean "use flash, no ifs, buts,
or maybes" for pc-i440fx-1.5 and pc-q35-1.5. Don't change anything
for older machines (to remain bug-compatible).
2. Change the default value from 0 to 1 for these machines.
Necessary, because 0 doesn't work with KVM. Once it does, we can flip
the default back to 0.
3. Don't revert the retroactive addition of device "pc-sysfw" to older
machine types. Seems not worth the trouble.
4. Add a TODO comment asking for device "pc-sysfw" to be dropped once
flash works with KVM.
Net effect is that you get a BIOS ROM again even when KVM is disabled,
just like for machines predating the introduction of flash.
To get flash instead, use "--global pc-sysfw.rom_only=0".
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1365780303-26398-4-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-12 17:25:03 +02:00
|
|
|
*/
|
2012-02-22 08:18:52 +01:00
|
|
|
sysfw_dev = (PcSysFwDevice*) qdev_create(NULL, "pc-sysfw");
|
|
|
|
|
2012-04-19 00:33:15 +02:00
|
|
|
qdev_init_nofail(DEVICE(sysfw_dev));
|
|
|
|
|
2012-02-22 08:18:53 +01:00
|
|
|
if (sysfw_dev->rom_only) {
|
|
|
|
old_pc_system_rom_init(rom_memory);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
pflash_drv = drive_get(IF_PFLASH, 0, 0);
|
|
|
|
|
|
|
|
/* Currently KVM cannot execute from device memory.
|
|
|
|
Use old rom based firmware initialization for KVM. */
|
pc: Kill the "use flash device for BIOS unless KVM" misfeature
Use of a flash memory device for the BIOS was added in series "[PATCH
v10 0/8] PC system flash support", commit 4732dca..1b89faf, v1.1.
Flash vs. ROM is a guest-visible difference. Thus, flash use had to
be suppressed for machine types pc-1.0 and older. This was
accomplished by adding a dummy device "pc-sysfw" with property
"rom_only":
* Non-zero rom_only means "use ROM". Default for pc-1.0 and older.
* Zero rom_only means "maybe use flash". Default for newer machines.
Not only is the dummy device ugly, it was also retroactively added to
the older machine types! Fortunately, it's not guest-visible (thus no
immediate guest ABI breakage), and has no vmstate (thus no immediate
migration breakage). Breakage occurs only if the user unwisely
enables flash by setting rom_only to zero. Patch review FAIL #1.
Why "maybe use flash"? Flash didn't (and still doesn't) work with
KVM. Therefore, rom_only=0 really means "use flash, except when KVM
is enabled, use ROM". This is a Bad Idea, because it makes enabling/
disabling KVM guest-visible. Patch review FAIL #2.
Aside: it also precludes migrating between KVM on and off, but that's
not possible for other reasons anyway.
Fix as follows:
1. Change the meaning of rom_only=0 to mean "use flash, no ifs, buts,
or maybes" for pc-i440fx-1.5 and pc-q35-1.5. Don't change anything
for older machines (to remain bug-compatible).
2. Change the default value from 0 to 1 for these machines.
Necessary, because 0 doesn't work with KVM. Once it does, we can flip
the default back to 0.
3. Don't revert the retroactive addition of device "pc-sysfw" to older
machine types. Seems not worth the trouble.
4. Add a TODO comment asking for device "pc-sysfw" to be dropped once
flash works with KVM.
Net effect is that you get a BIOS ROM again even when KVM is disabled,
just like for machines predating the introduction of flash.
To get flash instead, use "--global pc-sysfw.rom_only=0".
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1365780303-26398-4-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-12 17:25:03 +02:00
|
|
|
/*
|
|
|
|
* This is a Bad Idea, because it makes enabling/disabling KVM
|
2013-05-10 14:38:03 +02:00
|
|
|
* guest-visible. Let's fix it for real in QEMU 1.6.
|
pc: Kill the "use flash device for BIOS unless KVM" misfeature
Use of a flash memory device for the BIOS was added in series "[PATCH
v10 0/8] PC system flash support", commit 4732dca..1b89faf, v1.1.
Flash vs. ROM is a guest-visible difference. Thus, flash use had to
be suppressed for machine types pc-1.0 and older. This was
accomplished by adding a dummy device "pc-sysfw" with property
"rom_only":
* Non-zero rom_only means "use ROM". Default for pc-1.0 and older.
* Zero rom_only means "maybe use flash". Default for newer machines.
Not only is the dummy device ugly, it was also retroactively added to
the older machine types! Fortunately, it's not guest-visible (thus no
immediate guest ABI breakage), and has no vmstate (thus no immediate
migration breakage). Breakage occurs only if the user unwisely
enables flash by setting rom_only to zero. Patch review FAIL #1.
Why "maybe use flash"? Flash didn't (and still doesn't) work with
KVM. Therefore, rom_only=0 really means "use flash, except when KVM
is enabled, use ROM". This is a Bad Idea, because it makes enabling/
disabling KVM guest-visible. Patch review FAIL #2.
Aside: it also precludes migrating between KVM on and off, but that's
not possible for other reasons anyway.
Fix as follows:
1. Change the meaning of rom_only=0 to mean "use flash, no ifs, buts,
or maybes" for pc-i440fx-1.5 and pc-q35-1.5. Don't change anything
for older machines (to remain bug-compatible).
2. Change the default value from 0 to 1 for these machines.
Necessary, because 0 doesn't work with KVM. Once it does, we can flip
the default back to 0.
3. Don't revert the retroactive addition of device "pc-sysfw" to older
machine types. Seems not worth the trouble.
4. Add a TODO comment asking for device "pc-sysfw" to be dropped once
flash works with KVM.
Net effect is that you get a BIOS ROM again even when KVM is disabled,
just like for machines predating the introduction of flash.
To get flash instead, use "--global pc-sysfw.rom_only=0".
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1365780303-26398-4-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-12 17:25:03 +02:00
|
|
|
*/
|
2013-05-10 14:38:03 +02:00
|
|
|
if (kvm_enabled()) {
|
2012-02-22 08:18:53 +01:00
|
|
|
if (pflash_drv != NULL) {
|
|
|
|
fprintf(stderr, "qemu: pflash cannot be used with kvm enabled\n");
|
|
|
|
exit(1);
|
|
|
|
} else {
|
|
|
|
sysfw_dev->rom_only = 1;
|
|
|
|
old_pc_system_rom_init(rom_memory);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If a pflash drive is not found, then create one using
|
|
|
|
the bios filename. */
|
|
|
|
if (pflash_drv == NULL) {
|
|
|
|
pc_fw_add_pflash_drv();
|
|
|
|
pflash_drv = drive_get(IF_PFLASH, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pflash_drv != NULL) {
|
|
|
|
pc_system_flash_init(rom_memory, pflash_drv);
|
|
|
|
} else {
|
|
|
|
fprintf(stderr, "qemu: PC system firmware (pflash) not available\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
2012-02-22 08:18:51 +01:00
|
|
|
}
|
|
|
|
|
2012-02-22 08:18:52 +01:00
|
|
|
static Property pcsysfw_properties[] = {
|
2013-05-10 14:38:03 +02:00
|
|
|
DEFINE_PROP_UINT8("rom_only", PcSysFwDevice, rom_only, 0),
|
2012-02-22 08:18:52 +01:00
|
|
|
DEFINE_PROP_END_OF_LIST(),
|
|
|
|
};
|
|
|
|
|
2012-04-19 00:33:15 +02:00
|
|
|
static int pcsysfw_init(DeviceState *dev)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-02-22 08:18:52 +01:00
|
|
|
static void pcsysfw_class_init (ObjectClass *klass, void *data)
|
|
|
|
{
|
|
|
|
DeviceClass *dc = DEVICE_CLASS (klass);
|
|
|
|
|
|
|
|
dc->desc = "PC System Firmware";
|
2012-04-19 00:33:15 +02:00
|
|
|
dc->init = pcsysfw_init;
|
2012-02-22 08:18:52 +01:00
|
|
|
dc->props = pcsysfw_properties;
|
|
|
|
}
|
|
|
|
|
2013-01-10 16:19:07 +01:00
|
|
|
static const TypeInfo pcsysfw_info = {
|
2012-02-22 08:18:52 +01:00
|
|
|
.name = "pc-sysfw",
|
|
|
|
.parent = TYPE_SYS_BUS_DEVICE,
|
|
|
|
.instance_size = sizeof (PcSysFwDevice),
|
|
|
|
.class_init = pcsysfw_class_init,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void pcsysfw_register (void)
|
|
|
|
{
|
|
|
|
type_register_static (&pcsysfw_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
type_init (pcsysfw_register);
|
2012-02-22 08:18:51 +01:00
|
|
|
|