Patchwork eepro100: Update ROM file support

login
register
mail settings
Submitter Stefan Weil
Date Jan. 7, 2010, 4:13 p.m.
Message ID <1262880810-16210-1-git-send-email-weil@mail.berlios.de>
Download mbox | patch
Permalink /patch/42443/
State New
Headers show

Comments

Stefan Weil - Jan. 7, 2010, 4:13 p.m.
Use new way to associate ROM files to devices.

Currently, there is only a ROM file for i82559er
included in QEMU, so the patch does not add
.romfile for the other devices.

When flexible mode is fixed in eepro100, adding
more ROM files will be possible. It should be
possible to create them from pxe-i82559er.bin,
because etherboot uses the same driver for all
eepro100 devices (only PCI ids differ).

Maybe it is even possible to create a single
pxe-i8255x.bin which supports all eepro100 devices
(not supported with current etherboot).

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 hw/eepro100.c |   11 +----------
 1 files changed, 1 insertions(+), 10 deletions(-)
Michael S. Tsirkin - Jan. 11, 2010, 6:37 p.m.
On Thu, Jan 07, 2010 at 05:13:30PM +0100, Stefan Weil wrote:
> Use new way to associate ROM files to devices.
> 
> Currently, there is only a ROM file for i82559er
> included in QEMU, so the patch does not add
> .romfile for the other devices.
> 
> When flexible mode is fixed in eepro100, adding
> more ROM files will be possible. It should be
> possible to create them from pxe-i82559er.bin,
> because etherboot uses the same driver for all
> eepro100 devices (only PCI ids differ).
> 
> Maybe it is even possible to create a single
> pxe-i8255x.bin which supports all eepro100 devices
> (not supported with current etherboot).
> 
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>

Gerd, could you ack this patch please?
Thanks!

> ---
>  hw/eepro100.c |   11 +----------
>  1 files changed, 1 insertions(+), 10 deletions(-)
> 
> diff --git a/hw/eepro100.c b/hw/eepro100.c
> index a21c984..b33dbb8 100644
> --- a/hw/eepro100.c
> +++ b/hw/eepro100.c
> @@ -40,7 +40,6 @@
>  #include <stddef.h>             /* offsetof */
>  #include <stdbool.h>
>  #include "hw.h"
> -#include "loader.h"             /* rom_add_option */
>  #include "pci.h"
>  #include "net.h"
>  #include "eeprom93xx.h"
> @@ -1894,15 +1893,6 @@ static int nic_init(PCIDevice *pci_dev, uint32_t device)
>      s->vmstate->name = s->nic->nc.model;
>      vmstate_register(-1, s->vmstate, s);
>  
> -    if (!pci_dev->qdev.hotplugged) {
> -        static int loaded = 0;
> -        if (!loaded) {
> -            char fname[32];
> -            snprintf(fname, sizeof(fname), "pxe-%s.bin", s->nic->nc.model);
> -            rom_add_option(fname);
> -            loaded = 1;
> -        }
> -    }
>      return 0;
>  }
>  
> @@ -2062,6 +2052,7 @@ static PCIDeviceInfo eepro100_info[] = {
>          .qdev.size = sizeof(EEPRO100State),
>          .init      = pci_i82559er_init,
>          .exit      = pci_nic_uninit,
> +        .romfile   = "pxe-i82559er.bin",
>          .qdev.props = (Property[]) {
>              DEFINE_NIC_PROPERTIES(EEPRO100State, conf),
>              DEFINE_PROP_END_OF_LIST(),
> -- 
> 1.6.5
Gerd Hoffmann - Jan. 13, 2010, 12:14 p.m.
On 01/11/10 19:37, Michael S. Tsirkin wrote:
> On Thu, Jan 07, 2010 at 05:13:30PM +0100, Stefan Weil wrote:
>> Use new way to associate ROM files to devices.

Patch looks good to me.

>> Maybe it is even possible to create a single
>> pxe-i8255x.bin which supports all eepro100 devices
>> (not supported with current etherboot).

Would be nice indeed.  Via .romfile we can easily handle any device -> 
rom filename mapping though, so if this doesn't work out it isn't a big 
issue too.

>>
>> Signed-off-by: Stefan Weil<weil@mail.berlios.de>
 >
> Gerd, could you ack this patch please?

Acked-by: Gerd Hoffmann <kraxel@redhat.com>

cheers,
   Gerd

Patch

diff --git a/hw/eepro100.c b/hw/eepro100.c
index a21c984..b33dbb8 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -40,7 +40,6 @@ 
 #include <stddef.h>             /* offsetof */
 #include <stdbool.h>
 #include "hw.h"
-#include "loader.h"             /* rom_add_option */
 #include "pci.h"
 #include "net.h"
 #include "eeprom93xx.h"
@@ -1894,15 +1893,6 @@  static int nic_init(PCIDevice *pci_dev, uint32_t device)
     s->vmstate->name = s->nic->nc.model;
     vmstate_register(-1, s->vmstate, s);
 
-    if (!pci_dev->qdev.hotplugged) {
-        static int loaded = 0;
-        if (!loaded) {
-            char fname[32];
-            snprintf(fname, sizeof(fname), "pxe-%s.bin", s->nic->nc.model);
-            rom_add_option(fname);
-            loaded = 1;
-        }
-    }
     return 0;
 }
 
@@ -2062,6 +2052,7 @@  static PCIDeviceInfo eepro100_info[] = {
         .qdev.size = sizeof(EEPRO100State),
         .init      = pci_i82559er_init,
         .exit      = pci_nic_uninit,
+        .romfile   = "pxe-i82559er.bin",
         .qdev.props = (Property[]) {
             DEFINE_NIC_PROPERTIES(EEPRO100State, conf),
             DEFINE_PROP_END_OF_LIST(),