[iwlwifi] Skip polling CSR_GP_CNTRL after the first run

The driver hits a timeout on polling CSR_GP_CNTRL if it's not the first
instance of the driver initializing the firmware in this boot. This
change skips this poll if the hardware has been initialized by a driver
instance before, so that the poll only happens in the first driver run.

Bug: b/295943326
Test: Disabled(ffx driver disable) the driver and ran(bazel run) the
second instance of it. Initialization succeeded in both runs.

Change-Id: If94b5228349a7dd6692ed14e78241f5d8566b62b
Reviewed-on: https://fuchsia-review.googlesource.com/c/drivers/wlan/intel/iwlwifi/+/901462
Commit-Queue: Zhiyi Chen <zhiyichen@google.com>
Reviewed-by: Louis Lo <yjlou@google.com>
3 files changed
tree: 637209c21d523c2e2b4bd467b304c62481327041
  1. manifests/
  2. scripts/
  3. third_party/
  4. tools/
  5. .bazelrc
  6. .gitignore
  7. .gitmodules
  8. AUTHORS
  9. BUILD.bazel
  10. CONTRIBUTING.md
  11. fuchsia_env.toml
  12. LICENSE
  13. PATENTS
  14. README.md
  15. shac.star
  16. WORKSPACE.bazel
README.md

Intel Wifi driver

This repository contains instructions and source code to build, package and run the Intel Wifi driver for Fuchsia using the Fuchsia Bazel SDK.

WARNING: Currently this repository uses libraries that are not exported in the SDK, so it will not build directly.

Prepare your environment

Create the SDK and emulator images

By default the Bazel SDK will fetch a specific version of the Fuchsia SDK tools and libraries, but this driver currently uses libraries that are not yet exported in the SDK, so you may need a local Fuchsia tree and some cherry-picked CLs. Contact the owner of this repo if you don't know exactly what you need.

From your cherry-picked Fuchsia tree, you can produce the SDK with the following commands:

cd ~/fuchsia  # adjust accordingly

fx --dir out/oot-qemu set core.qemu-x64 \
  --args='dev_bootfs_labels=["//products/kernel_cmdline:devmgr.enable-ephemeral--true"]'

fx --dir=out/oot-qemu/ build :default sdk sdk:driver

Bootstrap your development environment

  1. Make sure this repo has the requires submodules:
git submodule update --recursive --init
  1. Since you need to use an SDK built locally to build this repo, set the LOCAL_FUCHSIA_PLATFORM_BUILD environmental variable accordingly, for example:

    export LOCAL_FUCHSIA_PLATFORM_BUILD=~/fuchsia/out/oot-qemu
    
  2. Run the script that fetches and installs the Bazel binary in //tools/bazel:

    scripts/bootstrap.sh
    

Start an emulator

TODO: there is no easy way to use a product bundle produced from a local Fuchsia tree. In the meantime, you may use fx ffx emu from the Fuchsia tree:

cd ~/fuchsia
fx ffx emu start --headless \
     --kernel-args "driver_manager.use_driver_framework_v2=true" \
     --kernel-args "driver_manager.root-driver=fuchsia-boot:///#meta/platform-bus.cm" \
     --kernel-args "devmgr.enable-ephemeral=true"

Let the emulator know where are the system packages for on-demand loading:

tools/ffx repository add-from-pm ${LOCAL_FUCHSIA_PLATFORM_BUILD}/amber-files -r localtree
tools/ffx target repository register --alias fuchsia.com -r localtree

Build and package the driver

  1. Since this repo is not auto rolling to the latest sdk version, manually update sdk-integration version if needed.
git -C third_party/sdk-integration fetch origin main
git -C third_party/sdk-integration checkout FETCH_HEAD
  1. Build and package
tools/bazel run --config=fuchsia_x64 third_party/iwlwifi/platform:iwlwifi_pkg.iwlwifi_component

This command will build the driver and make it available as a package on a local Fuchsia repository and register the driver with the device/emulator.

Run tests

  1. Build and run the tests:
tools/bazel test --config=fuchsia_x64 third_party/iwlwifi/test:iwlwifi_test_pkg

This command will build and run all the tests on the emulator or device. Specific tests can be executed by appending .<test_name> right after the test package, for example:

tools/bazel test --config=fuchsia_x64 third_party/iwlwifi/test:iwlwifi_test_pkg.platform_test