Lines 119-126
static void isp_mboxcmd(ispsoftc_t *, mbreg_t *);
Link Here
|
119 |
|
119 |
|
120 |
static void isp_setdfltfcparm(ispsoftc_t *, int); |
120 |
static void isp_setdfltfcparm(ispsoftc_t *, int); |
121 |
static int isp_read_nvram(ispsoftc_t *, int); |
121 |
static int isp_read_nvram(ispsoftc_t *, int); |
|
|
122 |
static void isp_rd_2xxx_flash(ispsoftc_t *, uint32_t, uint32_t *); |
123 |
static int isp_read_flthdr_2xxx(ispsoftc_t *); |
124 |
static void isp_parse_flthdr_2xxx(ispsoftc_t *, uint8_t *); |
125 |
static int isp_read_flt_2xxx(ispsoftc_t *); |
126 |
static int isp_parse_flt_2xxx(ispsoftc_t *, uint8_t *); |
122 |
static int isp_read_nvram_2400(ispsoftc_t *); |
127 |
static int isp_read_nvram_2400(ispsoftc_t *); |
123 |
static void isp_rd_2400_nvram(ispsoftc_t *, uint32_t, uint32_t *); |
|
|
124 |
static void isp_parse_nvram_2400(ispsoftc_t *, uint8_t *); |
128 |
static void isp_parse_nvram_2400(ispsoftc_t *, uint8_t *); |
125 |
|
129 |
|
126 |
static void |
130 |
static void |
Lines 179-184
isp_reset(ispsoftc_t *isp, int do_load_defaults)
Link Here
|
179 |
case ISP_HA_FC_2700: |
183 |
case ISP_HA_FC_2700: |
180 |
btype = "2700"; |
184 |
btype = "2700"; |
181 |
break; |
185 |
break; |
|
|
186 |
case ISP_HA_FC_2800: |
187 |
btype = "2800"; |
188 |
break; |
182 |
default: |
189 |
default: |
183 |
break; |
190 |
break; |
184 |
} |
191 |
} |
Lines 710-717
isp_init(ispsoftc_t *isp)
Link Here
|
710 |
icbp->icb_version = ICB_VERSION1; |
717 |
icbp->icb_version = ICB_VERSION1; |
711 |
icbp->icb_maxfrmlen = DEFAULT_FRAMESIZE(isp); |
718 |
icbp->icb_maxfrmlen = DEFAULT_FRAMESIZE(isp); |
712 |
if (icbp->icb_maxfrmlen < ICB_MIN_FRMLEN || icbp->icb_maxfrmlen > ICB_MAX_FRMLEN) { |
719 |
if (icbp->icb_maxfrmlen < ICB_MIN_FRMLEN || icbp->icb_maxfrmlen > ICB_MAX_FRMLEN) { |
713 |
isp_prt(isp, ISP_LOGERR, "bad frame length (%d) from NVRAM- using %d", DEFAULT_FRAMESIZE(isp), ICB_DFLT_FRMLEN); |
|
|
714 |
icbp->icb_maxfrmlen = ICB_DFLT_FRMLEN; |
720 |
icbp->icb_maxfrmlen = ICB_DFLT_FRMLEN; |
|
|
721 |
if (IS_28XX(isp)) |
722 |
icbp->icb_maxfrmlen = ICB_DFLT_FRMLEN_28XX; |
723 |
|
724 |
isp_prt(isp, ISP_LOGERR, "bad frame length (%d) from NVRAM - using %d", DEFAULT_FRAMESIZE(isp), icbp->icb_maxfrmlen); |
715 |
} |
725 |
} |
716 |
|
726 |
|
717 |
if (!IS_26XX(isp)) |
727 |
if (!IS_26XX(isp)) |
Lines 822-833
isp_init(ispsoftc_t *isp)
Link Here
|
822 |
} else if (isp->isp_confopts & ISP_CFG_32GB) { |
832 |
} else if (isp->isp_confopts & ISP_CFG_32GB) { |
823 |
icbp->icb_fwoptions3 &= ~ICB2400_OPT3_RATE_MASK; |
833 |
icbp->icb_fwoptions3 &= ~ICB2400_OPT3_RATE_MASK; |
824 |
icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_32GB; |
834 |
icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_32GB; |
|
|
835 |
} else if (isp->isp_confopts & ISP_CFG_64GB) { |
836 |
icbp->icb_fwoptions3 &= ~ICB2400_OPT3_RATE_MASK; |
837 |
icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_64GB; |
825 |
} else { |
838 |
} else { |
826 |
switch (icbp->icb_fwoptions3 & ICB2400_OPT3_RATE_MASK) { |
839 |
switch (icbp->icb_fwoptions3 & ICB2400_OPT3_RATE_MASK) { |
827 |
case ICB2400_OPT3_RATE_4GB: |
840 |
case ICB2400_OPT3_RATE_4GB: |
828 |
case ICB2400_OPT3_RATE_8GB: |
841 |
case ICB2400_OPT3_RATE_8GB: |
829 |
case ICB2400_OPT3_RATE_16GB: |
842 |
case ICB2400_OPT3_RATE_16GB: |
830 |
case ICB2400_OPT3_RATE_32GB: |
843 |
case ICB2400_OPT3_RATE_32GB: |
|
|
844 |
case ICB2400_OPT3_RATE_64GB: |
831 |
case ICB2400_OPT3_RATE_AUTO: |
845 |
case ICB2400_OPT3_RATE_AUTO: |
832 |
break; |
846 |
break; |
833 |
case ICB2400_OPT3_RATE_2GB: |
847 |
case ICB2400_OPT3_RATE_2GB: |
Lines 1537-1542
isp_fclink_test(ispsoftc_t *isp, int chan, int usdelay)
Link Here
|
1537 |
if (mbs.param[0] == MBOX_COMMAND_COMPLETE) { |
1551 |
if (mbs.param[0] == MBOX_COMMAND_COMPLETE) { |
1538 |
if (mbs.param[1] == MBGSD_10GB) |
1552 |
if (mbs.param[1] == MBGSD_10GB) |
1539 |
fcp->isp_gbspeed = 10; |
1553 |
fcp->isp_gbspeed = 10; |
|
|
1554 |
else if (mbs.param[1] == MBGSD_64GB) |
1555 |
fcp->isp_gbspeed = 64; |
1540 |
else if (mbs.param[1] == MBGSD_32GB) |
1556 |
else if (mbs.param[1] == MBGSD_32GB) |
1541 |
fcp->isp_gbspeed = 32; |
1557 |
fcp->isp_gbspeed = 32; |
1542 |
else if (mbs.param[1] == MBGSD_16GB) |
1558 |
else if (mbs.param[1] == MBGSD_16GB) |
Lines 4322-4342
isp_reinit(ispsoftc_t *isp, int do_load_defaults)
Link Here
|
4322 |
static int |
4338 |
static int |
4323 |
isp_read_nvram(ispsoftc_t *isp, int bus) |
4339 |
isp_read_nvram(ispsoftc_t *isp, int bus) |
4324 |
{ |
4340 |
{ |
4325 |
|
4341 |
fcparam *fcp = FCPARAM(isp, 0); |
|
|
4342 |
int r = 0; |
4343 |
|
4344 |
if (isp->isp_type != ISP_HA_FC_2600) { |
4345 |
if (IS_28XX(isp)) { |
4346 |
fcp->flash_data_addr = ISP28XX_BASE_ADDR; |
4347 |
fcp->flt_region_flt = ISP28XX_FLT_ADDR; |
4348 |
} else if (IS_27XX(isp)) { |
4349 |
fcp->flash_data_addr = ISP27XX_BASE_ADDR; |
4350 |
fcp->flt_region_flt = ISP27XX_FLT_ADDR; |
4351 |
} else if (IS_25XX(isp)) { |
4352 |
fcp->flash_data_addr = ISP25XX_BASE_ADDR; |
4353 |
fcp->flt_region_flt = ISP25XX_FLT_ADDR; |
4354 |
} else { |
4355 |
fcp->flash_data_addr = ISP24XX_BASE_ADDR; |
4356 |
fcp->flt_region_flt = ISP24XX_FLT_ADDR; |
4357 |
} |
4358 |
fcp->flt_length = 0; |
4359 |
r = isp_read_flthdr_2xxx(isp); |
4360 |
if (r == 0) { |
4361 |
isp_read_flt_2xxx(isp); |
4362 |
} else { /* fallback to hardcoded NVRAM address */ |
4363 |
if (IS_28XX(isp)) { |
4364 |
fcp->flt_region_nvram = 0x300000; |
4365 |
} else if (IS_27XX(isp)) { |
4366 |
fcp->flash_data_addr = 0x7fe7c000; |
4367 |
fcp->flt_region_nvram = 0; |
4368 |
} else if (IS_25XX(isp)) { |
4369 |
fcp->flt_region_nvram = 0x48000; |
4370 |
} else { |
4371 |
fcp->flash_data_addr = 0x7ffe0000; |
4372 |
fcp->flt_region_nvram = 0; |
4373 |
} |
4374 |
fcp->flt_region_nvram += ISP2400_NVRAM_PORT_ADDR(isp->isp_port); |
4375 |
} |
4376 |
} else { |
4377 |
fcp->flash_data_addr = 0x7fe7c000; |
4378 |
fcp->flt_region_nvram = 0; |
4379 |
fcp->flt_region_nvram += ISP2400_NVRAM_PORT_ADDR(isp->isp_port); |
4380 |
} |
4326 |
return (isp_read_nvram_2400(isp)); |
4381 |
return (isp_read_nvram_2400(isp)); |
4327 |
} |
4382 |
} |
4328 |
|
4383 |
|
|
|
4384 |
static void |
4385 |
isp_rd_2xxx_flash(ispsoftc_t *isp, uint32_t addr, uint32_t *rp) |
4386 |
{ |
4387 |
fcparam *fcp = FCPARAM(isp, 0); |
4388 |
int loops = 0; |
4389 |
uint32_t base = fcp->flash_data_addr; |
4390 |
uint32_t tmp = 0; |
4391 |
|
4392 |
ISP_WRITE(isp, BIU2400_FLASH_ADDR, base + addr); |
4393 |
for (loops = 0; loops < 5000; loops++) { |
4394 |
ISP_DELAY(10); |
4395 |
tmp = ISP_READ(isp, BIU2400_FLASH_ADDR); |
4396 |
if ((tmp & (1U << 31)) != 0) { |
4397 |
break; |
4398 |
} |
4399 |
} |
4400 |
if (tmp & (1U << 31)) { |
4401 |
*rp = ISP_READ(isp, BIU2400_FLASH_DATA); |
4402 |
ISP_SWIZZLE_NVRAM_LONG(isp, rp); |
4403 |
} else { |
4404 |
*rp = 0xffffffff; |
4405 |
} |
4406 |
} |
4407 |
|
4408 |
static int |
4409 |
isp_read_flthdr_2xxx(ispsoftc_t *isp) |
4410 |
{ |
4411 |
fcparam *fcp = FCPARAM(isp, 0); |
4412 |
int retval = 0; |
4413 |
uint32_t addr, lwrds, *dptr; |
4414 |
uint16_t csum; |
4415 |
uint8_t flthdr_data[FLT_HEADER_SIZE]; |
4416 |
|
4417 |
addr = fcp->flt_region_flt; |
4418 |
dptr = (uint32_t *) flthdr_data; |
4419 |
|
4420 |
isp_prt(isp, ISP_LOGDEBUG0, |
4421 |
"FLTL[DEF]: 0x%x", addr); |
4422 |
for (lwrds = 0; lwrds < FLT_HEADER_SIZE >> 2; lwrds++) { |
4423 |
isp_rd_2xxx_flash(isp, addr++, dptr++); |
4424 |
} |
4425 |
dptr = (uint32_t *) flthdr_data; |
4426 |
for (csum = 0, lwrds = 0; lwrds < FLT_HEADER_SIZE >> 4; lwrds++) { |
4427 |
uint16_t tmp; |
4428 |
ISP_IOXGET_16(isp, &dptr[lwrds], tmp); |
4429 |
csum += tmp; |
4430 |
} |
4431 |
if (csum != 0) { |
4432 |
retval = -1; |
4433 |
goto out; |
4434 |
} |
4435 |
isp_parse_flthdr_2xxx(isp, flthdr_data); |
4436 |
out: |
4437 |
return (retval); |
4438 |
} |
4439 |
|
4440 |
static void |
4441 |
isp_parse_flthdr_2xxx(ispsoftc_t *isp, uint8_t *flthdr_data) |
4442 |
{ |
4443 |
fcparam *fcp = FCPARAM(isp, 0); |
4444 |
uint16_t ver, csum; |
4445 |
|
4446 |
ver = le16toh((uint16_t) (ISP2XXX_FLT_VERSION(flthdr_data))); |
4447 |
fcp->flt_length = le16toh((uint16_t) (ISP2XXX_FLT_LENGTH(flthdr_data))); |
4448 |
csum = le16toh((uint16_t) (ISP2XXX_FLT_CSUM(flthdr_data))); |
4449 |
|
4450 |
if ((fcp->flt_length == 0 ) || |
4451 |
(fcp->flt_length > (FLT_HEADER_SIZE + FLT_REGIONS_SIZE))) { |
4452 |
isp_prt(isp, ISP_LOGERR, |
4453 |
"FLT[DEF]: Invalid length=0x%x(%d)", |
4454 |
fcp->flt_length, fcp->flt_length); |
4455 |
} |
4456 |
isp_prt(isp, ISP_LOGDEBUG0, |
4457 |
"FLT[DEF]: version=0x%x length=0x%x(%d) checksum=0x%x", |
4458 |
ver, fcp->flt_length, fcp->flt_length, csum); |
4459 |
} |
4460 |
|
4461 |
static int |
4462 |
isp_read_flt_2xxx(ispsoftc_t *isp) |
4463 |
{ |
4464 |
fcparam *fcp = FCPARAM(isp, 0); |
4465 |
int retval = 0; |
4466 |
int len = fcp->flt_length - FLT_HEADER_SIZE; |
4467 |
uint32_t addr, lwrds, *dptr; |
4468 |
uint8_t flt_data[len]; |
4469 |
fcp->flt_region_entries = len / FLT_REGION_SIZE; |
4470 |
|
4471 |
addr = fcp->flt_region_flt + (FLT_HEADER_SIZE >> 2); |
4472 |
dptr = (uint32_t *) flt_data; |
4473 |
isp_prt(isp, ISP_LOGDEBUG0, "FLT[DEF]: regions=%d", |
4474 |
fcp->flt_region_entries); |
4475 |
for (lwrds = 0; lwrds < len >> 2; lwrds++) { |
4476 |
isp_rd_2xxx_flash(isp, addr++, dptr++); |
4477 |
} |
4478 |
retval = isp_parse_flt_2xxx(isp, flt_data); |
4479 |
return (retval); |
4480 |
} |
4481 |
|
4482 |
static int |
4483 |
isp_parse_flt_2xxx(ispsoftc_t *isp, uint8_t *flt_data) |
4484 |
{ |
4485 |
fcparam *fcp = FCPARAM(isp, 0); |
4486 |
int count; |
4487 |
struct flt_region region[fcp->flt_region_entries]; |
4488 |
|
4489 |
for (count = 0; count < fcp->flt_region_entries; count++) { |
4490 |
region[count].code = |
4491 |
le16toh((uint16_t) (ISP2XXX_FLT_REG_CODE(flt_data, count))); |
4492 |
region[count].attribute = |
4493 |
(uint8_t) (ISP2XXX_FLT_REG_ATTR(flt_data, count)); |
4494 |
region[count].reserved = |
4495 |
(uint8_t) (ISP2XXX_FLT_REG_RES(flt_data, count)); |
4496 |
region[count].size = |
4497 |
le32toh((uint32_t) (ISP2XXX_FLT_REG_SIZE(flt_data, count)) >> 2); |
4498 |
region[count].start = |
4499 |
le32toh((uint32_t) (ISP2XXX_FLT_REG_START(flt_data, count)) >> 2); |
4500 |
region[count].end = |
4501 |
le32toh((uint32_t) (ISP2XXX_FLT_REG_END(flt_data, count)) >> 2); |
4502 |
|
4503 |
isp_prt(isp, ISP_LOGDEBUG0, |
4504 |
"FLT[0x%x]: start=0x%x end=0x%x size=0x%x attribute=0x%x", |
4505 |
region[count].code, region[count].start, region[count].end, |
4506 |
region[count].size, region[count].attribute); |
4507 |
|
4508 |
switch(region[count].code) { |
4509 |
case FLT_REG_FW: |
4510 |
fcp->flt_region_fw = region[count].start; |
4511 |
break; |
4512 |
case FLT_REG_BOOT_CODE: |
4513 |
fcp->flt_region_boot = region[count].start; |
4514 |
break; |
4515 |
case FLT_REG_VPD_0: |
4516 |
fcp->flt_region_vpd_nvram = region[count].start; |
4517 |
if (isp->isp_port == 0) |
4518 |
fcp->flt_region_vpd = region[count].start; |
4519 |
break; |
4520 |
case FLT_REG_VPD_1: |
4521 |
if (isp->isp_port == 1) |
4522 |
fcp->flt_region_vpd = region[count].start; |
4523 |
break; |
4524 |
case FLT_REG_VPD_2: |
4525 |
if (!IS_27XX(isp)) |
4526 |
break; |
4527 |
if (isp->isp_port == 2) |
4528 |
fcp->flt_region_vpd = region[count].start; |
4529 |
break; |
4530 |
case FLT_REG_VPD_3: |
4531 |
if (!IS_27XX(isp)) |
4532 |
break; |
4533 |
if (isp->isp_port == 3) |
4534 |
fcp->flt_region_vpd = region[count].start; |
4535 |
break; |
4536 |
case FLT_REG_NVRAM_0: |
4537 |
if (isp->isp_port == 0) |
4538 |
fcp->flt_region_nvram = region[count].start; |
4539 |
break; |
4540 |
case FLT_REG_NVRAM_1: |
4541 |
if (isp->isp_port == 1) |
4542 |
fcp->flt_region_nvram = region[count].start; |
4543 |
break; |
4544 |
case FLT_REG_NVRAM_2: |
4545 |
if (!IS_27XX(isp)) |
4546 |
break; |
4547 |
if (isp->isp_port == 2) |
4548 |
fcp->flt_region_nvram = region[count].start; |
4549 |
break; |
4550 |
case FLT_REG_NVRAM_3: |
4551 |
if (!IS_27XX(isp)) |
4552 |
break; |
4553 |
if (isp->isp_port == 3) |
4554 |
fcp->flt_region_nvram = region[count].start; |
4555 |
break; |
4556 |
case FLT_REG_FDT: |
4557 |
fcp->flt_region_fdt = region[count].start; |
4558 |
break; |
4559 |
case FLT_REG_FLT: |
4560 |
fcp->flt_region_flt = region[count].start; |
4561 |
break; |
4562 |
case FLT_REG_NPIV_CONF_0: |
4563 |
if (isp->isp_port == 0) |
4564 |
fcp->flt_region_npiv_conf = region[count].start; |
4565 |
break; |
4566 |
case FLT_REG_NPIV_CONF_1: |
4567 |
if (isp->isp_port == 1) |
4568 |
fcp->flt_region_npiv_conf = region[count].start; |
4569 |
break; |
4570 |
case FLT_REG_GOLD_FW: |
4571 |
fcp->flt_region_gold_fw = region[count].start; |
4572 |
break; |
4573 |
case FLT_REG_FCP_PRIO_0: |
4574 |
if (isp->isp_port == 0) |
4575 |
fcp->flt_region_fcp_prio = region[count].start; |
4576 |
break; |
4577 |
case FLT_REG_FCP_PRIO_1: |
4578 |
if (isp->isp_port == 1) |
4579 |
fcp->flt_region_fcp_prio = region[count].start; |
4580 |
break; |
4581 |
case FLT_REG_IMG_PRI_27XX: |
4582 |
if (IS_27XX(isp)) |
4583 |
fcp->flt_region_img_status_pri = region[count].start; |
4584 |
break; |
4585 |
case FLT_REG_IMG_SEC_27XX: |
4586 |
if (IS_27XX(isp)) |
4587 |
fcp->flt_region_img_status_sec = region[count].start; |
4588 |
break; |
4589 |
case FLT_REG_FW_SEC_27XX: |
4590 |
if (IS_27XX(isp)) |
4591 |
fcp->flt_region_fw_sec = region[count].start; |
4592 |
break; |
4593 |
case FLT_REG_BOOTLOAD_SEC_27XX: |
4594 |
if (IS_27XX(isp)) |
4595 |
fcp->flt_region_boot_sec = region[count].start; |
4596 |
break; |
4597 |
case FLT_REG_AUX_IMG_PRI_28XX: |
4598 |
if (IS_27XX(isp)) |
4599 |
fcp->flt_region_aux_img_status_pri = region[count].start; |
4600 |
break; |
4601 |
case FLT_REG_AUX_IMG_SEC_28XX: |
4602 |
if (IS_27XX(isp)) |
4603 |
fcp->flt_region_aux_img_status_sec = region[count].start; |
4604 |
break; |
4605 |
case FLT_REG_NVRAM_SEC_28XX_0: |
4606 |
if (IS_27XX(isp)) |
4607 |
if (isp->isp_port == 0) |
4608 |
fcp->flt_region_nvram_sec = region[count].start; |
4609 |
break; |
4610 |
case FLT_REG_NVRAM_SEC_28XX_1: |
4611 |
if (IS_27XX(isp)) |
4612 |
if (isp->isp_port == 1) |
4613 |
fcp->flt_region_nvram_sec = region[count].start; |
4614 |
break; |
4615 |
case FLT_REG_NVRAM_SEC_28XX_2: |
4616 |
if (IS_27XX(isp)) |
4617 |
if (isp->isp_port == 2) |
4618 |
fcp->flt_region_nvram_sec = region[count].start; |
4619 |
break; |
4620 |
case FLT_REG_NVRAM_SEC_28XX_3: |
4621 |
if (IS_27XX(isp)) |
4622 |
if (isp->isp_port == 3) |
4623 |
fcp->flt_region_nvram_sec = region[count].start; |
4624 |
break; |
4625 |
case FLT_REG_VPD_SEC_27XX_0: |
4626 |
case FLT_REG_VPD_SEC_28XX_0: |
4627 |
if (IS_27XX(isp)) { |
4628 |
fcp->flt_region_vpd_nvram_sec = region[count].start; |
4629 |
if (isp->isp_port == 0) |
4630 |
fcp->flt_region_vpd_sec = region[count].start; |
4631 |
} |
4632 |
break; |
4633 |
case FLT_REG_VPD_SEC_27XX_1: |
4634 |
case FLT_REG_VPD_SEC_28XX_1: |
4635 |
if (IS_27XX(isp)) |
4636 |
if (isp->isp_port == 1) |
4637 |
fcp->flt_region_vpd_sec = region[count].start; |
4638 |
break; |
4639 |
case FLT_REG_VPD_SEC_27XX_2: |
4640 |
case FLT_REG_VPD_SEC_28XX_2: |
4641 |
if (IS_27XX(isp)) |
4642 |
if (isp->isp_port == 2) |
4643 |
fcp->flt_region_vpd_sec = region[count].start; |
4644 |
break; |
4645 |
case FLT_REG_VPD_SEC_27XX_3: |
4646 |
case FLT_REG_VPD_SEC_28XX_3: |
4647 |
if (IS_27XX(isp)) |
4648 |
if (isp->isp_port == 3) |
4649 |
fcp->flt_region_vpd_sec = region[count].start; |
4650 |
break; |
4651 |
} |
4652 |
} |
4653 |
isp_prt(isp, ISP_LOGDEBUG0, |
4654 |
"FLT[FLT]: boot=0x%x fw=0x%x vpd_nvram=0x%x vpd=0x%x nvram 0x%x " |
4655 |
"fdt=0x%x flt=0x%x npiv=0x%x fcp_prif_cfg=0x%x", |
4656 |
fcp->flt_region_boot, fcp->flt_region_fw, fcp->flt_region_vpd_nvram, |
4657 |
fcp->flt_region_vpd, fcp->flt_region_nvram, fcp->flt_region_fdt, |
4658 |
fcp->flt_region_flt, fcp->flt_region_npiv_conf, |
4659 |
fcp->flt_region_fcp_prio); |
4660 |
|
4661 |
return (0); |
4662 |
} |
4663 |
|
4329 |
static int |
4664 |
static int |
4330 |
isp_read_nvram_2400(ispsoftc_t *isp) |
4665 |
isp_read_nvram_2400(ispsoftc_t *isp) |
4331 |
{ |
4666 |
{ |
|
|
4667 |
fcparam *fcp = FCPARAM(isp, 0); |
4332 |
int retval = 0; |
4668 |
int retval = 0; |
4333 |
uint32_t addr, csum, lwrds, *dptr; |
4669 |
uint32_t addr, csum, lwrds, *dptr; |
4334 |
uint8_t nvram_data[ISP2400_NVRAM_SIZE]; |
4670 |
uint8_t nvram_data[ISP2400_NVRAM_SIZE]; |
4335 |
|
4671 |
|
4336 |
addr = ISP2400_NVRAM_PORT_ADDR(isp->isp_port); |
4672 |
addr = fcp->flt_region_nvram; |
4337 |
dptr = (uint32_t *) nvram_data; |
4673 |
dptr = (uint32_t *) nvram_data; |
4338 |
for (lwrds = 0; lwrds < ISP2400_NVRAM_SIZE >> 2; lwrds++) { |
4674 |
for (lwrds = 0; lwrds < ISP2400_NVRAM_SIZE >> 2; lwrds++) { |
4339 |
isp_rd_2400_nvram(isp, addr++, dptr++); |
4675 |
isp_rd_2xxx_flash(isp, addr++, dptr++); |
4340 |
} |
4676 |
} |
4341 |
if (nvram_data[0] != 'I' || nvram_data[1] != 'S' || |
4677 |
if (nvram_data[0] != 'I' || nvram_data[1] != 'S' || |
4342 |
nvram_data[2] != 'P') { |
4678 |
nvram_data[2] != 'P') { |
Lines 4361-4394
isp_read_nvram_2400(ispsoftc_t *isp)
Link Here
|
4361 |
return (retval); |
4697 |
return (retval); |
4362 |
} |
4698 |
} |
4363 |
|
4699 |
|
4364 |
static void |
|
|
4365 |
isp_rd_2400_nvram(ispsoftc_t *isp, uint32_t addr, uint32_t *rp) |
4366 |
{ |
4367 |
int loops = 0; |
4368 |
uint32_t base = 0x7ffe0000; |
4369 |
uint32_t tmp = 0; |
4370 |
|
4371 |
if (IS_26XX(isp)) { |
4372 |
base = 0x7fe7c000; /* XXX: Observation, may be wrong. */ |
4373 |
} else if (IS_25XX(isp)) { |
4374 |
base = 0x7ff00000 | 0x48000; |
4375 |
} |
4376 |
ISP_WRITE(isp, BIU2400_FLASH_ADDR, base | addr); |
4377 |
for (loops = 0; loops < 5000; loops++) { |
4378 |
ISP_DELAY(10); |
4379 |
tmp = ISP_READ(isp, BIU2400_FLASH_ADDR); |
4380 |
if ((tmp & (1U << 31)) != 0) { |
4381 |
break; |
4382 |
} |
4383 |
} |
4384 |
if (tmp & (1U << 31)) { |
4385 |
*rp = ISP_READ(isp, BIU2400_FLASH_DATA); |
4386 |
ISP_SWIZZLE_NVRAM_LONG(isp, rp); |
4387 |
} else { |
4388 |
*rp = 0xffffffff; |
4389 |
} |
4390 |
} |
4391 |
|
4392 |
static void |
4700 |
static void |
4393 |
isp_parse_nvram_2400(ispsoftc_t *isp, uint8_t *nvram_data) |
4701 |
isp_parse_nvram_2400(ispsoftc_t *isp, uint8_t *nvram_data) |
4394 |
{ |
4702 |
{ |