Patchwork [2/5] Add defines for PCI IDs.

login
register
mail settings
Submitter Gerd Hoffmann
Date May 7, 2010, 10:09 a.m.
Message ID <1273226987-10066-2-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/51909/
State New
Headers show

Comments

Gerd Hoffmann - May 7, 2010, 10:09 a.m.
This patch allows to set PCI vendor and device IDs using defines
(PCI_VID and PCI_DID).  Use it for vgabios.bin.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 Makefile  |    4 ++--
 vbe.c     |    6 +++++-
 vgabios.c |    5 +++++
 3 files changed, 12 insertions(+), 3 deletions(-)
Blue Swirl - May 7, 2010, 3:32 p.m.
On 5/7/10, Gerd Hoffmann <kraxel@redhat.com> wrote:
> This patch allows to set PCI vendor and device IDs using defines
>  (PCI_VID and PCI_DID).  Use it for vgabios.bin.
>
>  Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>  ---
>   Makefile  |    4 ++--
>   vbe.c     |    6 +++++-
>   vgabios.c |    5 +++++
>   3 files changed, 12 insertions(+), 3 deletions(-)
>
>  diff --git a/Makefile b/Makefile
>  index c3c744c..d440b93 100644
>  --- a/Makefile
>  +++ b/Makefile
>  @@ -31,8 +31,8 @@ VGA_FILES := vgabios.c vgabios.h vgafonts.h vgatables.h
>   VBE_FILES := vbe.h vbe.c vbetables.h
>
>   # build flags
>  -vgabios.bin              : VGAFLAGS := -DVBE
>  -vgabios.debug.bin        : VGAFLAGS := -DVBE -DDEBUG
>  +vgabios.bin              : VGAFLAGS := -DVBE -DPCI_VID=0x1234
>  +vgabios.debug.bin        : VGAFLAGS := -DVBE -DPCI_VID=0x1234 -DDEBUG

-DPCI_DID missing...

>   vgabios-cirrus.bin       : VGAFLAGS := -DCIRRUS -DPCIBIOS
>   vgabios-cirrus.debug.bin : VGAFLAGS := -DCIRRUS -DPCIBIOS -DCIRRUS_DEBUG
>
>  diff --git a/vbe.c b/vbe.c
>  index f925c35..f9a77f0 100644
>  --- a/vbe.c
>  +++ b/vbe.c
>  @@ -925,7 +925,11 @@ Bit16u *AX;Bit16u CX; Bit16u ES;Bit16u DI;
>                  if (using_lfb) {
>                    info.NumberOfBanks = 1;
>                  }
>  -                lfb_addr = pci_get_lfb_addr(0x1234); // experimental vendor
>  +#ifdef PCI_VID
>  +                lfb_addr = pci_get_lfb_addr(PCI_VID);
>  +#else
>  +                lfb_addr = 0;
>  +#endif
>                  if (lfb_addr > 0) {
>                    info.PhysBasePtr = ((Bit32u)lfb_addr << 16);
>                  }
>  diff --git a/vgabios.c b/vgabios.c
>  index 3b09c92..a575b7b 100644
>  --- a/vgabios.c
>  +++ b/vgabios.c
>  @@ -210,8 +210,13 @@ vgabios_pci_data:
>   .word 0x1013
>   .word 0x00b8 // CLGD5446
>   #else
>  +#ifdef PCI_VID
>  +.word PCI_VID
>  +.word PCI_DID

... so this generates:
 .word 0x1234
 .word PCI_DID

I read only this patch, so sorry for the noise if I missed something.

>  +#else
>   #error "Unknown PCI vendor and device id"
>   #endif
>  +#endif
>   .word 0 // reserved
>   .word 0x18 // dlen
>   .byte 0 // revision
>
> --
>  1.6.6.1
>
>
>
>
Gerd Hoffmann - May 10, 2010, 7:51 a.m.
On 05/07/10 17:32, Blue Swirl wrote:
> On 5/7/10, Gerd Hoffmann<kraxel@redhat.com>  wrote:
>> This patch allows to set PCI vendor and device IDs using defines
>>   (PCI_VID and PCI_DID).  Use it for vgabios.bin.
>>
>>   Signed-off-by: Gerd Hoffmann<kraxel@redhat.com>
>>   ---
>>    Makefile  |    4 ++--
>>    vbe.c     |    6 +++++-
>>    vgabios.c |    5 +++++
>>    3 files changed, 12 insertions(+), 3 deletions(-)
>>
>>   diff --git a/Makefile b/Makefile
>>   index c3c744c..d440b93 100644
>>   --- a/Makefile
>>   +++ b/Makefile
>>   @@ -31,8 +31,8 @@ VGA_FILES := vgabios.c vgabios.h vgafonts.h vgatables.h
>>    VBE_FILES := vbe.h vbe.c vbetables.h
>>
>>    # build flags
>>   -vgabios.bin              : VGAFLAGS := -DVBE
>>   -vgabios.debug.bin        : VGAFLAGS := -DVBE -DDEBUG
>>   +vgabios.bin              : VGAFLAGS := -DVBE -DPCI_VID=0x1234
>>   +vgabios.debug.bin        : VGAFLAGS := -DVBE -DPCI_VID=0x1234 -DDEBUG
>
> -DPCI_DID missing...

Not needed here.

>>   @@ -210,8 +210,13 @@ vgabios_pci_data:
>>    .word 0x1013
>>    .word 0x00b8 // CLGD5446
>>    #else
>>   +#ifdef PCI_VID
>>   +.word PCI_VID
>>   +.word PCI_DID
>
> ... so this generates:
>   .word 0x1234
>   .word PCI_DID

The whole construct is wrapped into a #ifdef PCIBIOS (not visible in the 
patch as it would have needed more context).

cheers,
   Gerd

Patch

diff --git a/Makefile b/Makefile
index c3c744c..d440b93 100644
--- a/Makefile
+++ b/Makefile
@@ -31,8 +31,8 @@  VGA_FILES := vgabios.c vgabios.h vgafonts.h vgatables.h
 VBE_FILES := vbe.h vbe.c vbetables.h
 
 # build flags
-vgabios.bin              : VGAFLAGS := -DVBE
-vgabios.debug.bin        : VGAFLAGS := -DVBE -DDEBUG
+vgabios.bin              : VGAFLAGS := -DVBE -DPCI_VID=0x1234
+vgabios.debug.bin        : VGAFLAGS := -DVBE -DPCI_VID=0x1234 -DDEBUG
 vgabios-cirrus.bin       : VGAFLAGS := -DCIRRUS -DPCIBIOS 
 vgabios-cirrus.debug.bin : VGAFLAGS := -DCIRRUS -DPCIBIOS -DCIRRUS_DEBUG
 
diff --git a/vbe.c b/vbe.c
index f925c35..f9a77f0 100644
--- a/vbe.c
+++ b/vbe.c
@@ -925,7 +925,11 @@  Bit16u *AX;Bit16u CX; Bit16u ES;Bit16u DI;
                 if (using_lfb) {
                   info.NumberOfBanks = 1;
                 }
-                lfb_addr = pci_get_lfb_addr(0x1234); // experimental vendor
+#ifdef PCI_VID
+                lfb_addr = pci_get_lfb_addr(PCI_VID);
+#else
+                lfb_addr = 0;
+#endif
                 if (lfb_addr > 0) {
                   info.PhysBasePtr = ((Bit32u)lfb_addr << 16);
                 }
diff --git a/vgabios.c b/vgabios.c
index 3b09c92..a575b7b 100644
--- a/vgabios.c
+++ b/vgabios.c
@@ -210,8 +210,13 @@  vgabios_pci_data:
 .word 0x1013
 .word 0x00b8 // CLGD5446
 #else
+#ifdef PCI_VID
+.word PCI_VID
+.word PCI_DID
+#else
 #error "Unknown PCI vendor and device id"
 #endif
+#endif
 .word 0 // reserved
 .word 0x18 // dlen
 .byte 0 // revision