From 3e77d4faf00d4821ff5c0d16f18f5abfc222f3e0 Mon Sep 17 00:00:00 2001
Message-Id: <3e77d4faf00d4821ff5c0d16f18f5abfc222f3e0.1350899902.git.minovotn@redhat.com>
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Thu, 18 Oct 2012 15:17:37 +0200
Subject: [PATCH 1/4] e1000: switch to symbolic names for pci registers

RH-Author: Michael S. Tsirkin <mst@redhat.com>
Message-id: <68a931d584653b87df873744b54e9391f55cd8c5.1350572959.git.mst@redhat.com>
Patchwork-id: 43357
O-Subject: [PATCHv2 RHEL6.4 qemu-kvm 1/3] e1000: switch to symbolic names for pci registers
Bugzilla: 866736
RH-Acked-by: Jason Baron <jbaron@redhat.com>
RH-Acked-by: Xiao Wang <jasowang@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>

No functional changes. I verified that the generated
object binary does not change.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Glauber Costa <glommer@gmail.com>
(cherry-picked from commit a9cbacb0d68440d4be7ccfed61f321224026bf5c)
---
 hw/e1000.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 hw/e1000.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/hw/e1000.c b/hw/e1000.c
index a045368..e61bed6 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -1220,12 +1220,15 @@ static int pci_e1000_init(PCIDevice *pci_dev)
 
     pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
     pci_config_set_device_id(pci_conf, E1000_DEVID);
-    *(uint16_t *)(pci_conf+0x06) = cpu_to_le16(0x0010);
-    pci_conf[0x08] = 0x03;
+    /* TODO: we have no capabilities, so why is this bit set? */
+    pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_CAP_LIST);
+    pci_conf[PCI_REVISION_ID] = 0x03;
     pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
-    pci_conf[0x0c] = 0x10;
+    /* TODO: RST# value should be 0, PCI spec 6.2.4 */
+    pci_conf[PCI_CACHE_LINE_SIZE] = 0x10;
 
-    pci_conf[0x3d] = 1; // interrupt pin 0
+    /* TODO: RST# value should be 0 if programmable, PCI spec 6.2.4 */
+    pci_conf[PCI_INTERRUPT_PIN] = 1; // interrupt pin 0
 
     d->mmio_index = cpu_register_io_memory(e1000_mmio_read,
             e1000_mmio_write, d);
-- 
1.7.11.7

