-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I think I can CC the coreboot list too. I wanted to extract the Asrock "AMI" ROM
found in the 939A785GMH/128M.

I had to add following changes to the ami.c

1) there is a flag for uncompressed module 0x90 instead of 0x80 dunno why
2) if the module size in rom > 0xffff some bytes before the structure are used
as size, the second number looks like crc maybe.
3) the type of 0x40 and 0x60 is AMD CIM-X but it has compress set, but those
modules are not.

Signed-off-by: Rudolf Marek <[email protected]>

Maybe you will need bit to re-arrange patch...

Rudolf
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkssJ3gACgkQ3J9wPJqZRNV4OACgnIfGVUivdz2K8HpQhPjCT86r
bagAniFQwJ7QKafPiFHc2vQC2SFyODOT
=87BW
-----END PGP SIGNATURE-----
diff --git a/ami.c b/ami.c
index 88a00d4..50d412a 100644
--- a/ami.c
+++ b/ami.c
@@ -90,7 +90,15 @@ AMI95ModuleNames[] = {
     {0x38, "Lang1 as ROM"},
     {0x39, "Lang2 as ROM"},
     {0x3A, "Lang3 as ROM"},
+    {0x40, "AMD CIM-X NB binary"},
+    {0x60, "AMD CIM-X SB binary"},
     {0x70, "OSD Bitmaps"},
+    {0xf0, "Asrock Backup Util"},
+    {0xf9, "Asrock AMD AHCI DLL"},
+    {0xfa, "Asrock LOGO GIF"},
+    {0xfb, "Asrock LOGO JPG"},
+    {0xfc, "Asrock LOGO JPG"},
+    {0xfd, "Asrock LOGO PCX - Instant boot"},
     {0, NULL}
 };
 
@@ -118,6 +126,7 @@ AMI95Extract(unsigned char *BIOSImage, int BIOSLength, int BIOSOffset,
     char Date[9];
     int i;
 
+
     struct abc {
 	const char AMIBIOSC[8];
 	const char Version[4];
@@ -127,6 +136,11 @@ AMI95Extract(unsigned char *BIOSImage, int BIOSLength, int BIOSOffset,
 	const uint16_t BeginHi;
     } *abc;
 
+struct bigpart {
+	const uint32_t CSize;
+	const uint32_t Unknown;
+} *bigpart;
+
     struct part {
 	/* When Previous Part Address is 0xFFFFFFFF, then this is the last part. */
 	const uint16_t PrePartLo; /* Previous part low word */
@@ -139,6 +153,9 @@ AMI95Extract(unsigned char *BIOSImage, int BIOSLength, int BIOSOffset,
 	const uint32_t ExpSize; /* Expanded Length */
     } *part;
 
+
+printf("%x %x \n", AMIBOffset, ABCOffset);
+
     if (!ABCOffset) {
 	if ((BIOSImage[8] == '1') && (BIOSImage[9] == '0') &&
 	    (BIOSImage[11] == '1') && (BIOSImage[12] == '0'))
@@ -188,11 +205,15 @@ AMI95Extract(unsigned char *BIOSImage, int BIOSLength, int BIOSOffset,
 
 	part = (struct part *) (BIOSImage + (Offset - BIOSOffset));
 
-	if (part->IsComprs == 0x80)
+	if ((part->IsComprs == 0x80) || (part->IsComprs == 0x90))
 	    Compressed = FALSE;
 	else
 	    Compressed = TRUE;
 
+	/* even they claim they are compressed they arent */
+	if ((part->PartID == 0x40) || (part->PartID == 0x60))
+		Compressed = FALSE;
+
 	if (part->PartID == 0x20)
 	    sprintf(filename, "amipci_%02X_%02X.rom", Multiple++, part->PartID);
 	else
@@ -204,6 +225,7 @@ AMI95Extract(unsigned char *BIOSImage, int BIOSLength, int BIOSOffset,
 	    printf("0x%05X (%6d bytes)", Offset - BIOSOffset + 0x0C, le16toh(part->CSize));
 
 	printf(" -> %s", filename);
+
 	if (part->PartID != 0x20)
 	    printf("  ");
 	if (Compressed)
@@ -222,6 +244,11 @@ AMI95Extract(unsigned char *BIOSImage, int BIOSLength, int BIOSOffset,
 	else
 	    BufferSize = le16toh(part->CSize);
 
+	if ((BufferSize == 0xFFFF) && (!Compressed))  {
+		bigpart = (struct bigpart *) (BIOSImage + (Offset - BIOSOffset) - sizeof(struct bigpart));
+		BufferSize = bigpart->CSize;
+	}
+
 	Buffer = MMapOutputFile(filename, BufferSize);
 	if (!Buffer)
 	    return FALSE;

Attachment: ami_8.patch.sig
Description: Binary data

-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to