From 3cc7ae06fd8c2cac6eb5051a5e48ab00d17adc1b Mon Sep 17 00:00:00 2001 From: Navdeep Parhar Date: Thu, 18 Apr 2013 22:54:41 +0000 Subject: [PATCH] cxgbe(4): Refuse to install T5 firmwares on a T4 card (and vice versa). MFC after: 1 week --- sys/dev/cxgbe/common/t4_hw.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c index 50e249063d75..965e1fe86055 100644 --- a/sys/dev/cxgbe/common/t4_hw.c +++ b/sys/dev/cxgbe/common/t4_hw.c @@ -1136,6 +1136,13 @@ int t4_load_fw(struct adapter *adap, const u8 *fw_data, unsigned int size) FLASH_FW_MAX_SIZE); return -EFBIG; } + if ((is_t4(adap) && hdr->chip != FW_HDR_CHIP_T4) || + (is_t5(adap) && hdr->chip != FW_HDR_CHIP_T5)) { + CH_ERR(adap, + "FW image (%d) is not suitable for this adapter (%d)\n", + hdr->chip, chip_id(adap)); + return -EINVAL; + } for (csum = 0, i = 0; i < size / sizeof(csum); i++) csum += ntohl(p[i]);