aboutsummaryrefslogtreecommitdiff
path: root/hw/eepro100.c
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2011-11-23 22:20:30 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2011-11-28 11:36:34 -0600
commitc16ada980f439c414eac83d184ac9fb66ed60cc0 (patch)
tree872c945324296bbe00c69f15bf556b7995ad5f1e /hw/eepro100.c
parentad0c93328dcb7a0ad68a68d0f66ea1949ebaaa2d (diff)
eepro100: Fix alignment requirement for statistical counters
According to Intel's Open Source Software Developer Manual, the dump counters address must be Dword aligned. The new code enforces this alignment, so s->statsaddr may now be used with stw_le_pci_dma() and stl_le_pci_dma(). Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/eepro100.c')
-rw-r--r--hw/eepro100.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/hw/eepro100.c b/hw/eepro100.c
index 7d59e7136d..29ec5b44f8 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -976,7 +976,15 @@ static void eepro100_cu_command(EEPRO100State * s, uint8_t val)
case CU_STATSADDR:
/* Load dump counters address. */
s->statsaddr = e100_read_reg4(s, SCBPointer);
- TRACE(OTHER, logout("val=0x%02x (status address)\n", val));
+ TRACE(OTHER, logout("val=0x%02x (dump counters address)\n", val));
+ if (s->statsaddr & 3) {
+ /* Memory must be Dword aligned. */
+ logout("unaligned dump counters address\n");
+ /* Handling of misaligned addresses is undefined.
+ * Here we align the address by ignoring the lower bits. */
+ /* TODO: Test unaligned dump counter address on real hardware. */
+ s->statsaddr &= ~3;
+ }
break;
case CU_SHOWSTATS:
/* Dump statistical counters. */