pc_sysfw.c (940d5b132fab085bd8ec2bcfa5c1dd119785b217) pc_sysfw.c (ce14710f4fdfca32123d7efd3ddcbee984ef0ae5)
1/*
2 * QEMU PC System Firmware
3 *
4 * Copyright (c) 2003-2004 Fabrice Bellard
5 * Copyright (c) 2011-2012 Intel Corporation
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal

--- 96 unchanged lines hidden (view full) ---

105static void pc_system_flash_init(MemoryRegion *rom_memory)
106{
107 int unit;
108 DriveInfo *pflash_drv;
109 BlockBackend *blk;
110 int64_t size;
111 char *fatal_errmsg = NULL;
112 hwaddr phys_addr = 0x100000000ULL;
1/*
2 * QEMU PC System Firmware
3 *
4 * Copyright (c) 2003-2004 Fabrice Bellard
5 * Copyright (c) 2011-2012 Intel Corporation
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal

--- 96 unchanged lines hidden (view full) ---

105static void pc_system_flash_init(MemoryRegion *rom_memory)
106{
107 int unit;
108 DriveInfo *pflash_drv;
109 BlockBackend *blk;
110 int64_t size;
111 char *fatal_errmsg = NULL;
112 hwaddr phys_addr = 0x100000000ULL;
113 int sector_bits, sector_size;
113 uint32_t sector_size = 4096;
114 PFlashCFI01 *system_flash;
115 MemoryRegion *flash_mem;
116 char name[64];
117 void *flash_ptr;
118 int ret, flash_size;
119
114 PFlashCFI01 *system_flash;
115 MemoryRegion *flash_mem;
116 char name[64];
117 void *flash_ptr;
118 int ret, flash_size;
119
120 sector_bits = 12;
121 sector_size = 1 << sector_bits;
122
123 for (unit = 0;
124 (unit < FLASH_MAP_UNIT_MAX &&
125 (pflash_drv = drive_get(IF_PFLASH, 0, unit)) != NULL);
126 ++unit) {
127 blk = blk_by_legacy_dinfo(pflash_drv);
128 size = blk_getlength(blk);
129 if (size < 0) {
130 fatal_errmsg = g_strdup_printf("failed to get backing file size");

--- 26 unchanged lines hidden (view full) ---

157 }
158
159 phys_addr -= size;
160
161 /* pflash_cfi01_register() creates a deep copy of the name */
162 snprintf(name, sizeof name, "system.flash%d", unit);
163 system_flash = pflash_cfi01_register(phys_addr, name,
164 size, blk, sector_size,
120 for (unit = 0;
121 (unit < FLASH_MAP_UNIT_MAX &&
122 (pflash_drv = drive_get(IF_PFLASH, 0, unit)) != NULL);
123 ++unit) {
124 blk = blk_by_legacy_dinfo(pflash_drv);
125 size = blk_getlength(blk);
126 if (size < 0) {
127 fatal_errmsg = g_strdup_printf("failed to get backing file size");

--- 26 unchanged lines hidden (view full) ---

154 }
155
156 phys_addr -= size;
157
158 /* pflash_cfi01_register() creates a deep copy of the name */
159 snprintf(name, sizeof name, "system.flash%d", unit);
160 system_flash = pflash_cfi01_register(phys_addr, name,
161 size, blk, sector_size,
165 size >> sector_bits,
166 1 /* width */,
167 0x0000 /* id0 */,
168 0x0000 /* id1 */,
169 0x0000 /* id2 */,
170 0x0000 /* id3 */,
171 0 /* be */);
172 if (unit == 0) {
173 flash_mem = pflash_cfi01_get_memory(system_flash);

--- 90 unchanged lines hidden ---
162 1 /* width */,
163 0x0000 /* id0 */,
164 0x0000 /* id1 */,
165 0x0000 /* id2 */,
166 0x0000 /* id3 */,
167 0 /* be */);
168 if (unit == 0) {
169 flash_mem = pflash_cfi01_get_memory(system_flash);

--- 90 unchanged lines hidden ---