tuxsavvy / agere_fw_utils (public) (License: Dual BSD 3-clause and GPLv2) (since 2021-02-07) (hash sha1)
Personal fork of https://repo.or.cz/agere_fw_utils.git
List of commits:
Subject Hash Author Date (UTC)
Fix x86_64 compatibility and all warnings 894e331c5a1ea15b79de1fa23dcf95fda59311e4 Pavel Roskin 2009-01-19 02:47:38
Add license to dump_fw d468abd859c69bb422647db4c8150b08769bea34 David Kilroy 2008-10-27 22:17:08
Read AP fw ident better from hfwget d64e1b5b51dc1210ed25530ae2f85eadd3f18f95 David Kilroy 2008-10-27 20:55:03
Allow dump_fw to build against wl_lkm_722 for h2 and h25 fw. bc458b38b8a200f47f3119e406920334334512a8 David Kilroy 2008-10-26 21:35:13
Write compatibility info from dump_fw. Update README 8295b468312cd3475c06645e92ef4884c2a3dbcc David Kilroy 2008-10-26 14:46:55
Further refactorring. Also pass through splint and indent. 29e550703e7ef9b083b22d11c3bb470ff54b6ab0 David Kilroy 2008-10-26 14:44:25
Convert primary plugdata properly 933f77d11ca6645df705c4b71c471aa670fccaf3 David Kilroy 2008-10-26 14:39:28
Convert AirPort firmware version 1f31f74c58179b099005ae939eff9bb467317b5b David Kilroy 2008-10-26 14:37:57
Mach-O parsing from Dan Williams 525f9168679392920da51d2487cc5fdba3c68e2c David Kilroy 2008-10-26 14:34:59
Check if we are in wl_lkm tree and build appropriately 4af298b374a1dea172b57acbd080773912d22087 David Kilroy 2008-10-26 14:30:33
Use C99 types 11362c209f9ec7369931b9a25a407c21476c48e4 David Kilroy 2008-10-26 14:30:03
hfwget refactorring posted as hfwget2 April 2008 9b77acdf3330592acda5261d282c579cc1497637 David Kilroy 2008-10-26 14:27:32
dump_fw and hfwget posted Sep 2007 77d205076542510222c6e8359bb2647b0d4e0873 David Kilroy 2008-10-26 14:22:02
Add hfwget.c from hermesap-0.2 9239c21487b524cf0f87b4ffa4828793713fbecd David Kilroy 2008-10-26 14:20:38
dump_fw posted June 2007 617a0ae960430d0d93a533ac5dffc7b9c07a777a David Kilroy 2008-10-26 14:19:45
Commit 894e331c5a1ea15b79de1fa23dcf95fda59311e4 - Fix x86_64 compatibility and all warnings
Don't cast "data" to u32. Don't apply any masks to "data", as the later
is returned by malloc() and doesn't have to be aligned.

Use "t" modifier for ptrditt_t and "z" modifier for size_t.

Comment out write_hermesap_fw(), as it's never called.
Author: Pavel Roskin
Author date (UTC): 2009-01-19 02:47
Committer name: David Kilroy
Committer date (UTC): 2009-01-20 23:47
Parent(s): d468abd859c69bb422647db4c8150b08769bea34
Signing key:
Tree: 3e43e4435f60b62b4d2d85420a4da6eef95a3eb5
File Lines added Lines deleted
hfwget.c 17 15
File hfwget.c changed (mode: 100644) (index b00e747..184aeb0)
... ... static char* find_fw_filename(const u8 *hostdriver, size_t flen, char hexchar)
374 374
375 375 if (p != NULL) if (p != NULL)
376 376 { {
377 printf("Found firmware %s at file offset 0x%08x\n",
377 printf("Found firmware %s at file offset 0x%08tx\n",
378 378 p, (p - hostdriver)); p, (p - hostdriver));
379 379 } }
380 380 else else
 
... ... static u8* find_fw(const u8 *hostdriver, size_t flen,
396 396 bool found = false; bool found = false;
397 397 size_t i; size_t i;
398 398
399 printf("Searching for firmware from offset 0x%08x, start signature",
399 printf("Searching for firmware from offset 0x%08tx, start signature",
400 400 hint - hostdriver); hint - hostdriver);
401 401 for (i = 0; i < slen; i++) for (i = 0; i < slen; i++)
402 402 { {
 
... ... static u8* find_fw(const u8 *hostdriver, size_t flen,
416 416 } }
417 417
418 418 p++; p++;
419 printf("Found signature at file offset 0x%08x\n", p - hostdriver);
419 printf("Found signature at file offset 0x%08tx\n", p - hostdriver);
420 420
421 421 return (u8*) p; return (u8*) p;
422 422 } }
 
... ... static int macho_validate(const void *data)
581 581 static u8* find_fwblock_entry(const u8 *data, const struct fw_layout *layout, static u8* find_fwblock_entry(const u8 *data, const struct fw_layout *layout,
582 582 u32 addr) u32 addr)
583 583 { {
584 u32 *p = (u32*) ((unsigned int)(data + layout->max_offset) & 0xFFFFFFFCu);
584 u32 *p = (u32*) (data + (layout->max_offset & 0xFFFFFFFCu));
585 585 bool found = false; bool found = false;
586 586
587 587 printf("Now searching for driver's firmware block entry (0x%08x)...\n", printf("Now searching for driver's firmware block entry (0x%08x)...\n",
 
... ... static struct fwtable_drv* find_fwtable_entry(const u8 *data,
613 613 const struct fw_layout *layout, const struct fw_layout *layout,
614 614 u32 fwblock) u32 fwblock)
615 615 { {
616 u32 *p = (u32*) ((unsigned int)(data + layout->max_offset) & 0xFFFFFFFCu);
616 u32 *p = (u32*) (data + (layout->max_offset & 0xFFFFFFFCu));
617 617 struct fwtable_drv *firmware; struct fwtable_drv *firmware;
618 618 bool found = false; bool found = false;
619 619
 
... ... static struct fwtable_drv* find_fwtable_entry(const u8 *data,
638 638 } }
639 639 else else
640 640 { {
641 printf("Found at file offset 0x%08x\n", (u8*)p - data);
641 printf("Found at file offset 0x%08tx\n", (u8*)p - data);
642 642 } }
643 643 return firmware; return firmware;
644 644 } }
 
... ... static void copy_fw_data(struct fwtable *firmware,
667 667 static struct plugarray pri_plug_data[64] = {{ 0, 0, 0 }}; static struct plugarray pri_plug_data[64] = {{ 0, 0, 0 }};
668 668 static struct ident_info ident_data = { 0, 0, 0, 0, 0, 0 }; static struct ident_info ident_data = { 0, 0, 0, 0, 0, 0 };
669 669 static struct compat_info compat_data[16] = {{ 0 }}; static struct compat_info compat_data[16] = {{ 0 }};
670 u32 delta = (u32)data - layout->addr_delta;
670 size_t delta = (size_t)data - layout->addr_delta;
671 671 size_t i; size_t i;
672 672
673 673 /* Calculate valid pointers to driver data */ /* Calculate valid pointers to driver data */
 
... ... static void copy_fw_data(struct fwtable *firmware,
709 709 firmware->segarray[i].offset = offset; firmware->segarray[i].offset = offset;
710 710 firmware->segarray[i].size = size; firmware->segarray[i].size = size;
711 711 firmware->segarray[i].flags = flags; firmware->segarray[i].flags = flags;
712 printf("Segment: %d File offs: 0x%08x Target mem: 0x%08x "
712 printf("Segment: %zd File offs: 0x%08tx Target mem: 0x%08x "
713 713 "Length 0x%04x%s\n", "Length 0x%04x%s\n",
714 714 i, i,
715 715 (void *)(&block.w[i]) - data, (void *)(&block.w[i]) - data,
 
... ... static void copy_fw_data(struct fwtable *firmware,
727 727 } }
728 728 } }
729 729
730 printf("Production Data plugrecords at file offset 0x%08x\n",
730 printf("Production Data plugrecords at file offset 0x%08tx\n",
731 731 (void *)pdr - data); (void *)pdr - data);
732 printf("Primary plugrecords at file offset 0x%08x\n",
732 printf("Primary plugrecords at file offset 0x%08tx\n",
733 733 (void *)pri - data); (void *)pri - data);
734 printf("Compatibility info at file offset 0x%08x\n",
734 printf("Compatibility info at file offset 0x%08tx\n",
735 735 (void *)compat - data); (void *)compat - data);
736 printf("Identity info at file offset 0x%08x\n",
736 printf("Identity info at file offset 0x%08tx\n",
737 737 (void *)ident - data); (void *)ident - data);
738 738
739 739 /* Copy plugarray */ /* Copy plugarray */
 
... ... static void print_fw_ident(const struct fwtable *firmware)
805 805 } }
806 806 } }
807 807
808 #if 0
808 809 static int write_hermesap_fw(FILE *output, const struct fwtable *firmware) static int write_hermesap_fw(FILE *output, const struct fwtable *firmware)
809 810 { {
810 811 unsigned int i; unsigned int i;
 
... ... static int write_hermesap_fw(FILE *output, const struct fwtable *firmware)
845 846
846 847 return 0; return 0;
847 848 } }
849 #endif
848 850
849 851 static size_t count_blocks(const struct fwblock *first_block) static size_t count_blocks(const struct fwblock *first_block)
850 852 { {
 
... ... static int dump_fw(const char *basename, char hexchar,
1053 1055 else else
1054 1056 { {
1055 1057 printf("Found firmware block entry at virtual location 0x%08x, " printf("Found firmware block entry at virtual location 0x%08x, "
1056 "file offset 0x%08x\n", vaddr, fwblock - data);
1058 "file offset 0x%08tx\n", vaddr, fwblock - data);
1057 1059 } }
1058 1060
1059 1061 /* Got to the first fwblock. Static offset per arch */ /* Got to the first fwblock. Static offset per arch */
 
... ... int main(int argc, char *argv[])
1208 1210 /* Get file length */ /* Get file length */
1209 1211 fseek(input, 0L, SEEK_END); fseek(input, 0L, SEEK_END);
1210 1212 flen = ftell(input); flen = ftell(input);
1211 printf("File %s length %u (0x%08x)\n", argv[1], flen, flen);
1213 printf("File %s length %zu (0x%08zx)\n", argv[1], flen, flen);
1212 1214
1213 1215 /* Rewind file pointer */ /* Rewind file pointer */
1214 1216 fseek(input, 0L, SEEK_SET); fseek(input, 0L, SEEK_SET);
 
... ... int main(int argc, char *argv[])
1235 1237 } }
1236 1238 else else
1237 1239 { {
1238 printf("Only read %d out of %d bytes\n", read_bytes, flen);
1240 printf("Only read %zd out of %zd bytes\n", read_bytes, flen);
1239 1241 } }
1240 1242
1241 1243 free(data); free(data);
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/tuxsavvy/agere_fw_utils

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/tuxsavvy/agere_fw_utils

Clone this repository using git:
git clone git://git.rocketgit.com/user/tuxsavvy/agere_fw_utils

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main