diff --git a/kernel/iscsi_tcp.c b/kernel/iscsi_tcp.c diff --git a/kernel/iscsi_tcp.h b/kernel/iscsi_tcp.h diff --git a/kernel/libiscsi.c b/kernel/libiscsi.c diff --git a/kernel/libiscsi.h b/kernel/libiscsi.h diff --git a/kernel/scsi_transport_iscsi.c b/kernel/scsi_transport_iscsi.c diff --git a/kernel/scsi_transport_iscsi.h b/kernel/scsi_transport_iscsi.h diff --git a/usr/discovery.c b/usr/discovery.c diff --git a/usr/idbm.c b/usr/idbm.c diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c diff --git a/utils/fwparam_ibft/fwparam_ibft.c b/utils/fwparam_ibft/fwparam_ibft.c index 02f8ac8..4557016 100644 --- a/utils/fwparam_ibft/fwparam_ibft.c +++ b/utils/fwparam_ibft/fwparam_ibft.c @@ -39,6 +39,8 @@ int debug; int dev_count; char filename[FILENAMESZ]; +char ID_ROMEXT[]={0x55, 0xaa, 0}; /* extended rom magic */ + const char nulls[16]; /* defaults to zero */ int @@ -408,22 +410,38 @@ dump_ibft(void *ibft_loc, struct boot_context *context) char *search_ibft(unsigned char *start, int length) { - unsigned char *cur_ptr; + unsigned char *cur_ptr, *rom_end; struct ibft_table_hdr *ibft_hdr; - unsigned char check_sum; + unsigned char check_sum, rom_size; uint32_t i; cur_ptr = (unsigned char *)start; - for (cur_ptr = (unsigned char *)start; - cur_ptr < (start + length); - cur_ptr++) { - if (memcmp(cur_ptr, iBFTSTR,strlen(iBFTSTR))) + while (cur_ptr < (start + length)) { + if (memcmp(cur_ptr, ID_ROMEXT, strlen(ID_ROMEXT)) != 0) { + /* Skip this block */ + cur_ptr += 512; continue; + } + memcpy(&rom_size, cur_ptr + 2, 1); + /* Don't search past the end of the ROM BIOS block */ + rom_end = cur_ptr + (rom_size * 512) - strlen(iBFTSTR); + while (cur_ptr < rom_end) { + if (!memcmp(cur_ptr, iBFTSTR,strlen(iBFTSTR))) + break; + cur_ptr++; + } + + if (cur_ptr == rom_end) { + cur_ptr += strlen(iBFTSTR); + continue; + } ibft_hdr = (struct ibft_table_hdr *)cur_ptr; /* Make sure it's correct version. */ - if (ibft_hdr->revision != iBFT_REV) + if (ibft_hdr->revision != iBFT_REV) { + cur_ptr = rom_end + strlen(iBFTSTR); continue; + } /* Make sure that length is valid. */ if ((cur_ptr + ibft_hdr->length) <= (start + length)) { diff --git a/utils/fwparam_ibft/fwparam_ibft.h b/utils/fwparam_ibft/fwparam_ibft.h