Go back –> iwl3945 kerneldoc

BSM_WR_CTRL_REG_BIT_START -

BSM_WR_CTRL_REG_BIT_START ( 0x80000000)

Arguments

Description

The Bootstrap State Machine (BSM) stores a short bootstrap uCode program in special SRAM that does not power down when the embedded control processor is sleeping (e.g. for periodic power-saving shutdowns of radio).

When powering back up after sleeps (or during initial uCode load), the BSM internally loads the short bootstrap program from the special SRAM into the embedded processor's instruction SRAM, and starts the processor so it runs the bootstrap program.

This bootstrap program loads (via PCI busmaster DMA) instructions and data images for a uCode program from host DRAM locations. The host driver indicates DRAM locations and sizes for instruction and data images via the four BSM_DRAM_* registers. Once the bootstrap program loads the new program, the new program starts automatically.

The uCode used for open-source drivers includes two programs:

1) Initialization -- performs hardware calibration and sets up some internal data, then notifies host via "initialize alive" notification (struct iwl_init_alive_resp) that it has completed all of its work. After signal from host, it then loads and starts the runtime program. The initialization program must be used when initially setting up the NIC after loading the driver.

2) Runtime/Protocol -- performs all normal runtime operations. This notifies host via "alive" notification (struct iwl_alive_resp) that it is ready to be used.

When initializing the NIC, the host driver does the following procedure:

1) Load bootstrap program (instructions only, no data image for bootstrap) into bootstrap memory. Use dword writes starting at BSM_SRAM_LOWER_BOUND

2) Point (via BSM_DRAM_*) to the "initialize" uCode data and instruction images in host DRAM.

3) Set up BSM to copy from BSM SRAM into uCode instruction SRAM when asked: BSM_WR_MEM_SRC_REG = 0 BSM_WR_MEM_DST_REG = RTC_INST_LOWER_BOUND BSM_WR_MEM_DWCOUNT_REG = # dwords in bootstrap instruction image

4) Load bootstrap into instruction SRAM: BSM_WR_CTRL_REG = BSM_WR_CTRL_REG_BIT_START

5) Wait for load completion: Poll BSM_WR_CTRL_REG for BSM_WR_CTRL_REG_BIT_START = 0

6) Enable future boot loads whenever NIC's power management triggers it: BSM_WR_CTRL_REG = BSM_WR_CTRL_REG_BIT_START_EN

7) Start the NIC by removing all reset bits: CSR_RESET = 0

The bootstrap uCode (already in instruction SRAM) loads initialization uCode. Initialization uCode performs data initialization, sends "initialize alive" notification to host, and waits for a signal from host to load runtime code.

4) Point (via BSM_DRAM_*) to the "runtime" uCode data and instruction images in host DRAM. The last register loaded must be the instruction byte count register ("1" in MSbit tells initialization uCode to load the runtime uCode): BSM_DRAM_INST_BYTECOUNT_REG = byte count | BSM_DRAM_INST_LOAD

5) Wait for "alive" notification, then issue normal runtime commands.

Data caching during power-downs:

Just before the embedded controller powers down (e.g for automatic power-saving modes, or for RFKILL), uCode stores (via PCI busmaster DMA) a current snapshot of the embedded processor's data SRAM into host DRAM. This caches the data while the embedded processor's memory is powered down. Location and size are controlled by BSM_DRAM_DATA_* registers.

NOTE

Initialization uCode does *not* run as part of the save/restore procedure.

This save/restore method is mostly for autonomous power management during normal operation (result of POWER_TABLE_CMD). Platform suspend/resume and RFKILL should use complete restarts (with total re-initialization) of uCode, allowing total shutdown (including BSM memory).

Note that, during normal operation, the host DRAM that held the initial startup data for the runtime code is now being used as a backup data cache for modified data! If you need to completely re-initialize the NIC, make sure that you use the runtime data image from the uCode distribution file, not the modified/saved runtime data. You may want to store a separate "clean" runtime data image in DRAM to avoid disk reads of distribution file.

NOTE

Initialization uCode does *not* run as part of the save/restore procedure.

This save/restore method is mostly for autonomous power management during normal operation (result of POWER_TABLE_CMD). Platform suspend/resume and RFKILL should use complete restarts (with total re-initialization) of uCode, allowing total shutdown (including BSM memory).

Note that, during normal operation, the host DRAM that held the initial startup data for the runtime code is now being used as a backup data cache for modified data! If you need to completely re-initialize the NIC, make sure that you use the runtime data image from the uCode distribution file, not the modified/saved runtime data. You may want to store a separate "clean" runtime data image in DRAM to avoid disk reads of distribution file.