All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/7] piix_ide_reset: Use pci_set_* functions instead of direct access
@ 2022-07-07  3:11 Lev Kujawski
  2022-07-07  3:11 ` [PATCH v2 2/7] tests/qtest/ide-test.c: Create disk image for use as a secondary Lev Kujawski
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Lev Kujawski @ 2022-07-07  3:11 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, qemu-block, Laurent Vivier, Thomas Huth,
	John Snow, Lev Kujawski

Eliminate the remaining TODOs in hw/ide/piix.c by:
* Using pci_set_{size} functions to write the PIIX PCI configuration
  space instead of manipulating it directly as an array; and
* Documenting the default register values by reference to the
  controlling specification.

Signed-off-by: Lev Kujawski <lkujaw@member.fsf.org>
---
 hw/ide/piix.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index 9a9b28078e..de1f4f0efb 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -21,6 +21,10 @@
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
+ *
+ * References:
+ *  [1] 82371FB (PIIX) AND 82371SB (PIIX3) PCI ISA IDE XCELERATOR,
+ *      290550-002, Intel Corporation, April 1997.
  */
 
 #include "qemu/osdep.h"
@@ -114,14 +118,11 @@ static void piix_ide_reset(DeviceState *dev)
         ide_bus_reset(&d->bus[i]);
     }
 
-    /* TODO: this is the default. do not override. */
-    pci_conf[PCI_COMMAND] = 0x00;
-    /* TODO: this is the default. do not override. */
-    pci_conf[PCI_COMMAND + 1] = 0x00;
-    /* TODO: use pci_set_word */
-    pci_conf[PCI_STATUS] = PCI_STATUS_FAST_BACK;
-    pci_conf[PCI_STATUS + 1] = PCI_STATUS_DEVSEL_MEDIUM >> 8;
-    pci_conf[0x20] = 0x01; /* BMIBA: 20-23h */
+    /* PCI command register default value (0000h) per [1, p.48].  */
+    pci_set_word(pci_conf + PCI_COMMAND, 0x0000);
+    pci_set_word(pci_conf + PCI_STATUS,
+                 PCI_STATUS_DEVSEL_MEDIUM | PCI_STATUS_FAST_BACK);
+    pci_set_byte(pci_conf + 0x20, 0x01);  /* BMIBA: 20-23h */
 }
 
 static int pci_piix_init_ports(PCIIDEState *d)
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-09-30 15:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07  3:11 [PATCH v2 1/7] piix_ide_reset: Use pci_set_* functions instead of direct access Lev Kujawski
2022-07-07  3:11 ` [PATCH v2 2/7] tests/qtest/ide-test.c: Create disk image for use as a secondary Lev Kujawski
2022-07-07  3:11 ` [PATCH v2 3/7] hw/ide/core: Clear LBA and drive bits for EXECUTE DEVICE DIAGNOSTIC Lev Kujawski
2022-07-07  3:11 ` [PATCH v2 4/7] tests/qtest/ide-test: Verify that DIAGNOSTIC clears DEV to zero Lev Kujawski
2022-07-07  3:11 ` [PATCH v2 5/7] qpci_device_enable: Allow for command bits hardwired to 0 Lev Kujawski
2022-07-07  3:11 ` [PATCH v2 6/7] hw/ide/piix: Ignore writes of hardwired PCI command register bits Lev Kujawski
2022-07-07  3:11 ` [PATCH v2 7/7] hw/ide/core.c: Implement ATA INITIALIZE_DEVICE_PARAMETERS command Lev Kujawski
2022-09-30 15:17 ` [PATCH v2 1/7] piix_ide_reset: Use pci_set_* functions instead of direct access Kevin Wolf

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.