Patchwork [2/3] g3beige: add a video card only when requested

login
register
mail settings
Submitter Aurelien Jarno
Date Sept. 7, 2012, 3:27 p.m.
Message ID <1347031634-12526-2-git-send-email-aurelien@aurel32.net>
Download mbox | patch
Permalink /patch/182410/
State New
Headers show

Comments

Aurelien Jarno - Sept. 7, 2012, 3:27 p.m.
The g3beige machine always add a video card, even when the "-vga none"
is passed. Fix that by checking if it is enabled or not before
instanciating it.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 hw/ppc_oldworld.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Alexander Graf - Sept. 7, 2012, 6:58 p.m.
On 07.09.2012, at 17:27, Aurelien Jarno <aurelien@aurel32.net> wrote:

> The g3beige machine always add a video card, even when the "-vga none"
> is passed. Fix that by checking if it is enabled or not before
> instanciating it.
> 
> Cc: Alexander Graf <agraf@suse.de>
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> ---
> hw/ppc_oldworld.c |    4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
> index 1dcd8a6..363b0e5 100644
> --- a/hw/ppc_oldworld.c
> +++ b/hw/ppc_oldworld.c
> @@ -250,7 +250,9 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
>     pci_bus = pci_grackle_init(0xfec00000, pic,
>                                get_system_memory(),
>                                get_system_io());
> -    pci_vga_init(pci_bus);
> +    if (std_vga_enabled) {
> +        pci_vga_init(pci_bus);

Shouldn't we try to have some generic function that can create any PCI VGA adapter for us? We might want to throw a cirrus or qxl one in a g3beige.

Alex

> +    }
> 
>     escc_mem = escc_init(0, pic[0x0f], pic[0x10], serial_hds[0],
>                                serial_hds[1], ESCC_CLOCK, 4);
> -- 
> 1.7.10.4
>
Aurelien Jarno - Sept. 7, 2012, 8:45 p.m.
On Fri, Sep 07, 2012 at 08:58:06PM +0200, Alexander Graf wrote:
> 
> 
> On 07.09.2012, at 17:27, Aurelien Jarno <aurelien@aurel32.net> wrote:
> 
> > The g3beige machine always add a video card, even when the "-vga none"
> > is passed. Fix that by checking if it is enabled or not before
> > instanciating it.
> > 
> > Cc: Alexander Graf <agraf@suse.de>
> > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> > ---
> > hw/ppc_oldworld.c |    4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
> > index 1dcd8a6..363b0e5 100644
> > --- a/hw/ppc_oldworld.c
> > +++ b/hw/ppc_oldworld.c
> > @@ -250,7 +250,9 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
> >     pci_bus = pci_grackle_init(0xfec00000, pic,
> >                                get_system_memory(),
> >                                get_system_io());
> > -    pci_vga_init(pci_bus);
> > +    if (std_vga_enabled) {
> > +        pci_vga_init(pci_bus);
> 
> Shouldn't we try to have some generic function that can create any PCI VGA adapter for us? We might want to throw a cirrus or qxl one in a g3beige.
> 

Other hardware supporting different videocard are using this kind of
code (a bit more complicated for PC as it allow the card to be on the
ISA or on the PCI bus):

|    /* Optional PCI video card */
|    if (cirrus_vga_enabled) {
|        pci_cirrus_vga_init(pci_bus);
|    } else if (vmsvga_enabled) {
|        pci_vmsvga_init(pci_bus);
|    } else if (std_vga_enabled) {
|        pci_vga_init(pci_bus);
|    }
Alexander Graf - Sept. 7, 2012, 8:50 p.m.
On 07.09.2012, at 22:45, Aurelien Jarno wrote:

> On Fri, Sep 07, 2012 at 08:58:06PM +0200, Alexander Graf wrote:
>> 
>> 
>> On 07.09.2012, at 17:27, Aurelien Jarno <aurelien@aurel32.net> wrote:
>> 
>>> The g3beige machine always add a video card, even when the "-vga none"
>>> is passed. Fix that by checking if it is enabled or not before
>>> instanciating it.
>>> 
>>> Cc: Alexander Graf <agraf@suse.de>
>>> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
>>> ---
>>> hw/ppc_oldworld.c |    4 +++-
>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>> 
>>> diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
>>> index 1dcd8a6..363b0e5 100644
>>> --- a/hw/ppc_oldworld.c
>>> +++ b/hw/ppc_oldworld.c
>>> @@ -250,7 +250,9 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
>>>   pci_bus = pci_grackle_init(0xfec00000, pic,
>>>                              get_system_memory(),
>>>                              get_system_io());
>>> -    pci_vga_init(pci_bus);
>>> +    if (std_vga_enabled) {
>>> +        pci_vga_init(pci_bus);
>> 
>> Shouldn't we try to have some generic function that can create any PCI VGA adapter for us? We might want to throw a cirrus or qxl one in a g3beige.
>> 
> 
> Other hardware supporting different videocard are using this kind of
> code (a bit more complicated for PC as it allow the card to be on the
> ISA or on the PCI bus):
> 
> |    /* Optional PCI video card */
> |    if (cirrus_vga_enabled) {
> |        pci_cirrus_vga_init(pci_bus);
> |    } else if (vmsvga_enabled) {
> |        pci_vmsvga_init(pci_bus);
> |    } else if (std_vga_enabled) {
> |        pci_vga_init(pci_bus);
> |    }

Yup. Can we move that to some generic pci file so that we don't have to copy it all over the place?


Alex
Alexander Graf - Sept. 7, 2012, 8:55 p.m.
On 07.09.2012, at 22:45, Aurelien Jarno wrote:

> On Fri, Sep 07, 2012 at 08:58:06PM +0200, Alexander Graf wrote:
>> 
>> 
>> On 07.09.2012, at 17:27, Aurelien Jarno <aurelien@aurel32.net> wrote:
>> 
>>> The g3beige machine always add a video card, even when the "-vga none"
>>> is passed. Fix that by checking if it is enabled or not before
>>> instanciating it.
>>> 
>>> Cc: Alexander Graf <agraf@suse.de>
>>> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
>>> ---
>>> hw/ppc_oldworld.c |    4 +++-
>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>> 
>>> diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
>>> index 1dcd8a6..363b0e5 100644
>>> --- a/hw/ppc_oldworld.c
>>> +++ b/hw/ppc_oldworld.c
>>> @@ -250,7 +250,9 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
>>>   pci_bus = pci_grackle_init(0xfec00000, pic,
>>>                              get_system_memory(),
>>>                              get_system_io());
>>> -    pci_vga_init(pci_bus);
>>> +    if (std_vga_enabled) {
>>> +        pci_vga_init(pci_bus);
>> 
>> Shouldn't we try to have some generic function that can create any PCI VGA adapter for us? We might want to throw a cirrus or qxl one in a g3beige.
>> 
> 
> Other hardware supporting different videocard are using this kind of
> code (a bit more complicated for PC as it allow the card to be on the
> ISA or on the PCI bus):
> 
> |    /* Optional PCI video card */
> |    if (cirrus_vga_enabled) {
> |        pci_cirrus_vga_init(pci_bus);
> |    } else if (vmsvga_enabled) {
> |        pci_vmsvga_init(pci_bus);
> |    } else if (std_vga_enabled) {
> |        pci_vga_init(pci_bus);
> |    }

Yup. Can we move that to some generic pci file so that we don't have to copy it all over the place?


Alex

Patch

diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
index 1dcd8a6..363b0e5 100644
--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -250,7 +250,9 @@  static void ppc_heathrow_init (ram_addr_t ram_size,
     pci_bus = pci_grackle_init(0xfec00000, pic,
                                get_system_memory(),
                                get_system_io());
-    pci_vga_init(pci_bus);
+    if (std_vga_enabled) {
+        pci_vga_init(pci_bus);
+    }
 
     escc_mem = escc_init(0, pic[0x0f], pic[0x10], serial_hds[0],
                                serial_hds[1], ESCC_CLOCK, 4);