Lines Matching +full:non +full:- +full:flash
4 * Copyright (c) 2003-2004 Fabrice Bellard
5 * Copyright (c) 2011-2012 Intel Corporation
28 #include "sysemu/block-backend.h"
29 #include "qemu/error-report.h"
36 #include "hw/qdev-properties.h"
37 #include "hw/block/flash.h"
55 memory_region_init_ram_guest_memfd(isa_bios, NULL, "isa-bios", in pc_isa_bios_init()
58 memory_region_init_ram(isa_bios, NULL, "isa-bios", isa_bios_size, in pc_isa_bios_init()
62 0x100000 - isa_bios_size, in pc_isa_bios_init()
66 /* copy ISA rom image from top of flash memory */ in pc_isa_bios_init()
70 ((uint8_t*)flash_ptr) + (flash_size - isa_bios_size), in pc_isa_bios_init()
84 qdev_prop_set_uint64(dev, "sector-length", FLASH_SECTOR_SIZE); in pc_pflash_create()
102 if (pcmc->pci_enabled) { in pc_system_flash_create()
103 pcms->flash[0] = pc_pflash_create(pcms, "system.flash0", in pc_system_flash_create()
105 pcms->flash[1] = pc_pflash_create(pcms, "system.flash1", in pc_system_flash_create()
115 assert(PC_MACHINE_GET_CLASS(pcms)->pci_enabled); in pc_system_flash_cleanup_unused()
117 for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) { in pc_system_flash_cleanup_unused()
118 if (!qdev_is_realized(DEVICE(pcms->flash[i]))) { in pc_system_flash_cleanup_unused()
122 object_unparent(OBJECT(pcms->flash[i])); in pc_system_flash_cleanup_unused()
123 pcms->flash[i] = NULL; in pc_system_flash_cleanup_unused()
129 * Map the pcms->flash[] from 4GiB downward, and realize.
130 * Map them in descending order, i.e. pcms->flash[0] at the top,
132 * Stop at the first pcms->flash[0] lacking a block backend.
133 * Set each flash's size from its block backend. Fatal error if the
134 * size isn't a non-zero multiple of 4KiB, or the total size exceeds
135 * pcms->max_fw_size.
137 * If pcms->flash[0] has a block backend, its memory is passed to
138 * pc_isa_bios_init(). Merging several flash devices for isa-bios is
155 assert(PC_MACHINE_GET_CLASS(pcms)->pci_enabled); in pc_system_flash_map()
157 for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) { in pc_system_flash_map()
160 system_flash = pcms->flash[i]; in pc_system_flash_map()
168 blk_name(blk), strerror(-size)); in pc_system_flash_map()
175 info_report("its size must be a non-zero multiple of 0x%x", in pc_system_flash_map()
180 || total_size > HWADDR_MAX - size in pc_system_flash_map()
181 || total_size + size > pcms->max_fw_size) { in pc_system_flash_map()
184 pcms->max_fw_size); in pc_system_flash_map()
189 gpa = 0x100000000ULL - total_size; /* where the flash is mapped */ in pc_system_flash_map()
190 qdev_prop_set_uint32(DEVICE(system_flash), "num-blocks", in pc_system_flash_map()
197 if (pcmc->isa_bios_alias) { in pc_system_flash_map()
198 x86_isa_bios_init(&x86ms->isa_bios, rom_memory, flash_mem, in pc_system_flash_map()
201 pc_isa_bios_init(pcms, &x86ms->isa_bios, rom_memory, flash_mem); in pc_system_flash_map()
219 BlockBackend *pflash_blk[ARRAY_SIZE(pcms->flash)]; in pc_system_firmware_init()
221 if (!pcmc->pci_enabled) { in pc_system_firmware_init()
226 /* Map legacy -drive if=pflash to machine properties */ in pc_system_firmware_init()
227 for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) { in pc_system_firmware_init()
228 pflash_cfi01_legacy_drive(pcms->flash[i], in pc_system_firmware_init()
230 pflash_blk[i] = pflash_cfi01_get_blk(pcms->flash[i]); in pc_system_firmware_init()
234 for (i = 1; i < ARRAY_SIZE(pcms->flash); i++) { in pc_system_firmware_init()
235 if (pflash_blk[i] && !pflash_blk[i - 1]) { in pc_system_firmware_init()
236 error_report("pflash%d requires pflash%d", i, i - 1); in pc_system_firmware_init()
247 * Older KVM cannot execute from device memory. So, flash in pc_system_firmware_init()
266 * OVMF places a GUIDed structures in the flash, so in x86_firmware_configure()