[SeaBIOS] [PATCH V2 3/9] Add a PCI header to the VGA ROM if needed

Julian Pidancet julian.pidancet at gmail.com
Mon Dec 19 06:07:55 CET 2011


Allows the ROM to be extracted from a PCI device.

V2: * Declare the PCI header in C
    * Replace #ifdef CONFIG_VGA_PCI with #if CONFIG_VGA_PCI == 1

Signed-off-by: Julian Pidancet <julian.pidancet at gmail.com>
---
 vgasrc/vga.c      |   17 +++++++++++++++++
 vgasrc/vgaentry.S |   11 ++++++++++-
 2 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/vgasrc/vga.c b/vgasrc/vga.c
index b515d1d..748ddd4 100644
--- a/vgasrc/vga.c
+++ b/vgasrc/vga.c
@@ -15,6 +15,8 @@
 #include "biosvar.h" // GET_BDA
 #include "util.h" // memset
 #include "vgatables.h" // find_vga_entry
+#include "optionroms.h" // struct pci_data
+#include "config.h" // CONFIG_*
 
 // XXX
 #define CONFIG_VGA_BOCHS 0
@@ -26,6 +28,21 @@
 
 #define SET_VGA(var, val) SET_FARVAR(get_global_seg(), (var), (val))
 
+/****************************************************************
+ * PCI Data
+ ****************************************************************/
+#if CONFIG_VGA_PCI == 1
+struct pci_data rom_pci_data VAR16VISIBLE = {
+    .signature = PCI_ROM_SIGNATURE,
+    .vendor = CONFIG_VGA_VID,
+    .device = CONFIG_VGA_DID,
+    .dlen = 0x18,
+    .class_hi = 0x300,
+    .irevision = 1,
+    .type = PCIROM_CODETYPE_X86,
+    .indicator = 0x80,
+};
+#endif
 
 /****************************************************************
  * Helper functions
diff --git a/vgasrc/vgaentry.S b/vgasrc/vgaentry.S
index fbfa9f7..2dc07c1 100644
--- a/vgasrc/vgaentry.S
+++ b/vgasrc/vgaentry.S
@@ -12,6 +12,7 @@
         .code16gcc
 #include "vgaccode.16.s"
 
+#include "config.h" // CONFIG_*
 #include "entryfuncs.S" // ENTRY_*
 
 
@@ -30,7 +31,15 @@ _rom_header_entry:
 _rom_header_checksum:
         .byte 0
 _rom_header_other:
-        .space 21
+        .space 17
+_rom_header_pcidata:
+#if CONFIG_VGA_PCI == 1
+        .word rom_pci_data
+#else
+        .word 0
+#endif
+_rom_header_pnpdata:
+        .word 0
 
 
 /****************************************************************
-- 
Julian Pidancet




More information about the SeaBIOS mailing list