提交 ce14710f 编写于 作者: M Markus Armbruster

pflash: Clean up after commit 368a354f, part 2

Our pflash devices are simplistically modelled has having
"num-blocks" sectors of equal size "sector-length".  Real hardware
commonly has sectors of different sizes.  How our "sector-length"
property is related to the physical device's multiple sector sizes
is unclear.

Helper functions pflash_cfi01_register() and pflash_cfi02_register()
create a pflash device, set properties including "sector-length" and
"num-blocks", and realize.  They take parameters @size, @sector_len
and @nb_blocs.

QOMification left parameter @size unused.  Obviously, @size should
match @sector_len and @nb_blocs, i.e. size == sector_len * nb_blocs.
All callers satisfy this.

Remove @nb_blocs and compute it from @size and @sector_len.
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
Message-Id: <20190308094610.21210-16-armbru@redhat.com>
Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
上级 940d5b13
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* GNU GPL, version 2 or (at your option) any later version. * GNU GPL, version 2 or (at your option) any later version.
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/units.h"
#include "hw/hw.h" #include "hw/hw.h"
#include "hw/sysbus.h" #include "hw/sysbus.h"
#include "hw/boards.h" #include "hw/boards.h"
...@@ -37,12 +38,12 @@ static void collie_init(MachineState *machine) ...@@ -37,12 +38,12 @@ static void collie_init(MachineState *machine)
dinfo = drive_get(IF_PFLASH, 0, 0); dinfo = drive_get(IF_PFLASH, 0, 0);
pflash_cfi01_register(SA_CS0, "collie.fl1", 0x02000000, pflash_cfi01_register(SA_CS0, "collie.fl1", 0x02000000,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
(64 * 1024), 512, 4, 0x00, 0x00, 0x00, 0x00, 0); 64 * KiB, 4, 0x00, 0x00, 0x00, 0x00, 0);
dinfo = drive_get(IF_PFLASH, 0, 1); dinfo = drive_get(IF_PFLASH, 0, 1);
pflash_cfi01_register(SA_CS1, "collie.fl2", 0x02000000, pflash_cfi01_register(SA_CS1, "collie.fl2", 0x02000000,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
(64 * 1024), 512, 4, 0x00, 0x00, 0x00, 0x00, 0); 64 * KiB, 4, 0x00, 0x00, 0x00, 0x00, 0);
sysbus_create_simple("scoop", 0x40800000, NULL); sysbus_create_simple("scoop", 0x40800000, NULL);
......
...@@ -131,7 +131,6 @@ static void digic4_add_k8p3215uqb_rom(DigicBoardState *s, hwaddr addr, ...@@ -131,7 +131,6 @@ static void digic4_add_k8p3215uqb_rom(DigicBoardState *s, hwaddr addr,
pflash_cfi02_register(addr, "pflash", FLASH_K8P3215UQB_SIZE, pflash_cfi02_register(addr, "pflash", FLASH_K8P3215UQB_SIZE,
NULL, FLASH_K8P3215UQB_SECTOR_SIZE, NULL, FLASH_K8P3215UQB_SECTOR_SIZE,
FLASH_K8P3215UQB_SIZE / FLASH_K8P3215UQB_SECTOR_SIZE,
DIGIC4_ROM_MAX_SIZE / FLASH_K8P3215UQB_SIZE, DIGIC4_ROM_MAX_SIZE / FLASH_K8P3215UQB_SIZE,
4, 4,
0x00EC, 0x007E, 0x0003, 0x0001, 0x00EC, 0x007E, 0x0003, 0x0001,
......
...@@ -74,8 +74,7 @@ static void connex_init(MachineState *machine) ...@@ -74,8 +74,7 @@ static void connex_init(MachineState *machine)
#endif #endif
if (!pflash_cfi01_register(0x00000000, "connext.rom", connex_rom, if (!pflash_cfi01_register(0x00000000, "connext.rom", connex_rom,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
sector_len, connex_rom / sector_len, sector_len, 2, 0, 0, 0, 0, be)) {
2, 0, 0, 0, 0, be)) {
error_report("Error registering flash memory"); error_report("Error registering flash memory");
exit(1); exit(1);
} }
...@@ -111,8 +110,7 @@ static void verdex_init(MachineState *machine) ...@@ -111,8 +110,7 @@ static void verdex_init(MachineState *machine)
#endif #endif
if (!pflash_cfi01_register(0x00000000, "verdex.rom", verdex_rom, if (!pflash_cfi01_register(0x00000000, "verdex.rom", verdex_rom,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
sector_len, verdex_rom / sector_len, sector_len, 2, 0, 0, 0, 0, be)) {
2, 0, 0, 0, 0, be)) {
error_report("Error registering flash memory"); error_report("Error registering flash memory");
exit(1); exit(1);
} }
......
...@@ -152,8 +152,7 @@ static void mainstone_common_init(MemoryRegion *address_space_mem, ...@@ -152,8 +152,7 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,
i ? "mainstone.flash1" : "mainstone.flash0", i ? "mainstone.flash1" : "mainstone.flash0",
MAINSTONE_FLASH, MAINSTONE_FLASH,
blk_by_legacy_dinfo(dinfo), blk_by_legacy_dinfo(dinfo),
sector_len, MAINSTONE_FLASH / sector_len, sector_len, 4, 0, 0, 0, 0, be)) {
4, 0, 0, 0, 0, be)) {
error_report("Error registering flash memory"); error_report("Error registering flash memory");
exit(1); exit(1);
} }
......
...@@ -1637,14 +1637,14 @@ static void musicpal_init(MachineState *machine) ...@@ -1637,14 +1637,14 @@ static void musicpal_init(MachineState *machine)
#ifdef TARGET_WORDS_BIGENDIAN #ifdef TARGET_WORDS_BIGENDIAN
pflash_cfi02_register(0x100000000ULL - MP_FLASH_SIZE_MAX, pflash_cfi02_register(0x100000000ULL - MP_FLASH_SIZE_MAX,
"musicpal.flash", flash_size, "musicpal.flash", flash_size,
blk, 0x10000, (flash_size + 0xffff) >> 16, blk, 0x10000,
MP_FLASH_SIZE_MAX / flash_size, MP_FLASH_SIZE_MAX / flash_size,
2, 0x00BF, 0x236D, 0x0000, 0x0000, 2, 0x00BF, 0x236D, 0x0000, 0x0000,
0x5555, 0x2AAA, 1); 0x5555, 0x2AAA, 1);
#else #else
pflash_cfi02_register(0x100000000ULL - MP_FLASH_SIZE_MAX, pflash_cfi02_register(0x100000000ULL - MP_FLASH_SIZE_MAX,
"musicpal.flash", flash_size, "musicpal.flash", flash_size,
blk, 0x10000, (flash_size + 0xffff) >> 16, blk, 0x10000,
MP_FLASH_SIZE_MAX / flash_size, MP_FLASH_SIZE_MAX / flash_size,
2, 0x00BF, 0x236D, 0x0000, 0x0000, 2, 0x00BF, 0x236D, 0x0000, 0x0000,
0x5555, 0x2AAA, 0); 0x5555, 0x2AAA, 0);
......
...@@ -155,8 +155,7 @@ static void sx1_init(MachineState *machine, const int version) ...@@ -155,8 +155,7 @@ static void sx1_init(MachineState *machine, const int version)
if (!pflash_cfi01_register(OMAP_CS0_BASE, if (!pflash_cfi01_register(OMAP_CS0_BASE,
"omap_sx1.flash0-1", flash_size, "omap_sx1.flash0-1", flash_size,
blk_by_legacy_dinfo(dinfo), blk_by_legacy_dinfo(dinfo),
sector_size, flash_size / sector_size, sector_size, 4, 0, 0, 0, 0, be)) {
4, 0, 0, 0, 0, be)) {
fprintf(stderr, "qemu: Error registering flash memory %d.\n", fprintf(stderr, "qemu: Error registering flash memory %d.\n",
fl_idx); fl_idx);
} }
...@@ -179,8 +178,7 @@ static void sx1_init(MachineState *machine, const int version) ...@@ -179,8 +178,7 @@ static void sx1_init(MachineState *machine, const int version)
if (!pflash_cfi01_register(OMAP_CS1_BASE, if (!pflash_cfi01_register(OMAP_CS1_BASE,
"omap_sx1.flash1-1", flash1_size, "omap_sx1.flash1-1", flash1_size,
blk_by_legacy_dinfo(dinfo), blk_by_legacy_dinfo(dinfo),
sector_size, flash1_size / sector_size, sector_size, 4, 0, 0, 0, 0, be)) {
4, 0, 0, 0, 0, be)) {
fprintf(stderr, "qemu: Error registering flash memory %d.\n", fprintf(stderr, "qemu: Error registering flash memory %d.\n",
fl_idx); fl_idx);
} }
......
...@@ -369,7 +369,6 @@ static void versatile_init(MachineState *machine, int board_id) ...@@ -369,7 +369,6 @@ static void versatile_init(MachineState *machine, int board_id)
VERSATILE_FLASH_SIZE, VERSATILE_FLASH_SIZE,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
VERSATILE_FLASH_SECT_SIZE, VERSATILE_FLASH_SECT_SIZE,
VERSATILE_FLASH_SIZE / VERSATILE_FLASH_SECT_SIZE,
4, 0x0089, 0x0018, 0x0000, 0x0, 0)) { 4, 0x0089, 0x0018, 0x0000, 0x0, 0)) {
fprintf(stderr, "qemu: Error registering flash memory.\n"); fprintf(stderr, "qemu: Error registering flash memory.\n");
} }
......
...@@ -207,10 +207,9 @@ static void zynq_init(MachineState *machine) ...@@ -207,10 +207,9 @@ static void zynq_init(MachineState *machine)
/* AMD */ /* AMD */
pflash_cfi02_register(0xe2000000, "zynq.pflash", FLASH_SIZE, pflash_cfi02_register(0xe2000000, "zynq.pflash", FLASH_SIZE,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
FLASH_SECTOR_SIZE, FLASH_SECTOR_SIZE, 1,
FLASH_SIZE/FLASH_SECTOR_SIZE, 1,
1, 0x0066, 0x0022, 0x0000, 0x0000, 0x0555, 0x2aa, 1, 0x0066, 0x0022, 0x0000, 0x0000, 0x0555, 0x2aa,
0); 0);
dev = qdev_create(NULL, "xilinx,zynq_slcr"); dev = qdev_create(NULL, "xilinx,zynq_slcr");
qdev_init_nofail(dev); qdev_init_nofail(dev);
......
...@@ -325,8 +325,7 @@ static void z2_init(MachineState *machine) ...@@ -325,8 +325,7 @@ static void z2_init(MachineState *machine)
if (!pflash_cfi01_register(Z2_FLASH_BASE, "z2.flash0", Z2_FLASH_SIZE, if (!pflash_cfi01_register(Z2_FLASH_BASE, "z2.flash0", Z2_FLASH_SIZE,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
sector_len, Z2_FLASH_SIZE / sector_len, sector_len, 4, 0, 0, 0, 0, be)) {
4, 0, 0, 0, 0, be)) {
error_report("Error registering flash memory"); error_report("Error registering flash memory");
exit(1); exit(1);
} }
......
...@@ -940,7 +940,7 @@ PFlashCFI01 *pflash_cfi01_register(hwaddr base, ...@@ -940,7 +940,7 @@ PFlashCFI01 *pflash_cfi01_register(hwaddr base,
const char *name, const char *name,
hwaddr size, hwaddr size,
BlockBackend *blk, BlockBackend *blk,
uint32_t sector_len, int nb_blocs, uint32_t sector_len,
int bank_width, int bank_width,
uint16_t id0, uint16_t id1, uint16_t id0, uint16_t id1,
uint16_t id2, uint16_t id3, uint16_t id2, uint16_t id3,
...@@ -951,7 +951,8 @@ PFlashCFI01 *pflash_cfi01_register(hwaddr base, ...@@ -951,7 +951,8 @@ PFlashCFI01 *pflash_cfi01_register(hwaddr base,
if (blk) { if (blk) {
qdev_prop_set_drive(dev, "drive", blk, &error_abort); qdev_prop_set_drive(dev, "drive", blk, &error_abort);
} }
qdev_prop_set_uint32(dev, "num-blocks", nb_blocs); assert(size % sector_len == 0);
qdev_prop_set_uint32(dev, "num-blocks", size / sector_len);
qdev_prop_set_uint64(dev, "sector-length", sector_len); qdev_prop_set_uint64(dev, "sector-length", sector_len);
qdev_prop_set_uint8(dev, "width", bank_width); qdev_prop_set_uint8(dev, "width", bank_width);
qdev_prop_set_bit(dev, "big-endian", !!be); qdev_prop_set_bit(dev, "big-endian", !!be);
......
...@@ -727,7 +727,7 @@ PFlashCFI02 *pflash_cfi02_register(hwaddr base, ...@@ -727,7 +727,7 @@ PFlashCFI02 *pflash_cfi02_register(hwaddr base,
const char *name, const char *name,
hwaddr size, hwaddr size,
BlockBackend *blk, BlockBackend *blk,
uint32_t sector_len, int nb_blocs, uint32_t sector_len,
int nb_mappings, int width, int nb_mappings, int width,
uint16_t id0, uint16_t id1, uint16_t id0, uint16_t id1,
uint16_t id2, uint16_t id3, uint16_t id2, uint16_t id3,
...@@ -740,7 +740,8 @@ PFlashCFI02 *pflash_cfi02_register(hwaddr base, ...@@ -740,7 +740,8 @@ PFlashCFI02 *pflash_cfi02_register(hwaddr base,
if (blk) { if (blk) {
qdev_prop_set_drive(dev, "drive", blk, &error_abort); qdev_prop_set_drive(dev, "drive", blk, &error_abort);
} }
qdev_prop_set_uint32(dev, "num-blocks", nb_blocs); assert(size % sector_len == 0);
qdev_prop_set_uint32(dev, "num-blocks", size / sector_len);
qdev_prop_set_uint32(dev, "sector-length", sector_len); qdev_prop_set_uint32(dev, "sector-length", sector_len);
qdev_prop_set_uint8(dev, "width", width); qdev_prop_set_uint8(dev, "width", width);
qdev_prop_set_uint8(dev, "mappings", nb_mappings); qdev_prop_set_uint8(dev, "mappings", nb_mappings);
......
...@@ -110,16 +110,13 @@ static void pc_system_flash_init(MemoryRegion *rom_memory) ...@@ -110,16 +110,13 @@ static void pc_system_flash_init(MemoryRegion *rom_memory)
int64_t size; int64_t size;
char *fatal_errmsg = NULL; char *fatal_errmsg = NULL;
hwaddr phys_addr = 0x100000000ULL; hwaddr phys_addr = 0x100000000ULL;
int sector_bits, sector_size; uint32_t sector_size = 4096;
PFlashCFI01 *system_flash; PFlashCFI01 *system_flash;
MemoryRegion *flash_mem; MemoryRegion *flash_mem;
char name[64]; char name[64];
void *flash_ptr; void *flash_ptr;
int ret, flash_size; int ret, flash_size;
sector_bits = 12;
sector_size = 1 << sector_bits;
for (unit = 0; for (unit = 0;
(unit < FLASH_MAP_UNIT_MAX && (unit < FLASH_MAP_UNIT_MAX &&
(pflash_drv = drive_get(IF_PFLASH, 0, unit)) != NULL); (pflash_drv = drive_get(IF_PFLASH, 0, unit)) != NULL);
...@@ -162,7 +159,6 @@ static void pc_system_flash_init(MemoryRegion *rom_memory) ...@@ -162,7 +159,6 @@ static void pc_system_flash_init(MemoryRegion *rom_memory)
snprintf(name, sizeof name, "system.flash%d", unit); snprintf(name, sizeof name, "system.flash%d", unit);
system_flash = pflash_cfi01_register(phys_addr, name, system_flash = pflash_cfi01_register(phys_addr, name,
size, blk, sector_size, size, blk, sector_size,
size >> sector_bits,
1 /* width */, 1 /* width */,
0x0000 /* id0 */, 0x0000 /* id0 */,
0x0000 /* id1 */, 0x0000 /* id1 */,
......
...@@ -115,7 +115,7 @@ static void lm32_evr_init(MachineState *machine) ...@@ -115,7 +115,7 @@ static void lm32_evr_init(MachineState *machine)
/* Spansion S29NS128P */ /* Spansion S29NS128P */
pflash_cfi02_register(flash_base, "lm32_evr.flash", flash_size, pflash_cfi02_register(flash_base, "lm32_evr.flash", flash_size,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
flash_sector_size, flash_size / flash_sector_size, flash_sector_size,
1, 2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1); 1, 2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1);
/* create irq lines */ /* create irq lines */
...@@ -208,7 +208,7 @@ static void lm32_uclinux_init(MachineState *machine) ...@@ -208,7 +208,7 @@ static void lm32_uclinux_init(MachineState *machine)
/* Spansion S29NS128P */ /* Spansion S29NS128P */
pflash_cfi02_register(flash_base, "lm32_uclinux.flash", flash_size, pflash_cfi02_register(flash_base, "lm32_uclinux.flash", flash_size,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
flash_sector_size, flash_size / flash_sector_size, flash_sector_size,
1, 2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1); 1, 2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1);
/* create irq lines */ /* create irq lines */
......
...@@ -122,8 +122,7 @@ milkymist_init(MachineState *machine) ...@@ -122,8 +122,7 @@ milkymist_init(MachineState *machine)
/* Numonyx JS28F256J3F105 */ /* Numonyx JS28F256J3F105 */
pflash_cfi01_register(flash_base, "milkymist.flash", flash_size, pflash_cfi01_register(flash_base, "milkymist.flash", flash_size,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
flash_sector_size, flash_size / flash_sector_size, flash_sector_size, 2, 0x00, 0x89, 0x00, 0x1d, 1);
2, 0x00, 0x89, 0x00, 0x1d, 1);
/* create irq lines */ /* create irq lines */
env->pic_state = lm32_pic_init(qemu_allocate_irq(cpu_irq_handler, cpu, 0)); env->pic_state = lm32_pic_init(qemu_allocate_irq(cpu_irq_handler, cpu, 0));
......
...@@ -108,8 +108,7 @@ petalogix_ml605_init(MachineState *machine) ...@@ -108,8 +108,7 @@ petalogix_ml605_init(MachineState *machine)
* 10th paremeter 0 means little-endian */ * 10th paremeter 0 means little-endian */
pflash_cfi01_register(FLASH_BASEADDR, "petalogix_ml605.flash", FLASH_SIZE, pflash_cfi01_register(FLASH_BASEADDR, "petalogix_ml605.flash", FLASH_SIZE,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
64 * KiB, FLASH_SIZE >> 16, 64 * KiB, 2, 0x89, 0x18, 0x0000, 0x0, 0);
2, 0x89, 0x18, 0x0000, 0x0, 0);
dev = qdev_create(NULL, "xlnx.xps-intc"); dev = qdev_create(NULL, "xlnx.xps-intc");
......
...@@ -89,8 +89,7 @@ petalogix_s3adsp1800_init(MachineState *machine) ...@@ -89,8 +89,7 @@ petalogix_s3adsp1800_init(MachineState *machine)
pflash_cfi01_register(FLASH_BASEADDR, pflash_cfi01_register(FLASH_BASEADDR,
"petalogix_s3adsp1800.flash", FLASH_SIZE, "petalogix_s3adsp1800.flash", FLASH_SIZE,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
64 * KiB, FLASH_SIZE >> 16, 64 * KiB, 1, 0x89, 0x18, 0x0000, 0x0, 1);
1, 0x89, 0x18, 0x0000, 0x0, 1);
dev = qdev_create(NULL, "xlnx.xps-intc"); dev = qdev_create(NULL, "xlnx.xps-intc");
qdev_prop_set_uint32(dev, "kind-of-intr", qdev_prop_set_uint32(dev, "kind-of-intr",
......
...@@ -1264,7 +1264,7 @@ void mips_malta_init(MachineState *machine) ...@@ -1264,7 +1264,7 @@ void mips_malta_init(MachineState *machine)
fl = pflash_cfi01_register(FLASH_ADDRESS, "mips_malta.bios", fl = pflash_cfi01_register(FLASH_ADDRESS, "mips_malta.bios",
FLASH_SIZE, FLASH_SIZE,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
65536, FLASH_SIZE >> 16, 65536,
4, 0x0000, 0x0000, 0x0000, 0x0000, be); 4, 0x0000, 0x0000, 0x0000, 0x0000, be);
bios = pflash_cfi01_get_memory(fl); bios = pflash_cfi01_get_memory(fl);
fl_idx++; fl_idx++;
......
...@@ -237,8 +237,7 @@ void mips_r4k_init(MachineState *machine) ...@@ -237,8 +237,7 @@ void mips_r4k_init(MachineState *machine)
uint32_t mips_rom = 0x00400000; uint32_t mips_rom = 0x00400000;
if (!pflash_cfi01_register(0x1fc00000, "mips_r4k.bios", mips_rom, if (!pflash_cfi01_register(0x1fc00000, "mips_r4k.bios", mips_rom,
blk_by_legacy_dinfo(dinfo), blk_by_legacy_dinfo(dinfo),
sector_len, mips_rom / sector_len, sector_len, 4, 0, 0, 0, 0, be)) {
4, 0, 0, 0, 0, be)) {
fprintf(stderr, "qemu: Error registering flash memory.\n"); fprintf(stderr, "qemu: Error registering flash memory.\n");
} }
} else if (!qtest_enabled()) { } else if (!qtest_enabled()) {
......
...@@ -184,7 +184,7 @@ static void ref405ep_init(MachineState *machine) ...@@ -184,7 +184,7 @@ static void ref405ep_init(MachineState *machine)
pflash_cfi02_register((uint32_t)(-bios_size), pflash_cfi02_register((uint32_t)(-bios_size),
"ef405ep.bios", bios_size, "ef405ep.bios", bios_size,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
64 * KiB, bios_size / (64 * KiB), 1, 64 * KiB, 1,
2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, 2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
1); 1);
} else } else
...@@ -450,7 +450,7 @@ static void taihu_405ep_init(MachineState *machine) ...@@ -450,7 +450,7 @@ static void taihu_405ep_init(MachineState *machine)
pflash_cfi02_register(0xFFE00000, pflash_cfi02_register(0xFFE00000,
"taihu_405ep.bios", bios_size, "taihu_405ep.bios", bios_size,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
64 * KiB, bios_size / (64 * KiB), 1, 64 * KiB, 1,
4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, 4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
1); 1);
fl_idx++; fl_idx++;
...@@ -486,7 +486,7 @@ static void taihu_405ep_init(MachineState *machine) ...@@ -486,7 +486,7 @@ static void taihu_405ep_init(MachineState *machine)
bios_size = 32 * MiB; bios_size = 32 * MiB;
pflash_cfi02_register(0xfc000000, "taihu_405ep.flash", bios_size, pflash_cfi02_register(0xfc000000, "taihu_405ep.flash", bios_size,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
64 * KiB, bios_size / (64 * KiB), 1, 64 * KiB, 1,
4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, 4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
1); 1);
fl_idx++; fl_idx++;
......
...@@ -115,8 +115,7 @@ static int sam460ex_load_uboot(void) ...@@ -115,8 +115,7 @@ static int sam460ex_load_uboot(void)
if (!pflash_cfi01_register(FLASH_BASE | ((hwaddr)FLASH_BASE_H << 32), if (!pflash_cfi01_register(FLASH_BASE | ((hwaddr)FLASH_BASE_H << 32),
"sam460ex.flash", FLASH_SIZE, "sam460ex.flash", FLASH_SIZE,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
64 * KiB, FLASH_SIZE / (64 * KiB), 64 * KiB, 1, 0x89, 0x18, 0x0000, 0x0, 1)) {
1, 0x89, 0x18, 0x0000, 0x0, 1)) {
error_report("Error registering flash memory"); error_report("Error registering flash memory");
/* XXX: return an error instead? */ /* XXX: return an error instead? */
exit(1); exit(1);
......
...@@ -228,8 +228,7 @@ static void virtex_init(MachineState *machine) ...@@ -228,8 +228,7 @@ static void virtex_init(MachineState *machine)
dinfo = drive_get(IF_PFLASH, 0, 0); dinfo = drive_get(IF_PFLASH, 0, 0);
pflash_cfi01_register(PFLASH_BASEADDR, "virtex.flash", FLASH_SIZE, pflash_cfi01_register(PFLASH_BASEADDR, "virtex.flash", FLASH_SIZE,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
64 * KiB, FLASH_SIZE >> 16, 64 * KiB, 1, 0x89, 0x18, 0x0000, 0x0, 1);
1, 0x89, 0x18, 0x0000, 0x0, 1);
cpu_irq = (qemu_irq *) &env->irq_inputs[PPC40x_INPUT_INT]; cpu_irq = (qemu_irq *) &env->irq_inputs[PPC40x_INPUT_INT];
dev = qdev_create(NULL, "xlnx.xps-intc"); dev = qdev_create(NULL, "xlnx.xps-intc");
......
...@@ -299,8 +299,7 @@ static void r2d_init(MachineState *machine) ...@@ -299,8 +299,7 @@ static void r2d_init(MachineState *machine)
dinfo = drive_get(IF_PFLASH, 0, 0); dinfo = drive_get(IF_PFLASH, 0, 0);
pflash_cfi02_register(0x0, "r2d.flash", FLASH_SIZE, pflash_cfi02_register(0x0, "r2d.flash", FLASH_SIZE,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
64 * KiB, FLASH_SIZE >> 16, 64 * KiB, 1, 2, 0x0001, 0x227e, 0x2220, 0x2200,
1, 2, 0x0001, 0x227e, 0x2220, 0x2200,
0x555, 0x2aa, 0); 0x555, 0x2aa, 0);
/* NIC: rtl8139 on-board, and 2 slots. */ /* NIC: rtl8139 on-board, and 2 slots. */
......
...@@ -17,7 +17,7 @@ PFlashCFI01 *pflash_cfi01_register(hwaddr base, ...@@ -17,7 +17,7 @@ PFlashCFI01 *pflash_cfi01_register(hwaddr base,
const char *name, const char *name,
hwaddr size, hwaddr size,
BlockBackend *blk, BlockBackend *blk,
uint32_t sector_len, int nb_blocs, uint32_t sector_len,
int width, int width,
uint16_t id0, uint16_t id1, uint16_t id0, uint16_t id1,
uint16_t id2, uint16_t id3, uint16_t id2, uint16_t id3,
...@@ -36,7 +36,7 @@ PFlashCFI02 *pflash_cfi02_register(hwaddr base, ...@@ -36,7 +36,7 @@ PFlashCFI02 *pflash_cfi02_register(hwaddr base,
const char *name, const char *name,
hwaddr size, hwaddr size,
BlockBackend *blk, BlockBackend *blk,
uint32_t sector_len, int nb_blocs, uint32_t sector_len,
int nb_mappings, int nb_mappings,
int width, int width,
uint16_t id0, uint16_t id1, uint16_t id0, uint16_t id1,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册