[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [PATCH for-2.9 12/30] aspeed/smc: improve segment register su
From: |
Cédric Le Goater |
Subject: |
[Qemu-arm] [PATCH for-2.9 12/30] aspeed/smc: improve segment register support |
Date: |
Tue, 29 Nov 2016 16:43:50 +0100 |
The HW does not enforce all the rules in the specs and allows a few
"curious" setups like zero size segments and overlaps. So change the
model to be in sync but keep the warnings which are always interesting
for debug.
Signed-off-by: Cédric Le Goater <address@hidden>
Reviewed-by: Joel Stanley <address@hidden>
---
hw/ssi/aspeed_smc.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
index 6e8403ebc246..78f5aed53247 100644
--- a/hw/ssi/aspeed_smc.c
+++ b/hw/ssi/aspeed_smc.c
@@ -253,7 +253,8 @@ static void aspeed_smc_flash_set_segment(AspeedSMCState *s,
int cs,
qemu_log_mask(LOG_GUEST_ERROR,
"%s: Tried to change CS0 start address to 0x%"
HWADDR_PRIx "\n", s->ctrl->name, seg.addr);
- return;
+ seg.addr = s->ctrl->flash_window_base;
+ new = aspeed_smc_segment_to_reg(&seg);
}
/*
@@ -267,8 +268,10 @@ static void aspeed_smc_flash_set_segment(AspeedSMCState
*s, int cs,
s->ctrl->segments[cs].size) {
qemu_log_mask(LOG_GUEST_ERROR,
"%s: Tried to change CS%d end address to 0x%"
- HWADDR_PRIx "\n", s->ctrl->name, cs, seg.addr);
- return;
+ HWADDR_PRIx "\n", s->ctrl->name, cs, seg.addr +
seg.size);
+ seg.size = s->ctrl->segments[cs].addr + s->ctrl->segments[cs].size -
+ seg.addr;
+ new = aspeed_smc_segment_to_reg(&seg);
}
/* Keep the segment in the overall flash window */
@@ -281,16 +284,14 @@ static void aspeed_smc_flash_set_segment(AspeedSMCState
*s, int cs,
}
/* Check start address vs. alignment */
- if (seg.addr % seg.size) {
+ if (seg.size && !QEMU_IS_ALIGNED(seg.addr, seg.size)) {
qemu_log_mask(LOG_GUEST_ERROR, "%s: new segment for CS%d is not "
"aligned : [ 0x%"HWADDR_PRIx" - 0x%"HWADDR_PRIx" ]\n",
s->ctrl->name, cs, seg.addr, seg.addr + seg.size);
}
- /* And segments should not overlap */
- if (aspeed_smc_flash_overlap(s, &seg, cs)) {
- return;
- }
+ /* And segments should not overlap (in the specs) */
+ aspeed_smc_flash_overlap(s, &seg, cs);
/* All should be fine now to move the region */
memory_region_transaction_begin();
--
2.7.4
- [Qemu-arm] [PATCH for-2.9 02/30] m25p80: add support for the mx66l1g45g, (continued)
- [Qemu-arm] [PATCH for-2.9 02/30] m25p80: add support for the mx66l1g45g, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 03/30] aspeed: QOMify the CPU object and attach it to the SoC, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 04/30] aspeed: remove cannot_destroy_with_object_finalize_yet, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 05/30] aspeed: attach the second SPI controller object to the SoC, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 06/30] aspeed: extend the board configuration with flash models, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 07/30] aspeed: add support for the romulus-bmc board, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 08/30] aspeed: add a memory region for SRAM, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 09/30] aspeed: add the definitions for the AST2400 A1 SoC, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 10/30] aspeed: change SoC revision of the palmetto-bmc machine, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 11/30] aspeed/scu: fix SCU region size, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 12/30] aspeed/smc: improve segment register support,
Cédric Le Goater <=
- [Qemu-arm] [PATCH for-2.9 13/30] aspeed/smc: set the number of flash modules for the FMC controller, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 14/30] aspeed/smc: rework the prototype of the AspeedSMCFlash helper routines, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 15/30] aspeed/smc: introduce a aspeed_smc_flash_update_cs() helper, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 16/30] aspeed/smc: autostrap CE0/1 configuration, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 17/30] aspeed/smc: handle SPI flash Command mode, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 18/30] aspeed/smc: extend tests for Command mode, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 19/30] aspeed/smc: unfold the AspeedSMCController array, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 20/30] aspeed/smc: add a 'sdram_base' property, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 21/30] aspeed/smc: add support for DMAs, Cédric Le Goater, 2016/11/29
- [Qemu-arm] [PATCH for-2.9 22/30] aspeed/smc: handle dummy bytes when doing fast reads, Cédric Le Goater, 2016/11/29