Add a PCI header to the VGA ROM if needed
authorJulian Pidancet <julian.pidancet@gmail.com>
Mon, 19 Dec 2011 05:07:55 +0000 (05:07 +0000)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 21 Dec 2011 04:13:06 +0000 (23:13 -0500)
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@gmail.com>
vgasrc/vga.c
vgasrc/vgaentry.S

index b515d1d589a78f604797dd708f571f276fddfd55..748ddd49bfe0fd643a2459b42cf1fa7eeaad1ac4 100644 (file)
@@ -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
 
 #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
index fbfa9f7b16baa40d254559019016586da680e4e3..2dc07c1d811fa9297fb9f1e50cd5e378476d827b 100644 (file)
@@ -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
 
 
 /****************************************************************