提交 c16ada98 编写于 作者: S Stefan Weil 提交者: Anthony Liguori

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: NStefan Weil <sw@weilnetz.de>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 ad0c9332
......@@ -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. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册