From b3314673f456a9686559ec95cbee2302c3214921 Mon Sep 17 00:00:00 2001
From: Ruslan Bukin
Date: Fri, 3 Apr 2015 11:42:10 -0500
Subject: [PATCH] dev: Extend access width for IDE control registers
Add 32-bit access width for PrimaryTiming register and 16bit for UDMAControl
register as FreeBSD required.
Committed by: Nilay Vaish
---
src/dev/ide_ctrl.cc | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/src/dev/ide_ctrl.cc b/src/dev/ide_ctrl.cc
index 27757529a..d931fab2b 100644
--- a/src/dev/ide_ctrl.cc
+++ b/src/dev/ide_ctrl.cc
@@ -202,6 +202,9 @@ IdeController::readConfig(PacketPtr pkt)
break;
case sizeof(uint16_t):
switch (offset) {
+ case UDMAControl:
+ pkt->set(udmaControl);
+ break;
case PrimaryTiming:
pkt->set(primaryTiming);
break;
@@ -222,10 +225,16 @@ IdeController::readConfig(PacketPtr pkt)
(uint32_t)pkt->get());
break;
case sizeof(uint32_t):
- if (offset == IDEConfig)
+ switch (offset) {
+ case PrimaryTiming:
+ pkt->set(primaryTiming);
+ break;
+ case IDEConfig:
pkt->set(ideConfig);
- else
+ break;
+ default:
panic("No 32bit reads implemented for this device.");
+ }
DPRINTF(IdeCtrl, "PCI read offset: %#x size: 4 data: %#x\n", offset,
(uint32_t)pkt->get());
break;
@@ -268,6 +277,9 @@ IdeController::writeConfig(PacketPtr pkt)
break;
case sizeof(uint16_t):
switch (offset) {
+ case UDMAControl:
+ udmaControl = pkt->get();
+ break;
case PrimaryTiming:
primaryTiming = pkt->get();
break;
@@ -289,10 +301,16 @@ IdeController::writeConfig(PacketPtr pkt)
offset, (uint32_t)pkt->get());
break;
case sizeof(uint32_t):
- if (offset == IDEConfig)
+ switch (offset) {
+ case PrimaryTiming:
+ primaryTiming = pkt->get();
+ break;
+ case IDEConfig:
ideConfig = pkt->get();
- else
+ break;
+ default:
panic("Write of unimplemented PCI config. register: %x\n", offset);
+ }
break;
default:
panic("invalid access size(?) for PCI configspace!\n");
--
2.30.2