diff options
-rw-r--r-- | src/parisc/make-sti-rom.c | 28 | ||||
-rw-r--r-- | src/parisc/stirom.c | 3 |
2 files changed, 29 insertions, 2 deletions
diff --git a/src/parisc/make-sti-rom.c b/src/parisc/make-sti-rom.c index 07f6a3e..3dc7efe 100644 --- a/src/parisc/make-sti-rom.c +++ b/src/parisc/make-sti-rom.c @@ -62,6 +62,32 @@ char *sti_rom_start; #define host_to_le32(x) __builtin_bswap32(x) #endif +static void update_crc_rom(struct sti_rom *rom) +{ + u8 *c, *romend = (u8 *)rom + host_to_be32(rom->last_addr) - 2; + u16 code = 0, poly = 0x8408, accum = 0; + int i, j; + + for (c = (u8 *)rom, j = 0; c <= romend; c++, j++) { + accum = (accum << 8) | (*c & 0xff); + if (j & 1) { + accum ^= code; + for (i = 0; i < 16; i++) { + /* do a left rotate */ + if (accum & 0x8000) { + accum = (accum << 1) | 0x0001; + accum ^= poly; + } else { + accum <<= 1; + } + } + code = accum; + } + } + *(u16 *)(romend+1) = host_to_be16(code); +} + + int main(int argc, char *argv[]) { int fh; @@ -212,7 +238,7 @@ int main(int argc, char *argv[]) sti_proc_rom->set_cm_entry = host_to_be32(STI_OFFSET(sti_set_cm_entry)); sti_proc_rom->dma_ctrl = host_to_be32(STI_OFFSET(sti_dma_ctrl)); sti_proc_rom->end = host_to_be32(STI_OFFSET(sti_end)); -// update_crc(&sti_proc_rom); + update_crc_rom(sti_proc_rom); /* finally write ROM image */ diff --git a/src/parisc/stirom.c b/src/parisc/stirom.c index bd642b7..efdfa2c 100644 --- a/src/parisc/stirom.c +++ b/src/parisc/stirom.c @@ -3279,7 +3279,8 @@ struct sti_rom __stiheader sti_proc_rom = { .type = { 0x03, 0x03, 0x03, 0x03 }, .num_mons = ARRAY_SIZE(sti_mon_table), .revno = { 0x84, 0x07 }, - .graphics_id = { 0x2b4ded6d, 0x40a00499 }, + .graphics_id = { 0x2b4ded6d, 0x40a00499 }, // 32-bit B160L + // .graphics_id = { 0x2d08c0a7, 0x9a02587 }, // C3700 PCI_GRAFFITIX1280 (but crashes currently!) }; static void __stitext write_artist(struct sti_glob_cfg *cfg, |