From: Max Filippov <jcmvbkbc@gmail.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Max Filippov <jcmvbkbc@gmail.com>
Subject: [Qemu-devel] [PATCH 1/3] pflash_cfi01: add pflash_cfi01_init
Date: Sun, 27 Sep 2015 20:16:52 +0300 [thread overview]
Message-ID: <1443374214-27149-2-git-send-email-jcmvbkbc@gmail.com> (raw)
In-Reply-To: <1443374214-27149-1-git-send-email-jcmvbkbc@gmail.com>
pflash_cfi01_register always registers FLASH to the default
system_memory region, which may not always be the right thing.
Provide pflash_cfi01_init function that only creates FLASH device and
sets its properties, leaving MMIO region registration to its caller.
Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
hw/block/pflash_cfi01.c | 29 +++++++++++++++++++++--------
include/hw/block/flash.h | 7 +++++++
2 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index 2ba6c77..dfa7085 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -909,13 +909,12 @@ static void pflash_cfi01_register_types(void)
type_init(pflash_cfi01_register_types)
-pflash_t *pflash_cfi01_register(hwaddr base,
- DeviceState *qdev, const char *name,
- hwaddr size,
- BlockBackend *blk,
- uint32_t sector_len, int nb_blocs,
- int bank_width, uint16_t id0, uint16_t id1,
- uint16_t id2, uint16_t id3, int be)
+pflash_t *pflash_cfi01_init(DeviceState *qdev, const char *name,
+ hwaddr size,
+ BlockBackend *blk,
+ uint32_t sector_len, int nb_blocs,
+ int bank_width, uint16_t id0, uint16_t id1,
+ uint16_t id2, uint16_t id3, int be)
{
DeviceState *dev = qdev_create(NULL, TYPE_CFI_PFLASH01);
@@ -932,9 +931,23 @@ pflash_t *pflash_cfi01_register(hwaddr base,
qdev_prop_set_uint16(dev, "id3", id3);
qdev_prop_set_string(dev, "name", name);
qdev_init_nofail(dev);
+ return CFI_PFLASH01(dev);
+}
+
+pflash_t *pflash_cfi01_register(hwaddr base,
+ DeviceState *qdev, const char *name,
+ hwaddr size,
+ BlockBackend *blk,
+ uint32_t sector_len, int nb_blocs,
+ int bank_width, uint16_t id0, uint16_t id1,
+ uint16_t id2, uint16_t id3, int be)
+{
+ pflash_t *dev = pflash_cfi01_init(qdev, name, size, blk,
+ sector_len, nb_blocs, bank_width,
+ id0, id1, id2, id3, be);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
- return CFI_PFLASH01(dev);
+ return dev;
}
MemoryRegion *pflash_cfi01_get_memory(pflash_t *fl)
diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h
index 50ccbbc..a57d6e9 100644
--- a/include/hw/block/flash.h
+++ b/include/hw/block/flash.h
@@ -16,6 +16,13 @@ pflash_t *pflash_cfi01_register(hwaddr base,
uint16_t id0, uint16_t id1,
uint16_t id2, uint16_t id3, int be);
+pflash_t *pflash_cfi01_init(DeviceState *qdev, const char *name,
+ hwaddr size,
+ BlockBackend *blk,
+ uint32_t sector_len, int nb_blocs, int width,
+ uint16_t id0, uint16_t id1,
+ uint16_t id2, uint16_t id3, int be);
+
/* pflash_cfi02.c */
pflash_t *pflash_cfi02_register(hwaddr base,
DeviceState *qdev, const char *name,
--
1.8.1.4
next prev parent reply other threads:[~2015-09-27 17:17 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-27 17:16 [Qemu-devel] [PATCH 0/3] target-xtensa: xtfpga: support cores without MMU Max Filippov
2015-09-27 17:16 ` Max Filippov [this message]
2015-09-27 17:25 ` [Qemu-devel] [PATCH 1/3] pflash_cfi01: add pflash_cfi01_init Peter Crosthwaite
2015-09-27 17:51 ` Max Filippov
2015-09-27 18:32 ` Peter Crosthwaite
2015-09-27 18:43 ` Max Filippov
2015-09-27 17:16 ` [Qemu-devel] [PATCH 2/3] target-xtensa: xtfpga: attach FLASH to system IO Max Filippov
2015-09-27 17:42 ` Peter Crosthwaite
2015-09-27 18:01 ` Max Filippov
2015-09-27 18:36 ` Peter Crosthwaite
2015-09-27 17:16 ` [Qemu-devel] [PATCH 3/3] target-xtensa: xtfpga: support noMMU cores Max Filippov
2015-09-27 17:38 ` Peter Crosthwaite
2015-09-27 18:13 ` Max Filippov
2015-09-27 18:43 ` Peter Crosthwaite
2015-09-27 19:01 ` Max Filippov
2015-09-27 21:28 ` Peter Crosthwaite
2015-09-27 21:48 ` Max Filippov
2015-09-27 21:59 ` Peter Crosthwaite
2015-09-29 10:34 ` Max Filippov
2015-09-29 19:20 ` Peter Crosthwaite
2015-09-30 17:41 ` Max Filippov
2015-09-29 20:42 ` Peter Maydell
2015-09-30 20:17 ` Max Filippov
2015-09-30 20:45 ` Peter Maydell
2015-09-30 20:54 ` Max Filippov
2015-09-30 21:02 ` Peter Crosthwaite
2015-09-30 22:07 ` Max Filippov
2015-09-30 22:23 ` Peter Crosthwaite
2015-09-30 22:33 ` Peter Crosthwaite
2015-09-30 22:42 ` Max Filippov
2015-10-01 18:06 ` Peter Crosthwaite
2015-10-01 18:25 ` Max Filippov
2015-10-01 19:18 ` Peter Crosthwaite
2015-10-01 20:13 ` Max Filippov
2015-10-01 21:19 ` Peter Crosthwaite
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1443374214-27149-2-git-send-email-jcmvbkbc@gmail.com \
--to=jcmvbkbc@gmail.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.