summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Ruppert <info@vruppert.de>2008-01-27 09:44:12 +0000
committerVolker Ruppert <info@vruppert.de>2008-01-27 09:44:12 +0000
commit458e003b4f887166a0d66ae48c78cce1243ddac7 (patch)
tree7686b4e85d6dbfbb4f0926e69e2aaf7ff962bbda
parent738264ad7ea4f28c796b25398192af0b5d4142e9 (diff)
- added PCI data structure for the Cirrus VGABIOS images
- added support for the PCI data structure in biossums - updated year in copyright
-rw-r--r--Makefile4
-rw-r--r--biossums.c42
-rw-r--r--vgabios.c43
3 files changed, 78 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 394d592..00e8c66 100644
--- a/Makefile
+++ b/Makefile
@@ -58,7 +58,7 @@ vgabios.debug.bin: vgabios.c vgabios.h vgafonts.h vgatables.h vbe.h vbe.c vbetab
ls -l VGABIOS-lgpl-latest.debug.bin
vgabios-cirrus.bin: vgabios.c vgabios.h vgafonts.h vgatables.h clext.c
- $(GCC) -E -P vgabios.c $(VGABIOS_VERS) -DCIRRUS $(VGABIOS_DATE) > _vgabios-cirrus_.c
+ $(GCC) -E -P vgabios.c $(VGABIOS_VERS) -DCIRRUS -DPCIBIOS $(VGABIOS_DATE) > _vgabios-cirrus_.c
$(BCC) -o vgabios-cirrus.s -C-c -D__i86__ -S -0 _vgabios-cirrus_.c
sed -e 's/^\.text//' -e 's/^\.data//' vgabios-cirrus.s > _vgabios-cirrus_.s
$(AS86) _vgabios-cirrus_.s -b vgabios-cirrus.bin -u -w- -g -0 -j -O -l vgabios.cirrus.txt
@@ -68,7 +68,7 @@ vgabios-cirrus.bin: vgabios.c vgabios.h vgafonts.h vgatables.h clext.c
ls -l VGABIOS-lgpl-latest.cirrus.bin
vgabios-cirrus.debug.bin: vgabios.c vgabios.h vgafonts.h vgatables.h clext.c
- $(GCC) -E -P vgabios.c $(VGABIOS_VERS) -DCIRRUS -DCIRRUS_DEBUG $(VGABIOS_DATE) > _vgabios-cirrus-debug_.c
+ $(GCC) -E -P vgabios.c $(VGABIOS_VERS) -DCIRRUS -DCIRRUS_DEBUG -DPCIBIOS $(VGABIOS_DATE) > _vgabios-cirrus-debug_.c
$(BCC) -o vgabios-cirrus-debug.s -C-c -D__i86__ -S -0 _vgabios-cirrus-debug_.c
sed -e 's/^\.text//' -e 's/^\.data//' vgabios-cirrus-debug.s > _vgabios-cirrus-debug_.s
$(AS86) _vgabios-cirrus-debug_.s -b vgabios.cirrus.debug.bin -u -w- -g -0 -j -O -l vgabios.cirrus.debug.txt
diff --git a/biossums.c b/biossums.c
index 5014efc..392d55c 100644
--- a/biossums.c
+++ b/biossums.c
@@ -29,7 +29,6 @@ byte chksum_bios_calc_value( byte* data, long offset );
byte chksum_bios_get_value( byte* data, long offset );
void chksum_bios_set_value( byte* data, long offset, byte value );
-
#define PMID_LEN 20
#define PMID_CHKSUM 19
@@ -38,6 +37,10 @@ byte chksum_pmid_calc_value( byte* data, long offset );
byte chksum_pmid_get_value( byte* data, long offset );
void chksum_pmid_set_value( byte* data, long offset, byte value );
+#define PCIR_LEN 24
+
+long chksum_pcir_get_offset( byte* data, long offset );
+
byte bios_data[MAX_BIOS_DATA];
long bios_len;
@@ -46,7 +49,7 @@ long bios_len;
int main(int argc, char* argv[])
{
FILE* stream;
- long offset, tmp_offset;
+ long offset, tmp_offset, pcir_offset;
byte bios_len_byte, cur_val = 0, new_val = 0;
int hits, modified;
@@ -111,6 +114,20 @@ int main(int argc, char* argv[])
printf("\n");
}
+ offset = 0L;
+ pcir_offset = chksum_pcir_get_offset( bios_data, offset );
+ if (pcir_offset != -1L) {
+ if (bios_data[pcir_offset + 16] != bios_data[2]) {
+ bios_data[pcir_offset + 16] = bios_data[2];
+ if (modified == 0) {
+ bios_len += 0x200;
+ bios_data[2]++;
+ bios_data[pcir_offset + 16]++;
+ }
+ modified = 1;
+ }
+ }
+
offset = 0L;
do {
offset = chksum_bios_get_offset(bios_data, offset);
@@ -119,6 +136,9 @@ int main(int argc, char* argv[])
if ((cur_val != new_val) && (modified == 0)) {
bios_len += 0x200;
bios_data[2]++;
+ if (pcir_offset != -1L) {
+ bios_data[pcir_offset + 16]++;
+ }
modified = 1;
} else {
printf("\nBios checksum at: 0x%4lX\n", offset);
@@ -241,3 +261,21 @@ void chksum_pmid_set_value( byte* data, long offset, byte value ) {
check((offset + PMID_CHKSUM) <= (bios_len - 1), "PMID checksum out of bounds" );
*( data + offset + PMID_CHKSUM ) = value;
}
+
+
+long chksum_pcir_get_offset( byte* data, long offset ) {
+
+ long result = -1L;
+
+ while ((offset + PCIR_LEN) < (bios_len - 1)) {
+ offset = offset + 1;
+ if( *( data + offset + 0 ) == 'P' && \
+ *( data + offset + 1 ) == 'C' && \
+ *( data + offset + 2 ) == 'I' && \
+ *( data + offset + 3 ) == 'R' ) {
+ result = offset;
+ break;
+ }
+ }
+ return( result );
+}
diff --git a/vgabios.c b/vgabios.c
index a1fb756..e6fe2a0 100644
--- a/vgabios.c
+++ b/vgabios.c
@@ -4,7 +4,7 @@
*/
// ============================================================================================
//
-// Copyright (C) 2001,2002 the LGPL VGABios developers Team
+// Copyright (C) 2001-2008 the LGPL VGABios developers Team
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -149,16 +149,24 @@ vgabios_entry_point:
jmp vgabios_init_func
-vgabios_name:
-.ascii "Plex86/Bochs VGABios"
-.ascii " "
-.byte 0x00
+#ifdef PCIBIOS
+.org 0x18
+.word vgabios_pci_data
+#endif
// Info from Bart Oldeman
.org 0x1e
.ascii "IBM"
.byte 0x00
+vgabios_name:
+.ascii "Plex86/Bochs VGABios"
+#ifdef PCIBIOS
+.ascii " (PCI)"
+#endif
+.ascii " "
+.byte 0x00
+
vgabios_version:
#ifndef VGABIOS_VERS
.ascii "current-cvs"
@@ -173,7 +181,7 @@ vgabios_date:
.byte 0x00
vgabios_copyright:
-.ascii "(C) 2003 the LGPL VGABios developers Team"
+.ascii "(C) 2008 the LGPL VGABios developers Team"
.byte 0x0a,0x0d
.byte 0x00
@@ -194,7 +202,28 @@ vgabios_website:
.byte 0x0a,0x0d
.byte 0x0a,0x0d
.byte 0x00
-
+
+#ifdef PCIBIOS
+vgabios_pci_data:
+.ascii "PCIR"
+#ifdef CIRRUS
+.word 0x1013
+.word 0x00b8 // CLGD5446
+#else
+#error "Unknown PCI vendor and device id"
+#endif
+.word 0 // reserved
+.word 0x18 // dlen
+.byte 0 // revision
+.byte 0x0 // class,hi: vga display
+.word 0x300 // class,lo: vga display
+.word 0x40 // bios size
+.word 1 // revision
+.byte 0 // intel x86 data
+.byte 0x80 // last image
+.word 0 // reserved
+#endif
+
;; ============================================================================================
;;