summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRudolf Marek <r.marek@assembler.cz>2009-12-21 11:30:05 +0100
committerLuc Verhaegen <libv@skynet.be>2009-12-21 11:30:05 +0100
commitd6b4fbb25f6badb82dae3d4dba9fecb877a629f6 (patch)
tree1fb95c462ba8285d31ecffe303140d2c9f190eb3
parentdd9391654abd19512013d918c6312d2c512bcee7 (diff)
Fixes for AMIBIOS8.
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. Tested on Asrock 939A785GMH/128M image.
-rw-r--r--ami.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/ami.c b/ami.c
index 88a00d4..0f92b78 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}
};
@@ -127,6 +135,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 */
@@ -188,11 +201,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 +221,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 +240,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;