⬢ DragonFlyBSD Kernel Audit
DF-3642 / trace.log
← back to finding ↓ download raw
== DF-3642 trace: erase-bank retry accumulation ==
-- base setup (sys/dev/netif/ig_hal/e1000_ich8lan.c:4742-4745)
	/* Start with the base address, then add the sector offset. */
	flash_linear_addr = hw->nvm.flash_base_addr;
	flash_linear_addr += (bank) ? flash_bank_size : 0;

-- accumulation inside retry loop (4779-4781) + retry budget (4798) + unconditional success (4801)
			/* Write the last 24 bits of an index within the
			 * block into Flash Linear address field in Flash
			 * Address.
			 */
			flash_linear_addr += (j * sector_size);
			E1000_WRITE_FLASH_REG(hw, ICH_FLASH_FADDR,
					      flash_linear_addr);

			ret_val = e1000_flash_cycle_ich8lan(hw, timeout);
			if (ret_val == E1000_SUCCESS)
				break;

			/* Check if FCERR is set to 1.  If 1,
			 * clear it and try the whole sequence
			 * a few more times else Done
			 */
			hsfsts.regval = E1000_READ_FLASH_REG16(hw,
						      ICH_FLASH_HSFSTS);
			if (hsfsts.hsf_status.flcerr)
				/* repeat for some time before giving up */
				continue;
			else if (!hsfsts.hsf_status.flcdone)
				return ret_val;
		} while (++count < ICH_FLASH_CYCLE_REPEAT_COUNT);
	}

	return E1000_SUCCESS;

-- reachability chain --
[1] if_em.c:781/787 attach calls e1000_validate_nvm_checksum
	if (e1000_validate_nvm_checksum(&adapter->hw) < 0) {
		/*
		 * Some PCI-E parts fail the first check due to
		 * the link being in sleep state, call it again,
		 * if it fails a second time its a real issue.
		 */
		if (e1000_validate_nvm_checksum(&adapter->hw) < 0) {
			device_printf(dev,
[2] e1000_api.c:1270 dispatch to nvm.ops.validate
s32 e1000_validate_nvm_checksum(struct e1000_hw *hw)
{
	if (hw->nvm.ops.validate)
[3] e1000_ich8lan.c:4395-4403 VALID_CSUM clear -> write+update (bank erase)
	if (!(data & valid_csum_mask)) {
		data |= valid_csum_mask;
		ret_val = hw->nvm.ops.write(hw, word, 1, &data);
		if (ret_val)
			return ret_val;
		ret_val = hw->nvm.ops.update(hw);
		if (ret_val)
			return ret_val;
	}
[4] e1000_ich8lan.c:4243-4254 update -> e1000_erase_flash_bank_ich8lan
	if (bank == 0) {
		new_bank_offset = nvm->flash_bank_size;
		old_bank_offset = 0;
		ret_val = e1000_erase_flash_bank_ich8lan(hw, 1);
		if (ret_val)
			goto release;
	} else {
		old_bank_offset = nvm->flash_bank_size;
		new_bank_offset = 0;
		ret_val = e1000_erase_flash_bank_ich8lan(hw, 0);
		if (ret_val)
			goto release;

-- upstream identical (FreeBSD HEAD, fetched 2026-09-15) --
4931:			flash_linear_addr += (j * sector_size);