qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] versatile_pci: convert to symbolic names
       [not found] <cover.1265665089.git.mst@redhat.com>
@ 2010-02-08 21:41 ` Michael S. Tsirkin
  2010-02-10 19:43   ` Anthony Liguori
  2010-02-08 21:43 ` [Qemu-devel] [PATCH 2/2] versatile_pci: cleanup Michael S. Tsirkin
  1 sibling, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2010-02-08 21:41 UTC (permalink / raw)
  To: qemu-devel

This converts versatile_pci to use symbolic
constants. Verified by comparing binary to
original one.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/versatile_pci.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/hw/versatile_pci.c b/hw/versatile_pci.c
index 153c651..e58b7f4 100644
--- a/hw/versatile_pci.c
+++ b/hw/versatile_pci.c
@@ -147,14 +147,17 @@ static int versatile_pci_host_init(PCIDevice *d)
     pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_XILINX);
     /* Both boards have the same device ID.  Oh well.  */
     pci_config_set_device_id(d->config, PCI_DEVICE_ID_XILINX_XC2VP30);
-    d->config[0x04] = 0x00;
-    d->config[0x05] = 0x00;
-    d->config[0x06] = 0x20;
-    d->config[0x07] = 0x02;
-    d->config[0x08] = 0x00; // revision
-    d->config[0x09] = 0x00; // programming i/f
+    /* TODO: no need to clear command */
+    pci_set_byte(d->config + PCI_COMMAND, 0x00);
+    pci_set_byte(d->config + PCI_COMMAND + 1, 0x00);
+    /* TODO: convert to set_word */
+    pci_set_byte(d->config + PCI_STATUS, PCI_STATUS_66MHZ);
+    pci_set_byte(d->config + PCI_STATUS + 1, PCI_STATUS_DEVSEL_MEDIUM >> 8);
+    /* TODO: no need to clear revision/prog ifc */
+    pci_set_byte(d->config + PCI_REVISION_ID, 0x00);
+    pci_set_byte(d->config + PCI_CLASS_PROG, 0x00);
     pci_config_set_class(d->config, PCI_CLASS_PROCESSOR_CO);
-    d->config[0x0D] = 0x10; // latency_timer
+    pci_set_byte(d->config + PCI_LATENCY_TIMER, 0x10);
     return 0;
 }
 
-- 
1.6.6.144.g5c3af

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

* [Qemu-devel] [PATCH 2/2] versatile_pci: cleanup
       [not found] <cover.1265665089.git.mst@redhat.com>
  2010-02-08 21:41 ` [Qemu-devel] [PATCH 1/2] versatile_pci: convert to symbolic names Michael S. Tsirkin
@ 2010-02-08 21:43 ` Michael S. Tsirkin
  2010-02-10 19:43   ` Anthony Liguori
  1 sibling, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2010-02-08 21:43 UTC (permalink / raw)
  To: qemu-devel

Cleanup versatile_pci: no need to re-set fields
to zero (pci core sets 0 already), use set_word
for status field. Compile-tested only, but seems obvious.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/versatile_pci.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/hw/versatile_pci.c b/hw/versatile_pci.c
index e58b7f4..7f79348 100644
--- a/hw/versatile_pci.c
+++ b/hw/versatile_pci.c
@@ -147,15 +147,8 @@ static int versatile_pci_host_init(PCIDevice *d)
     pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_XILINX);
     /* Both boards have the same device ID.  Oh well.  */
     pci_config_set_device_id(d->config, PCI_DEVICE_ID_XILINX_XC2VP30);
-    /* TODO: no need to clear command */
-    pci_set_byte(d->config + PCI_COMMAND, 0x00);
-    pci_set_byte(d->config + PCI_COMMAND + 1, 0x00);
-    /* TODO: convert to set_word */
-    pci_set_byte(d->config + PCI_STATUS, PCI_STATUS_66MHZ);
-    pci_set_byte(d->config + PCI_STATUS + 1, PCI_STATUS_DEVSEL_MEDIUM >> 8);
-    /* TODO: no need to clear revision/prog ifc */
-    pci_set_byte(d->config + PCI_REVISION_ID, 0x00);
-    pci_set_byte(d->config + PCI_CLASS_PROG, 0x00);
+    pci_set_word(d->config + PCI_STATUS,
+		 PCI_STATUS_66MHZ | PCI_STATUS_DEVSEL_MEDIUM);
     pci_config_set_class(d->config, PCI_CLASS_PROCESSOR_CO);
     pci_set_byte(d->config + PCI_LATENCY_TIMER, 0x10);
     return 0;
-- 
1.6.6.144.g5c3af

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

* Re: [Qemu-devel] [PATCH 1/2] versatile_pci: convert to symbolic names
  2010-02-08 21:41 ` [Qemu-devel] [PATCH 1/2] versatile_pci: convert to symbolic names Michael S. Tsirkin
@ 2010-02-10 19:43   ` Anthony Liguori
  0 siblings, 0 replies; 4+ messages in thread
From: Anthony Liguori @ 2010-02-10 19:43 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On 02/08/2010 03:41 PM, Michael S. Tsirkin wrote:
> This converts versatile_pci to use symbolic
> constants. Verified by comparing binary to
> original one.
>
> Signed-off-by: Michael S. Tsirkin<mst@redhat.com>
>    

Acked-by: Anthony Liguori <aliguori@us.ibm.com>

Regards,

Anthony Liguori

> ---
>   hw/versatile_pci.c |   17 ++++++++++-------
>   1 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/hw/versatile_pci.c b/hw/versatile_pci.c
> index 153c651..e58b7f4 100644
> --- a/hw/versatile_pci.c
> +++ b/hw/versatile_pci.c
> @@ -147,14 +147,17 @@ static int versatile_pci_host_init(PCIDevice *d)
>       pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_XILINX);
>       /* Both boards have the same device ID.  Oh well.  */
>       pci_config_set_device_id(d->config, PCI_DEVICE_ID_XILINX_XC2VP30);
> -    d->config[0x04] = 0x00;
> -    d->config[0x05] = 0x00;
> -    d->config[0x06] = 0x20;
> -    d->config[0x07] = 0x02;
> -    d->config[0x08] = 0x00; // revision
> -    d->config[0x09] = 0x00; // programming i/f
> +    /* TODO: no need to clear command */
> +    pci_set_byte(d->config + PCI_COMMAND, 0x00);
> +    pci_set_byte(d->config + PCI_COMMAND + 1, 0x00);
> +    /* TODO: convert to set_word */
> +    pci_set_byte(d->config + PCI_STATUS, PCI_STATUS_66MHZ);
> +    pci_set_byte(d->config + PCI_STATUS + 1, PCI_STATUS_DEVSEL_MEDIUM>>  8);
> +    /* TODO: no need to clear revision/prog ifc */
> +    pci_set_byte(d->config + PCI_REVISION_ID, 0x00);
> +    pci_set_byte(d->config + PCI_CLASS_PROG, 0x00);
>       pci_config_set_class(d->config, PCI_CLASS_PROCESSOR_CO);
> -    d->config[0x0D] = 0x10; // latency_timer
> +    pci_set_byte(d->config + PCI_LATENCY_TIMER, 0x10);
>       return 0;
>   }
>
>    

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

* Re: [Qemu-devel] [PATCH 2/2] versatile_pci: cleanup
  2010-02-08 21:43 ` [Qemu-devel] [PATCH 2/2] versatile_pci: cleanup Michael S. Tsirkin
@ 2010-02-10 19:43   ` Anthony Liguori
  0 siblings, 0 replies; 4+ messages in thread
From: Anthony Liguori @ 2010-02-10 19:43 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On 02/08/2010 03:43 PM, Michael S. Tsirkin wrote:
> Cleanup versatile_pci: no need to re-set fields
> to zero (pci core sets 0 already), use set_word
> for status field. Compile-tested only, but seems obvious.
>
> Signed-off-by: Michael S. Tsirkin<mst@redhat.com>
>    

Acked-by: Anthony Liguori <aliguori@us.ibm.com>

Regards,

Anthony Liguori
> ---
>   hw/versatile_pci.c |   11 ++---------
>   1 files changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/hw/versatile_pci.c b/hw/versatile_pci.c
> index e58b7f4..7f79348 100644
> --- a/hw/versatile_pci.c
> +++ b/hw/versatile_pci.c
> @@ -147,15 +147,8 @@ static int versatile_pci_host_init(PCIDevice *d)
>       pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_XILINX);
>       /* Both boards have the same device ID.  Oh well.  */
>       pci_config_set_device_id(d->config, PCI_DEVICE_ID_XILINX_XC2VP30);
> -    /* TODO: no need to clear command */
> -    pci_set_byte(d->config + PCI_COMMAND, 0x00);
> -    pci_set_byte(d->config + PCI_COMMAND + 1, 0x00);
> -    /* TODO: convert to set_word */
> -    pci_set_byte(d->config + PCI_STATUS, PCI_STATUS_66MHZ);
> -    pci_set_byte(d->config + PCI_STATUS + 1, PCI_STATUS_DEVSEL_MEDIUM>>  8);
> -    /* TODO: no need to clear revision/prog ifc */
> -    pci_set_byte(d->config + PCI_REVISION_ID, 0x00);
> -    pci_set_byte(d->config + PCI_CLASS_PROG, 0x00);
> +    pci_set_word(d->config + PCI_STATUS,
> +		 PCI_STATUS_66MHZ | PCI_STATUS_DEVSEL_MEDIUM);
>       pci_config_set_class(d->config, PCI_CLASS_PROCESSOR_CO);
>       pci_set_byte(d->config + PCI_LATENCY_TIMER, 0x10);
>       return 0;
>    

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

end of thread, other threads:[~2010-02-10 19:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1265665089.git.mst@redhat.com>
2010-02-08 21:41 ` [Qemu-devel] [PATCH 1/2] versatile_pci: convert to symbolic names Michael S. Tsirkin
2010-02-10 19:43   ` Anthony Liguori
2010-02-08 21:43 ` [Qemu-devel] [PATCH 2/2] versatile_pci: cleanup Michael S. Tsirkin
2010-02-10 19:43   ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).