diff --git a/.bazelrc b/.bazelrc index 98938f8a2..88f76ba47 100644 --- a/.bazelrc +++ b/.bazelrc @@ -104,6 +104,13 @@ test:stress_k_ast1060_evb --run_under="//target/ast10x0/harness:test_runner \ --timeout 0 " test:stress_k_ast1060_evb --test_env=AST1060_EVB_PI_HOST +# ── VeeR RISC-V kernel target ── +# Platform setup for building //target/veer/* artifacts. +common:k_veer --platforms=//target/veer:veer +build:k_veer --build_tag_filters=-do_not_build,-kernel_doc_test +# Usage: VCK190_FPGA_HOST= bazel test --config=k_veer //target/veer/unittest_runner:fpga_test +test:k_veer --test_env=VCK190_FPGA_HOST + # Site-local overrides. Kept last so developer machine-specific settings (e.g. a # local QEMU source override via --override_repository) take precedence. This # file is not checked in; see third_party/qemu/setup.md. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ebfa5325..ecf7b46d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: push: branches: [ main, develop ] pull_request: - branches: [ main, earlgrey-hwe ] + branches: [ main, earlgrey-hwe, ocp-global-demo-wip ] env: CARGO_TERM_COLOR: always diff --git a/MODULE.bazel b/MODULE.bazel index 255a90922..7919f2901 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -22,14 +22,9 @@ local_path_override( git_override( module_name = "pigweed", - commit = "f540ae6c33424230ed2d388599efa89b6baacf80", + commit = "294d431a761dc44fe07710c15d5ac1603f7ef7bf", patch_args = ["-p1"], - patches = [ - # Program the VeeR external-interrupt redirect table (MEIVT) in - # veer_pic early_init; without it the first external interrupt - # vectors through an unprogrammed table to address 0. - "//third_party/pigweed:veer_pic_meivt.patch", - ], + patches = ["//patches:pigweed_cortex_m_systick_double_count.patch"], remote = "https://pigweed.googlesource.com/pigweed/pigweed", ) diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 0ef6fb304..641ed4d54 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -488,7 +488,8 @@ "https://bcr.bazel.build/modules/rules_python/1.7.0/MODULE.bazel": "d01f995ecd137abf30238ad9ce97f8fc3ac57289c8b24bd0bf53324d937a14f8", "https://bcr.bazel.build/modules/rules_python/1.8.3/MODULE.bazel": "f343e159b59701334be3914416b9f1b72845801ba47920fcb288af4ce8c5cce3", "https://bcr.bazel.build/modules/rules_python/1.8.5/MODULE.bazel": "28b2d79ed8368d7d45b34bacc220e3c0b99cbcd9392641961b849e4c3f55dd30", - "https://bcr.bazel.build/modules/rules_python/1.8.5/source.json": "e261b03c8804f2582c9536013f987e1ea105a2b38c238aa2ac8f98fc34c8b18a", + "https://bcr.bazel.build/modules/rules_python/1.9.1/MODULE.bazel": "c7c23dcdcdfd6071af861c1480ecdcba3dee3fd63b839896c31d51e7e36e8e84", + "https://bcr.bazel.build/modules/rules_python/1.9.1/source.json": "5f568534a68ae1ba8b6d21f51b66a9d9b85615189d35a498098b1581a95b6d28", "https://bcr.bazel.build/modules/rules_robolectric/4.14.1.2/MODULE.bazel": "d44fec647d0aeb67b9f3b980cf68ba634976f3ae7ccd6c07d790b59b87a4f251", "https://bcr.bazel.build/modules/rules_robolectric/4.14.1.2/source.json": "37c10335f2361c337c5c1f34ed36d2da70534c23088062b33a8bdaab68aa9dea", "https://bcr.bazel.build/modules/rules_rust/0.45.1/MODULE.bazel": "a69d0db3a958fab2c6520961e1b2287afcc8b36690fd31bbc4f6f7391397150d", @@ -1334,7 +1335,7 @@ "@@pigweed+//pw_toolchain/cc:pw_cxx_toolchain.bzl%pw_cxx_toolchain": { "general": { "bzlTransitiveDigest": "8IpVszWptocnteXbMdzhsEBLTUDLy29Js900DGnv/58=", - "usagesDigest": "aE8mXL/+T2hL2umOyhat46O57+LC+hDW3/i6Qo8UfMo=", + "usagesDigest": "WXs9NNUE6j/rwQgRuduoROGS4zlVtgtsBGW7DJbiggU=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, @@ -1352,7 +1353,7 @@ "attributes": { "build_file": "@@pigweed+//pw_toolchain/build_external:llvm_clang.BUILD", "path": "fuchsia/third_party/clang/${os}-${arch}", - "tag": "git_revision:e8f9589942ecd93d94de2af2e875964693e55129" + "tag": "git_revision:5e63f2ce42db2c42f1d0012a3b5fa9c6113f750a" } }, "zephyr_toolchain": { @@ -1384,7 +1385,7 @@ "@@pigweed+//pw_toolchain/rust:extensions.bzl%pw_rust": { "general": { "bzlTransitiveDigest": "4K/ADdJohpexBCsXAc1O/B44plfS7LXTry5X/4o1fV4=", - "usagesDigest": "amr5GUEsmqaVoFmHc78dtpzHP+01Zp4LshArrY2aH2M=", + "usagesDigest": "GOL7VfOR1rmzqQ3/KT7LohFIOivrhPgXYJwG0iP6aPU=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, @@ -1410,7 +1411,7 @@ "attributes": { "build_file": "@@pigweed+//pw_toolchain/rust:rust_analyzer.BUILD", "path": "fuchsia/third_party/rust-analyzer/linux-arm64", - "tag": "git_revision:61504e12b88ba8b251aabca786a94973e4010a12" + "tag": "git_revision:bf3e4a3141231a6caf3183965af8eb00d258cd02" } }, "rust_bindgen_linux_aarch64": { @@ -1442,7 +1443,7 @@ "attributes": { "build_file": "@@pigweed+//pw_toolchain/rust:rust_analyzer.BUILD", "path": "fuchsia/third_party/rust-analyzer/linux-amd64", - "tag": "git_revision:61504e12b88ba8b251aabca786a94973e4010a12" + "tag": "git_revision:bf3e4a3141231a6caf3183965af8eb00d258cd02" } }, "rust_bindgen_linux_x86_64": { @@ -1474,7 +1475,7 @@ "attributes": { "build_file": "@@pigweed+//pw_toolchain/rust:rust_analyzer.BUILD", "path": "fuchsia/third_party/rust-analyzer/mac-arm64", - "tag": "git_revision:61504e12b88ba8b251aabca786a94973e4010a12" + "tag": "git_revision:bf3e4a3141231a6caf3183965af8eb00d258cd02" } }, "rust_bindgen_macos_aarch64": { @@ -1506,7 +1507,7 @@ "attributes": { "build_file": "@@pigweed+//pw_toolchain/rust:rust_analyzer.BUILD", "path": "fuchsia/third_party/rust-analyzer/mac-amd64", - "tag": "git_revision:61504e12b88ba8b251aabca786a94973e4010a12" + "tag": "git_revision:bf3e4a3141231a6caf3183965af8eb00d258cd02" } }, "rust_bindgen_macos_x86_64": { @@ -1976,245 +1977,10 @@ ] } }, - "@@rules_python+//python/extensions:config.bzl%config": { - "general": { - "bzlTransitiveDigest": "uo49IDITNsksO4x76pZ7eYlLKomkU77mK8VTrbCHXZM=", - "usagesDigest": "lDbpRfhoWmZCHSaNxwZv/8fF2y0wu2th0G0f/uqX7VM=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "rules_python_internal": { - "repoRuleId": "@@rules_python+//python/private:internal_config_repo.bzl%internal_config_repo", - "attributes": { - "transition_setting_generators": {}, - "transition_settings": [] - } - }, - "pypi__build": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "url": "https://files.pythonhosted.org/packages/e2/03/f3c8ba0a6b6e30d7d18c40faab90807c9bb5e9a1e3b2fe2008af624a9c97/build-1.2.1-py3-none-any.whl", - "sha256": "75e10f767a433d9a86e50d83f418e83efc18ede923ee5ff7df93b6cb0306c5d4", - "type": "zip", - "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" - } - }, - "pypi__click": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "url": "https://files.pythonhosted.org/packages/00/2e/d53fa4befbf2cfa713304affc7ca780ce4fc1fd8710527771b58311a3229/click-8.1.7-py3-none-any.whl", - "sha256": "ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28", - "type": "zip", - "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" - } - }, - "pypi__colorama": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "url": "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", - "sha256": "4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", - "type": "zip", - "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" - } - }, - "pypi__importlib_metadata": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "url": "https://files.pythonhosted.org/packages/2d/0a/679461c511447ffaf176567d5c496d1de27cbe34a87df6677d7171b2fbd4/importlib_metadata-7.1.0-py3-none-any.whl", - "sha256": "30962b96c0c223483ed6cc7280e7f0199feb01a0e40cfae4d4450fc6fab1f570", - "type": "zip", - "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" - } - }, - "pypi__installer": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "url": "https://files.pythonhosted.org/packages/e5/ca/1172b6638d52f2d6caa2dd262ec4c811ba59eee96d54a7701930726bce18/installer-0.7.0-py3-none-any.whl", - "sha256": "05d1933f0a5ba7d8d6296bb6d5018e7c94fa473ceb10cf198a92ccea19c27b53", - "type": "zip", - "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" - } - }, - "pypi__more_itertools": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "url": "https://files.pythonhosted.org/packages/50/e2/8e10e465ee3987bb7c9ab69efb91d867d93959095f4807db102d07995d94/more_itertools-10.2.0-py3-none-any.whl", - "sha256": "686b06abe565edfab151cb8fd385a05651e1fdf8f0a14191e4439283421f8684", - "type": "zip", - "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" - } - }, - "pypi__packaging": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "url": "https://files.pythonhosted.org/packages/49/df/1fceb2f8900f8639e278b056416d49134fb8d84c5942ffaa01ad34782422/packaging-24.0-py3-none-any.whl", - "sha256": "2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5", - "type": "zip", - "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" - } - }, - "pypi__pep517": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "url": "https://files.pythonhosted.org/packages/25/6e/ca4a5434eb0e502210f591b97537d322546e4833dcb4d470a48c375c5540/pep517-0.13.1-py3-none-any.whl", - "sha256": "31b206f67165b3536dd577c5c3f1518e8fbaf38cbc57efff8369a392feff1721", - "type": "zip", - "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" - } - }, - "pypi__pip": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "url": "https://files.pythonhosted.org/packages/8a/6a/19e9fe04fca059ccf770861c7d5721ab4c2aebc539889e97c7977528a53b/pip-24.0-py3-none-any.whl", - "sha256": "ba0d021a166865d2265246961bec0152ff124de910c5cc39f1156ce3fa7c69dc", - "type": "zip", - "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" - } - }, - "pypi__pip_tools": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "url": "https://files.pythonhosted.org/packages/0d/dc/38f4ce065e92c66f058ea7a368a9c5de4e702272b479c0992059f7693941/pip_tools-7.4.1-py3-none-any.whl", - "sha256": "4c690e5fbae2f21e87843e89c26191f0d9454f362d8acdbd695716493ec8b3a9", - "type": "zip", - "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" - } - }, - "pypi__pyproject_hooks": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "url": "https://files.pythonhosted.org/packages/ae/f3/431b9d5fe7d14af7a32340792ef43b8a714e7726f1d7b69cc4e8e7a3f1d7/pyproject_hooks-1.1.0-py3-none-any.whl", - "sha256": "7ceeefe9aec63a1064c18d939bdc3adf2d8aa1988a510afec15151578b232aa2", - "type": "zip", - "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" - } - }, - "pypi__setuptools": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "url": "https://files.pythonhosted.org/packages/90/99/158ad0609729111163fc1f674a5a42f2605371a4cf036d0441070e2f7455/setuptools-78.1.1-py3-none-any.whl", - "sha256": "c3a9c4211ff4c309edb8b8c4f1cbfa7ae324c4ba9f91ff254e3d305b9fd54561", - "type": "zip", - "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" - } - }, - "pypi__tomli": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "url": "https://files.pythonhosted.org/packages/97/75/10a9ebee3fd790d20926a90a2547f0bf78f371b2f13aa822c759680ca7b9/tomli-2.0.1-py3-none-any.whl", - "sha256": "939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc", - "type": "zip", - "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" - } - }, - "pypi__wheel": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "url": "https://files.pythonhosted.org/packages/7d/cd/d7460c9a869b16c3dd4e1e403cce337df165368c71d6af229a74699622ce/wheel-0.43.0-py3-none-any.whl", - "sha256": "55c570405f142630c6b9f72fe09d9b67cf1477fcf543ae5b8dcb1f5b7377da81", - "type": "zip", - "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" - } - }, - "pypi__zipp": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "url": "https://files.pythonhosted.org/packages/da/55/a03fd7240714916507e1fcf7ae355bd9d9ed2e6db492595f1a67f61681be/zipp-3.18.2-py3-none-any.whl", - "sha256": "dce197b859eb796242b0622af1b8beb0a722d52aa2f57133ead08edd5bf5374e", - "type": "zip", - "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" - } - } - }, - "recordedRepoMappingEntries": [ - [ - "rules_python+", - "bazel_tools", - "bazel_tools" - ], - [ - "rules_python+", - "pypi__build", - "rules_python++config+pypi__build" - ], - [ - "rules_python+", - "pypi__click", - "rules_python++config+pypi__click" - ], - [ - "rules_python+", - "pypi__colorama", - "rules_python++config+pypi__colorama" - ], - [ - "rules_python+", - "pypi__importlib_metadata", - "rules_python++config+pypi__importlib_metadata" - ], - [ - "rules_python+", - "pypi__installer", - "rules_python++config+pypi__installer" - ], - [ - "rules_python+", - "pypi__more_itertools", - "rules_python++config+pypi__more_itertools" - ], - [ - "rules_python+", - "pypi__packaging", - "rules_python++config+pypi__packaging" - ], - [ - "rules_python+", - "pypi__pep517", - "rules_python++config+pypi__pep517" - ], - [ - "rules_python+", - "pypi__pip", - "rules_python++config+pypi__pip" - ], - [ - "rules_python+", - "pypi__pip_tools", - "rules_python++config+pypi__pip_tools" - ], - [ - "rules_python+", - "pypi__pyproject_hooks", - "rules_python++config+pypi__pyproject_hooks" - ], - [ - "rules_python+", - "pypi__setuptools", - "rules_python++config+pypi__setuptools" - ], - [ - "rules_python+", - "pypi__tomli", - "rules_python++config+pypi__tomli" - ], - [ - "rules_python+", - "pypi__wheel", - "rules_python++config+pypi__wheel" - ], - [ - "rules_python+", - "pypi__zipp", - "rules_python++config+pypi__zipp" - ] - ] - } - }, "@@rules_python+//python/uv:uv.bzl%uv": { "general": { - "bzlTransitiveDigest": "zyNsrbgVKwpA0B3zI84imAfuC424VSzYNPgjr/HJy5M=", - "usagesDigest": "c4BCoL7WnccEomzDYulDuOys9pd6N93KaNI4mTVbqi0=", + "bzlTransitiveDigest": "xMgnVVV6SeyGCaYQT+4rYddx63q6+JXtyCrlLeA8OLM=", + "usagesDigest": "mPuA4Am7rrvFsij0/gJA24bVqE3ZzeaG0/PmKHHZit8=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, @@ -2257,16 +2023,16 @@ "bzlTransitiveDigest": "jNSrFHUlLYNnco7Hvll6LUiIKh80CX7WU0O6p3Ajq+0=", "usagesDigest": "/Nz9QH+EBlDXoVXWiAEH8owsAo1cu+GkXjlRdolG7Sk=", "recordedFileInputs": { - "@@//third_party/crates_io/Cargo.lock": "3b5f1bafd02e723bd3ac919040528b2e3c5e2ffb466791774e6b9efbd8d1acdd", - "@@//third_party/crates_io/Cargo.toml": "2b866ee62a559d685b73518f1beea1cf8872b8837e0d6b68d427579039a43151", + "@@//third_party/crates_io/Cargo.lock": "c0c0fee37d078317b3e5bb38d037105e4136f9a09d2ffb8471041c178c109008", + "@@//third_party/crates_io/Cargo.toml": "f8e800333dbfa64f802263ae5c93732c85944f20e0a5f1a546f07feeccc8da8e", "@@caliptra_deps+//crates_io/embedded/Cargo.lock": "d6c0101f48da22f2bc2d339f358de79bad3dd03218c6db29a14099b9f7757691", "@@caliptra_deps+//crates_io/embedded/Cargo.toml": "8f9f4ed2721db13476b12fdac045dac2142b38f189a8abb5f4c446dc0c6ac3dd", "@@caliptra_deps+//crates_io/host/Cargo.lock": "ae555b01424917ec61d892c15d7a66af88c2f10be4e0e7b0bc2357b702883b89", "@@caliptra_deps+//crates_io/host/Cargo.toml": "466d5a4467db483353a045384ab6114406490f526d40689317021d91ef201071", - "@@pigweed+//third_party/crates_io/crates_no_std/Cargo.lock": "6e163646568d198fe47f57eaddab9cbf8acd8125c6ee492af7410f09fe659b3b", - "@@pigweed+//third_party/crates_io/crates_no_std/Cargo.toml": "0ed41f28a82b51199ab901c6c0ce1fc90262f6d3febc995d9abfe65f5f0fdb38", - "@@pigweed+//third_party/crates_io/crates_std/Cargo.lock": "c5305cf8db3f3b5896f0c8b8b65720324adca360a72b944dec88d541ee57ab17", - "@@pigweed+//third_party/crates_io/crates_std/Cargo.toml": "4ed0286c68b2a0a0ec8da4164e21524c704381a6b7d149c1d6390a289acd5194" + "@@pigweed+//third_party/crates_io/crates_no_std/Cargo.lock": "1f01e717deaf59dd6067e40bc392983db2d5a6d47566d33f8d548fe8cbd86e95", + "@@pigweed+//third_party/crates_io/crates_no_std/Cargo.toml": "0c53b3e801ef74010607c576d4be7fcf8d169f0e89c2dcc11e957c265c020d6a", + "@@pigweed+//third_party/crates_io/crates_std/Cargo.lock": "09db4d2aaa2dc8926e752e09d4ed44a8e18776cec945de92369d0050b8c3a7e0", + "@@pigweed+//third_party/crates_io/crates_std/Cargo.toml": "34325493abc11a347bbb61e7db7be75e0e23cedc4b5ae136928e3ec4ef35157e" }, "recordedDirentsInputs": {}, "envVariables": { @@ -2284,9 +2050,9 @@ "repoRuleId": "@@rules_rust+//crate_universe:extensions.bzl%_generate_repo", "attributes": { "contents": { - "BUILD.bazel": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files(\n [\n \"cargo-bazel.json\",\n \"crates.bzl\",\n \"defs.bzl\",\n ] + glob(\n allow_empty = True,\n include = [\"*.bazel\"],\n ),\n)\n\nfilegroup(\n name = \"srcs\",\n srcs = glob(\n allow_empty = True,\n include = [\n \"*.bazel\",\n \"*.bzl\",\n ],\n ),\n)\n\n# Workspace Member Dependencies\nalias(\n name = \"aes-0.8.4\",\n actual = \"@rust_crates__aes-0.8.4//:aes\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"aes\",\n actual = \"@rust_crates__aes-0.8.4//:aes\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"aes-gcm-0.10.3\",\n actual = \"@rust_crates__aes-gcm-0.10.3//:aes_gcm\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"aes-gcm\",\n actual = \"@rust_crates__aes-gcm-0.10.3//:aes_gcm\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"aligned-0.4.3\",\n actual = \"@rust_crates__aligned-0.4.3//:aligned\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"aligned\",\n actual = \"@rust_crates__aligned-0.4.3//:aligned\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"anyhow-1.0.103\",\n actual = \"@rust_crates__anyhow-1.0.103//:anyhow\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"anyhow\",\n actual = \"@rust_crates__anyhow-1.0.103//:anyhow\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitfield-0.14.0\",\n actual = \"@rust_crates__bitfield-0.14.0//:bitfield\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitfield\",\n actual = \"@rust_crates__bitfield-0.14.0//:bitfield\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitfield-struct-0.11.0\",\n actual = \"@rust_crates__bitfield-struct-0.11.0//:bitfield_struct\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitfield-struct\",\n actual = \"@rust_crates__bitfield-struct-0.11.0//:bitfield_struct\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitflags-2.13.0\",\n actual = \"@rust_crates__bitflags-2.13.0//:bitflags\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitflags\",\n actual = \"@rust_crates__bitflags-2.13.0//:bitflags\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"byteorder-1.5.0\",\n actual = \"@rust_crates__byteorder-1.5.0//:byteorder\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"byteorder\",\n actual = \"@rust_crates__byteorder-1.5.0//:byteorder\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cfg-if-1.0.4\",\n actual = \"@rust_crates__cfg-if-1.0.4//:cfg_if\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cfg-if\",\n actual = \"@rust_crates__cfg-if-1.0.4//:cfg_if\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cipher-0.4.4\",\n actual = \"@rust_crates__cipher-0.4.4//:cipher\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cipher\",\n actual = \"@rust_crates__cipher-0.4.4//:cipher\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"clap-4.6.1\",\n actual = \"@rust_crates__clap-4.6.1//:clap\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"clap\",\n actual = \"@rust_crates__clap-4.6.1//:clap\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"compiler_builtins-0.1.160\",\n actual = \"@rust_crates__compiler_builtins-0.1.160//:compiler_builtins\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"compiler_builtins\",\n actual = \"@rust_crates__compiler_builtins-0.1.160//:compiler_builtins\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-0.7.7\",\n actual = \"@rust_crates__cortex-m-0.7.7//:cortex_m\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m\",\n actual = \"@rust_crates__cortex-m-0.7.7//:cortex_m\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-rt-0.7.5\",\n actual = \"@rust_crates__cortex-m-rt-0.7.5//:cortex_m_rt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-rt\",\n actual = \"@rust_crates__cortex-m-rt-0.7.5//:cortex_m_rt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-semihosting-0.5.0\",\n actual = \"@rust_crates__cortex-m-semihosting-0.5.0//:cortex_m_semihosting\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-semihosting\",\n actual = \"@rust_crates__cortex-m-semihosting-0.5.0//:cortex_m_semihosting\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"critical-section-1.2.0\",\n actual = \"@rust_crates__critical-section-1.2.0//:critical_section\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"critical-section\",\n actual = \"@rust_crates__critical-section-1.2.0//:critical_section\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"ctr-0.9.2\",\n actual = \"@rust_crates__ctr-0.9.2//:ctr\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"ctr\",\n actual = \"@rust_crates__ctr-0.9.2//:ctr\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"ecdsa-0.16.9\",\n actual = \"@rust_crates__ecdsa-0.16.9//:ecdsa\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"ecdsa\",\n actual = \"@rust_crates__ecdsa-0.16.9//:ecdsa\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-hal-1.0.0\",\n actual = \"@rust_crates__embedded-hal-1.0.0//:embedded_hal\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-hal\",\n actual = \"@rust_crates__embedded-hal-1.0.0//:embedded_hal\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-hal-async-1.0.0\",\n actual = \"@rust_crates__embedded-hal-async-1.0.0//:embedded_hal_async\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-hal-async\",\n actual = \"@rust_crates__embedded-hal-async-1.0.0//:embedded_hal_async\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-hal-nb-1.0.0\",\n actual = \"@rust_crates__embedded-hal-nb-1.0.0//:embedded_hal_nb\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-hal-nb\",\n actual = \"@rust_crates__embedded-hal-nb-1.0.0//:embedded_hal_nb\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-io-0.6.1\",\n actual = \"@rust_crates__embedded-io-0.6.1//:embedded_io\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-io\",\n actual = \"@rust_crates__embedded-io-0.6.1//:embedded_io\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-storage-0.3.1\",\n actual = \"@rust_crates__embedded-storage-0.3.1//:embedded_storage\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-storage\",\n actual = \"@rust_crates__embedded-storage-0.3.1//:embedded_storage\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"fugit-0.3.9\",\n actual = \"@rust_crates__fugit-0.3.9//:fugit\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"fugit\",\n actual = \"@rust_crates__fugit-0.3.9//:fugit\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"futures-0.3.32\",\n actual = \"@rust_crates__futures-0.3.32//:futures\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"futures\",\n actual = \"@rust_crates__futures-0.3.32//:futures\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"heapless-0.9.3\",\n actual = \"@rust_crates__heapless-0.9.3//:heapless\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"heapless\",\n actual = \"@rust_crates__heapless-0.9.3//:heapless\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"hex-0.4.3\",\n actual = \"@rust_crates__hex-0.4.3//:hex\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"hex\",\n actual = \"@rust_crates__hex-0.4.3//:hex\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"hex-literal-0.4.1\",\n actual = \"@rust_crates__hex-literal-0.4.1//:hex_literal\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"hex-literal\",\n actual = \"@rust_crates__hex-literal-0.4.1//:hex_literal\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"hmac-0.12.1\",\n actual = \"@rust_crates__hmac-0.12.1//:hmac\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"hmac\",\n actual = \"@rust_crates__hmac-0.12.1//:hmac\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"k256-0.13.4\",\n actual = \"@rust_crates__k256-0.13.4//:k256\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"k256\",\n actual = \"@rust_crates__k256-0.13.4//:k256\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"log-0.4.32\",\n actual = \"@rust_crates__log-0.4.32//:log\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"log\",\n actual = \"@rust_crates__log-0.4.32//:log\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"mctp-0.2.0\",\n actual = \"@rust_crates__mctp-0.2.0//:mctp\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"mctp\",\n actual = \"@rust_crates__mctp-0.2.0//:mctp\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"mctp-lib-0.1.0\",\n actual = \"@rust_crates__mctp-lib-0.1.0//:mctp_lib\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"mctp-lib\",\n actual = \"@rust_crates__mctp-lib-0.1.0//:mctp_lib\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"memoffset-0.9.1\",\n actual = \"@rust_crates__memoffset-0.9.1//:memoffset\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"memoffset\",\n actual = \"@rust_crates__memoffset-0.9.1//:memoffset\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"minijinja-2.20.0\",\n actual = \"@rust_crates__minijinja-2.20.0//:minijinja\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"minijinja\",\n actual = \"@rust_crates__minijinja-2.20.0//:minijinja\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"nb-1.1.0\",\n actual = \"@rust_crates__nb-1.1.0//:nb\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"nb\",\n actual = \"@rust_crates__nb-1.1.0//:nb\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"nom-7.1.3\",\n actual = \"@rust_crates__nom-7.1.3//:nom\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"nom\",\n actual = \"@rust_crates__nom-7.1.3//:nom\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"object-0.37.3\",\n actual = \"@rust_crates__object-0.37.3//:object\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"object\",\n actual = \"@rust_crates__object-0.37.3//:object\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"openprot-hal-blocking-0.1.0\",\n actual = \"@rust_crates__openprot-hal-blocking-0.1.0//:openprot_hal_blocking\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"openprot-hal-blocking\",\n actual = \"@rust_crates__openprot-hal-blocking-0.1.0//:openprot_hal_blocking\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"p256-0.13.2\",\n actual = \"@rust_crates__p256-0.13.2//:p256\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"p256\",\n actual = \"@rust_crates__p256-0.13.2//:p256\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"p384-0.13.1\",\n actual = \"@rust_crates__p384-0.13.1//:p384\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"p384\",\n actual = \"@rust_crates__p384-0.13.1//:p384\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"panic-halt-1.0.0\",\n actual = \"@rust_crates__panic-halt-1.0.0//:panic_halt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"panic-halt\",\n actual = \"@rust_crates__panic-halt-1.0.0//:panic_halt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"paste-1.0.15\",\n actual = \"@rust_crates__paste-1.0.15//:paste\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"paste\",\n actual = \"@rust_crates__paste-1.0.15//:paste\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"pldm-common-0.1.0\",\n actual = \"@rust_crates__pldm-common-0.1.0//:pldm_common\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"pldm-common\",\n actual = \"@rust_crates__pldm-common-0.1.0//:pldm_common\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"pldm-interface-0.1.0\",\n actual = \"@rust_crates__pldm-interface-0.1.0//:pldm_interface\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"pldm-interface\",\n actual = \"@rust_crates__pldm-interface-0.1.0//:pldm_interface\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"proc-macro2-1.0.106\",\n actual = \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"proc-macro2\",\n actual = \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"prost-0.13.5\",\n actual = \"@rust_crates__prost-0.13.5//:prost\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"prost\",\n actual = \"@rust_crates__prost-0.13.5//:prost\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"quote-1.0.45\",\n actual = \"@rust_crates__quote-1.0.45//:quote\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"quote\",\n actual = \"@rust_crates__quote-1.0.45//:quote\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"rand_core-0.9.5\",\n actual = \"@rust_crates__rand_core-0.9.5//:rand_core\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"rand_core\",\n actual = \"@rust_crates__rand_core-0.9.5//:rand_core\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-0.12.1\",\n actual = \"@rust_crates__riscv-0.12.1//:riscv\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv\",\n actual = \"@rust_crates__riscv-0.12.1//:riscv\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-rt-0.12.2\",\n actual = \"@rust_crates__riscv-rt-0.12.2//:riscv_rt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-rt\",\n actual = \"@rust_crates__riscv-rt-0.12.2//:riscv_rt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-semihosting-0.1.3\",\n actual = \"@rust_crates__riscv-semihosting-0.1.3//:riscv_semihosting\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-semihosting\",\n actual = \"@rust_crates__riscv-semihosting-0.1.3//:riscv_semihosting\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"rustc-demangle-0.1.27\",\n actual = \"@rust_crates__rustc-demangle-0.1.27//:rustc_demangle\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"rustc-demangle\",\n actual = \"@rust_crates__rustc-demangle-0.1.27//:rustc_demangle\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"sec1-0.7.3\",\n actual = \"@rust_crates__sec1-0.7.3//:sec1\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"sec1\",\n actual = \"@rust_crates__sec1-0.7.3//:sec1\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde-1.0.228\",\n actual = \"@rust_crates__serde-1.0.228//:serde\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde\",\n actual = \"@rust_crates__serde-1.0.228//:serde\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde_derive-1.0.228\",\n actual = \"@rust_crates__serde_derive-1.0.228//:serde_derive\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde_derive\",\n actual = \"@rust_crates__serde_derive-1.0.228//:serde_derive\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde_json5-0.2.1\",\n actual = \"@rust_crates__serde_json5-0.2.1//:serde_json5\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde_json5\",\n actual = \"@rust_crates__serde_json5-0.2.1//:serde_json5\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"sha2-0.10.9\",\n actual = \"@rust_crates__sha2-0.10.9//:sha2\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"sha2\",\n actual = \"@rust_crates__sha2-0.10.9//:sha2\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"sha3-0.10.9\",\n actual = \"@rust_crates__sha3-0.10.9//:sha3\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"sha3\",\n actual = \"@rust_crates__sha3-0.10.9//:sha3\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"smlang-0.8.0\",\n actual = \"@rust_crates__smlang-0.8.0//:smlang\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"smlang\",\n actual = \"@rust_crates__smlang-0.8.0//:smlang\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"spdm-lib-0.1.0\",\n actual = \"@rust_crates__spdm-lib-0.1.0//:spdm_lib\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"spdm-lib\",\n actual = \"@rust_crates__spdm-lib-0.1.0//:spdm_lib\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"subtle-2.6.1\",\n actual = \"@rust_crates__subtle-2.6.1//:subtle\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"subtle\",\n actual = \"@rust_crates__subtle-2.6.1//:subtle\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"syn-1.0.109\",\n actual = \"@rust_crates__syn-1.0.109//:syn\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"syn1-1.0.109\",\n actual = \"@rust_crates__syn-1.0.109//:syn\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"syn1\",\n actual = \"@rust_crates__syn-1.0.109//:syn\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"syn-2.0.118\",\n actual = \"@rust_crates__syn-2.0.118//:syn\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"syn\",\n actual = \"@rust_crates__syn-2.0.118//:syn\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"thiserror-2.0.18\",\n actual = \"@rust_crates__thiserror-2.0.18//:thiserror\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"thiserror\",\n actual = \"@rust_crates__thiserror-2.0.18//:thiserror\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tock-registers-0.9.0\",\n actual = \"@rust_crates__tock-registers-0.9.0//:tock_registers\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tock-registers\",\n actual = \"@rust_crates__tock-registers-0.9.0//:tock_registers\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tokio-1.52.3\",\n actual = \"@rust_crates__tokio-1.52.3//:tokio\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tokio\",\n actual = \"@rust_crates__tokio-1.52.3//:tokio\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tokio-util-0.7.18\",\n actual = \"@rust_crates__tokio-util-0.7.18//:tokio_util\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tokio-util\",\n actual = \"@rust_crates__tokio-util-0.7.18//:tokio_util\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"vcell-0.1.3\",\n actual = \"@rust_crates__vcell-0.1.3//:vcell\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"vcell\",\n actual = \"@rust_crates__vcell-0.1.3//:vcell\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zerocopy-0.8.52\",\n actual = \"@rust_crates__zerocopy-0.8.52//:zerocopy\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zerocopy\",\n actual = \"@rust_crates__zerocopy-0.8.52//:zerocopy\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zeroize-1.9.0\",\n actual = \"@rust_crates__zeroize-1.9.0//:zeroize\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zeroize\",\n actual = \"@rust_crates__zeroize-1.9.0//:zeroize\",\n tags = [\"manual\"],\n)\n", + "BUILD.bazel": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files(\n [\n \"cargo-bazel.json\",\n \"crates.bzl\",\n \"defs.bzl\",\n ] + glob(\n allow_empty = True,\n include = [\"*.bazel\"],\n ),\n)\n\nfilegroup(\n name = \"srcs\",\n srcs = glob(\n allow_empty = True,\n include = [\n \"*.bazel\",\n \"*.bzl\",\n ],\n ),\n)\n\n# Workspace Member Dependencies\nalias(\n name = \"aes-0.8.4\",\n actual = \"@rust_crates__aes-0.8.4//:aes\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"aes\",\n actual = \"@rust_crates__aes-0.8.4//:aes\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"aes-gcm-0.10.3\",\n actual = \"@rust_crates__aes-gcm-0.10.3//:aes_gcm\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"aes-gcm\",\n actual = \"@rust_crates__aes-gcm-0.10.3//:aes_gcm\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"aligned-0.4.3\",\n actual = \"@rust_crates__aligned-0.4.3//:aligned\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"aligned\",\n actual = \"@rust_crates__aligned-0.4.3//:aligned\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"anyhow-1.0.103\",\n actual = \"@rust_crates__anyhow-1.0.103//:anyhow\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"anyhow\",\n actual = \"@rust_crates__anyhow-1.0.103//:anyhow\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitfield-0.14.0\",\n actual = \"@rust_crates__bitfield-0.14.0//:bitfield\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitfield\",\n actual = \"@rust_crates__bitfield-0.14.0//:bitfield\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitfield-struct-0.11.0\",\n actual = \"@rust_crates__bitfield-struct-0.11.0//:bitfield_struct\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitfield-struct\",\n actual = \"@rust_crates__bitfield-struct-0.11.0//:bitfield_struct\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitflags-2.13.0\",\n actual = \"@rust_crates__bitflags-2.13.0//:bitflags\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitflags\",\n actual = \"@rust_crates__bitflags-2.13.0//:bitflags\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"byteorder-1.5.0\",\n actual = \"@rust_crates__byteorder-1.5.0//:byteorder\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"byteorder\",\n actual = \"@rust_crates__byteorder-1.5.0//:byteorder\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cfg-if-1.0.4\",\n actual = \"@rust_crates__cfg-if-1.0.4//:cfg_if\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cfg-if\",\n actual = \"@rust_crates__cfg-if-1.0.4//:cfg_if\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cipher-0.4.4\",\n actual = \"@rust_crates__cipher-0.4.4//:cipher\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cipher\",\n actual = \"@rust_crates__cipher-0.4.4//:cipher\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"clap-4.6.1\",\n actual = \"@rust_crates__clap-4.6.1//:clap\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"clap\",\n actual = \"@rust_crates__clap-4.6.1//:clap\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"compiler_builtins-0.1.160\",\n actual = \"@rust_crates__compiler_builtins-0.1.160//:compiler_builtins\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"compiler_builtins\",\n actual = \"@rust_crates__compiler_builtins-0.1.160//:compiler_builtins\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-0.7.7\",\n actual = \"@rust_crates__cortex-m-0.7.7//:cortex_m\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m\",\n actual = \"@rust_crates__cortex-m-0.7.7//:cortex_m\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-rt-0.7.5\",\n actual = \"@rust_crates__cortex-m-rt-0.7.5//:cortex_m_rt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-rt\",\n actual = \"@rust_crates__cortex-m-rt-0.7.5//:cortex_m_rt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-semihosting-0.5.0\",\n actual = \"@rust_crates__cortex-m-semihosting-0.5.0//:cortex_m_semihosting\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-semihosting\",\n actual = \"@rust_crates__cortex-m-semihosting-0.5.0//:cortex_m_semihosting\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"critical-section-1.2.0\",\n actual = \"@rust_crates__critical-section-1.2.0//:critical_section\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"critical-section\",\n actual = \"@rust_crates__critical-section-1.2.0//:critical_section\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"ctr-0.9.2\",\n actual = \"@rust_crates__ctr-0.9.2//:ctr\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"ctr\",\n actual = \"@rust_crates__ctr-0.9.2//:ctr\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"ecdsa-0.16.9\",\n actual = \"@rust_crates__ecdsa-0.16.9//:ecdsa\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"ecdsa\",\n actual = \"@rust_crates__ecdsa-0.16.9//:ecdsa\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-hal-1.0.0\",\n actual = \"@rust_crates__embedded-hal-1.0.0//:embedded_hal\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-hal\",\n actual = \"@rust_crates__embedded-hal-1.0.0//:embedded_hal\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-hal-async-1.0.0\",\n actual = \"@rust_crates__embedded-hal-async-1.0.0//:embedded_hal_async\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-hal-async\",\n actual = \"@rust_crates__embedded-hal-async-1.0.0//:embedded_hal_async\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-hal-nb-1.0.0\",\n actual = \"@rust_crates__embedded-hal-nb-1.0.0//:embedded_hal_nb\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-hal-nb\",\n actual = \"@rust_crates__embedded-hal-nb-1.0.0//:embedded_hal_nb\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-io-0.6.1\",\n actual = \"@rust_crates__embedded-io-0.6.1//:embedded_io\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-io\",\n actual = \"@rust_crates__embedded-io-0.6.1//:embedded_io\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-storage-0.3.1\",\n actual = \"@rust_crates__embedded-storage-0.3.1//:embedded_storage\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-storage\",\n actual = \"@rust_crates__embedded-storage-0.3.1//:embedded_storage\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"fugit-0.3.9\",\n actual = \"@rust_crates__fugit-0.3.9//:fugit\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"fugit\",\n actual = \"@rust_crates__fugit-0.3.9//:fugit\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"futures-0.3.32\",\n actual = \"@rust_crates__futures-0.3.32//:futures\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"futures\",\n actual = \"@rust_crates__futures-0.3.32//:futures\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"heapless-0.9.3\",\n actual = \"@rust_crates__heapless-0.9.3//:heapless\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"heapless\",\n actual = \"@rust_crates__heapless-0.9.3//:heapless\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"hex-0.4.3\",\n actual = \"@rust_crates__hex-0.4.3//:hex\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"hex\",\n actual = \"@rust_crates__hex-0.4.3//:hex\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"hex-literal-0.4.1\",\n actual = \"@rust_crates__hex-literal-0.4.1//:hex_literal\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"hex-literal\",\n actual = \"@rust_crates__hex-literal-0.4.1//:hex_literal\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"hmac-0.12.1\",\n actual = \"@rust_crates__hmac-0.12.1//:hmac\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"hmac\",\n actual = \"@rust_crates__hmac-0.12.1//:hmac\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"k256-0.13.4\",\n actual = \"@rust_crates__k256-0.13.4//:k256\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"k256\",\n actual = \"@rust_crates__k256-0.13.4//:k256\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"log-0.4.32\",\n actual = \"@rust_crates__log-0.4.32//:log\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"log\",\n actual = \"@rust_crates__log-0.4.32//:log\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"mctp-0.2.0\",\n actual = \"@rust_crates__mctp-0.2.0//:mctp\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"mctp\",\n actual = \"@rust_crates__mctp-0.2.0//:mctp\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"mctp-lib-0.1.0\",\n actual = \"@rust_crates__mctp-lib-0.1.0//:mctp_lib\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"mctp-lib\",\n actual = \"@rust_crates__mctp-lib-0.1.0//:mctp_lib\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"memoffset-0.9.1\",\n actual = \"@rust_crates__memoffset-0.9.1//:memoffset\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"memoffset\",\n actual = \"@rust_crates__memoffset-0.9.1//:memoffset\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"minijinja-2.20.0\",\n actual = \"@rust_crates__minijinja-2.20.0//:minijinja\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"minijinja\",\n actual = \"@rust_crates__minijinja-2.20.0//:minijinja\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"nb-1.1.0\",\n actual = \"@rust_crates__nb-1.1.0//:nb\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"nb\",\n actual = \"@rust_crates__nb-1.1.0//:nb\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"nom-7.1.3\",\n actual = \"@rust_crates__nom-7.1.3//:nom\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"nom\",\n actual = \"@rust_crates__nom-7.1.3//:nom\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"object-0.40.0\",\n actual = \"@rust_crates__object-0.40.0//:object\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"object\",\n actual = \"@rust_crates__object-0.40.0//:object\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"openprot-hal-blocking-0.1.0\",\n actual = \"@rust_crates__openprot-hal-blocking-0.1.0//:openprot_hal_blocking\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"openprot-hal-blocking\",\n actual = \"@rust_crates__openprot-hal-blocking-0.1.0//:openprot_hal_blocking\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"p256-0.13.2\",\n actual = \"@rust_crates__p256-0.13.2//:p256\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"p256\",\n actual = \"@rust_crates__p256-0.13.2//:p256\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"p384-0.13.1\",\n actual = \"@rust_crates__p384-0.13.1//:p384\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"p384\",\n actual = \"@rust_crates__p384-0.13.1//:p384\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"panic-halt-1.0.0\",\n actual = \"@rust_crates__panic-halt-1.0.0//:panic_halt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"panic-halt\",\n actual = \"@rust_crates__panic-halt-1.0.0//:panic_halt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"paste-1.0.15\",\n actual = \"@rust_crates__paste-1.0.15//:paste\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"paste\",\n actual = \"@rust_crates__paste-1.0.15//:paste\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"pldm-common-0.1.0\",\n actual = \"@rust_crates__pldm-common-0.1.0//:pldm_common\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"pldm-common\",\n actual = \"@rust_crates__pldm-common-0.1.0//:pldm_common\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"pldm-interface-0.1.0\",\n actual = \"@rust_crates__pldm-interface-0.1.0//:pldm_interface\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"pldm-interface\",\n actual = \"@rust_crates__pldm-interface-0.1.0//:pldm_interface\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"proc-macro2-1.0.106\",\n actual = \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"proc-macro2\",\n actual = \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"prost-0.13.5\",\n actual = \"@rust_crates__prost-0.13.5//:prost\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"prost\",\n actual = \"@rust_crates__prost-0.13.5//:prost\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"quote-1.0.45\",\n actual = \"@rust_crates__quote-1.0.45//:quote\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"quote\",\n actual = \"@rust_crates__quote-1.0.45//:quote\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"rand_core-0.9.5\",\n actual = \"@rust_crates__rand_core-0.9.5//:rand_core\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"rand_core\",\n actual = \"@rust_crates__rand_core-0.9.5//:rand_core\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-0.12.1\",\n actual = \"@rust_crates__riscv-0.12.1//:riscv\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv\",\n actual = \"@rust_crates__riscv-0.12.1//:riscv\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-rt-0.12.2\",\n actual = \"@rust_crates__riscv-rt-0.12.2//:riscv_rt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-rt\",\n actual = \"@rust_crates__riscv-rt-0.12.2//:riscv_rt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-semihosting-0.1.3\",\n actual = \"@rust_crates__riscv-semihosting-0.1.3//:riscv_semihosting\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-semihosting\",\n actual = \"@rust_crates__riscv-semihosting-0.1.3//:riscv_semihosting\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"rustc-demangle-0.1.27\",\n actual = \"@rust_crates__rustc-demangle-0.1.27//:rustc_demangle\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"rustc-demangle\",\n actual = \"@rust_crates__rustc-demangle-0.1.27//:rustc_demangle\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"sec1-0.7.3\",\n actual = \"@rust_crates__sec1-0.7.3//:sec1\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"sec1\",\n actual = \"@rust_crates__sec1-0.7.3//:sec1\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde-1.0.228\",\n actual = \"@rust_crates__serde-1.0.228//:serde\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde\",\n actual = \"@rust_crates__serde-1.0.228//:serde\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde_derive-1.0.228\",\n actual = \"@rust_crates__serde_derive-1.0.228//:serde_derive\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde_derive\",\n actual = \"@rust_crates__serde_derive-1.0.228//:serde_derive\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde_json5-0.2.1\",\n actual = \"@rust_crates__serde_json5-0.2.1//:serde_json5\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde_json5\",\n actual = \"@rust_crates__serde_json5-0.2.1//:serde_json5\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"sha2-0.10.9\",\n actual = \"@rust_crates__sha2-0.10.9//:sha2\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"sha2\",\n actual = \"@rust_crates__sha2-0.10.9//:sha2\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"sha3-0.10.9\",\n actual = \"@rust_crates__sha3-0.10.9//:sha3\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"sha3\",\n actual = \"@rust_crates__sha3-0.10.9//:sha3\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"smlang-0.8.0\",\n actual = \"@rust_crates__smlang-0.8.0//:smlang\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"smlang\",\n actual = \"@rust_crates__smlang-0.8.0//:smlang\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"spdm-lib-0.1.0\",\n actual = \"@rust_crates__spdm-lib-0.1.0//:spdm_lib\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"spdm-lib\",\n actual = \"@rust_crates__spdm-lib-0.1.0//:spdm_lib\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"subtle-2.6.1\",\n actual = \"@rust_crates__subtle-2.6.1//:subtle\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"subtle\",\n actual = \"@rust_crates__subtle-2.6.1//:subtle\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"syn-1.0.109\",\n actual = \"@rust_crates__syn-1.0.109//:syn\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"syn1-1.0.109\",\n actual = \"@rust_crates__syn-1.0.109//:syn\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"syn1\",\n actual = \"@rust_crates__syn-1.0.109//:syn\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"syn-3.0.5\",\n actual = \"@rust_crates__syn-3.0.5//:syn\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"syn\",\n actual = \"@rust_crates__syn-3.0.5//:syn\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"thiserror-2.0.18\",\n actual = \"@rust_crates__thiserror-2.0.18//:thiserror\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"thiserror\",\n actual = \"@rust_crates__thiserror-2.0.18//:thiserror\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tock-registers-0.9.0\",\n actual = \"@rust_crates__tock-registers-0.9.0//:tock_registers\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tock-registers\",\n actual = \"@rust_crates__tock-registers-0.9.0//:tock_registers\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tokio-1.52.3\",\n actual = \"@rust_crates__tokio-1.52.3//:tokio\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tokio\",\n actual = \"@rust_crates__tokio-1.52.3//:tokio\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tokio-util-0.7.18\",\n actual = \"@rust_crates__tokio-util-0.7.18//:tokio_util\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tokio-util\",\n actual = \"@rust_crates__tokio-util-0.7.18//:tokio_util\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"vcell-0.1.3\",\n actual = \"@rust_crates__vcell-0.1.3//:vcell\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"vcell\",\n actual = \"@rust_crates__vcell-0.1.3//:vcell\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zerocopy-0.8.52\",\n actual = \"@rust_crates__zerocopy-0.8.52//:zerocopy\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zerocopy\",\n actual = \"@rust_crates__zerocopy-0.8.52//:zerocopy\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zeroize-1.9.0\",\n actual = \"@rust_crates__zeroize-1.9.0//:zeroize\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zeroize\",\n actual = \"@rust_crates__zeroize-1.9.0//:zeroize\",\n tags = [\"manual\"],\n)\n", "alias_rules.bzl": "\"\"\"Alias that transitions its target to `compilation_mode=opt`. Use `transition_alias=\"opt\"` to enable.\"\"\"\n\nload(\"@rules_cc//cc:defs.bzl\", \"CcInfo\")\nload(\"@rules_rust//rust:rust_common.bzl\", \"COMMON_PROVIDERS\")\n\ndef _transition_alias_impl(ctx):\n # `ctx.attr.actual` is a list of 1 item due to the transition\n providers = [ctx.attr.actual[0][provider] for provider in COMMON_PROVIDERS]\n if CcInfo in ctx.attr.actual[0]:\n providers.append(ctx.attr.actual[0][CcInfo])\n return providers\n\ndef _change_compilation_mode(compilation_mode):\n def _change_compilation_mode_impl(_settings, _attr):\n return {\n \"//command_line_option:compilation_mode\": compilation_mode,\n }\n\n return transition(\n implementation = _change_compilation_mode_impl,\n inputs = [],\n outputs = [\n \"//command_line_option:compilation_mode\",\n ],\n )\n\ndef _transition_alias_rule(compilation_mode):\n return rule(\n implementation = _transition_alias_impl,\n provides = COMMON_PROVIDERS,\n attrs = {\n \"actual\": attr.label(\n mandatory = True,\n doc = \"`rust_library()` target to transition to `compilation_mode=opt`.\",\n providers = COMMON_PROVIDERS,\n cfg = _change_compilation_mode(compilation_mode),\n ),\n \"_allowlist_function_transition\": attr.label(\n default = \"@bazel_tools//tools/allowlists/function_transition_allowlist\",\n ),\n },\n doc = \"Transitions a Rust library crate to the `compilation_mode=opt`.\",\n )\n\ntransition_alias_dbg = _transition_alias_rule(\"dbg\")\ntransition_alias_fastbuild = _transition_alias_rule(\"fastbuild\")\ntransition_alias_opt = _transition_alias_rule(\"opt\")\n", - "defs.bzl": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\"\"\"\n# `crates_repository` API\n\n- [aliases](#aliases)\n- [crate_deps](#crate_deps)\n- [all_crate_deps](#all_crate_deps)\n- [crate_repositories](#crate_repositories)\n\n\"\"\"\n\nload(\"@bazel_tools//tools/build_defs/repo:git.bzl\", \"git_repository\")\nload(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\")\nload(\"@bazel_tools//tools/build_defs/repo:utils.bzl\", \"maybe\")\nload(\"@bazel_skylib//lib:selects.bzl\", \"selects\")\nload(\"@rules_rust//crate_universe/private:local_crate_mirror.bzl\", \"local_crate_mirror\")\n\n###############################################################################\n# MACROS API\n###############################################################################\n\n# An identifier that represent common dependencies (unconditional).\n_COMMON_CONDITION = \"\"\n\ndef _flatten_dependency_maps(all_dependency_maps):\n \"\"\"Flatten a list of dependency maps into one dictionary.\n\n Dependency maps have the following structure:\n\n ```python\n DEPENDENCIES_MAP = {\n # The first key in the map is a Bazel package\n # name of the workspace this file is defined in.\n \"workspace_member_package\": {\n\n # Not all dependencies are supported for all platforms.\n # the condition key is the condition required to be true\n # on the host platform.\n \"condition\": {\n\n # An alias to a crate target. # The label of the crate target the\n # Aliases are only crate names. # package name refers to.\n \"package_name\": \"@full//:label\",\n }\n }\n }\n ```\n\n Args:\n all_dependency_maps (list): A list of dicts as described above\n\n Returns:\n dict: A dictionary as described above\n \"\"\"\n dependencies = {}\n\n for workspace_deps_map in all_dependency_maps:\n for pkg_name, conditional_deps_map in workspace_deps_map.items():\n if pkg_name not in dependencies:\n non_frozen_map = dict()\n for key, values in conditional_deps_map.items():\n non_frozen_map.update({key: dict(values.items())})\n dependencies.setdefault(pkg_name, non_frozen_map)\n continue\n\n for condition, deps_map in conditional_deps_map.items():\n # If the condition has not been recorded, do so and continue\n if condition not in dependencies[pkg_name]:\n dependencies[pkg_name].setdefault(condition, dict(deps_map.items()))\n continue\n\n # Alert on any miss-matched dependencies\n inconsistent_entries = []\n for crate_name, crate_label in deps_map.items():\n existing = dependencies[pkg_name][condition].get(crate_name)\n if existing and existing != crate_label:\n inconsistent_entries.append((crate_name, existing, crate_label))\n dependencies[pkg_name][condition].update({crate_name: crate_label})\n\n return dependencies\n\ndef crate_deps(deps, package_name = None):\n \"\"\"Finds the fully qualified label of the requested crates for the package where this macro is called.\n\n Args:\n deps (list): The desired list of crate targets.\n package_name (str, optional): The package name of the set of dependencies to look up.\n Defaults to `native.package_name()`.\n\n Returns:\n list: A list of labels to generated rust targets (str)\n \"\"\"\n\n if not deps:\n return []\n\n if package_name == None:\n package_name = native.package_name()\n\n # Join both sets of dependencies\n dependencies = _flatten_dependency_maps([\n _NORMAL_DEPENDENCIES,\n _NORMAL_DEV_DEPENDENCIES,\n _PROC_MACRO_DEPENDENCIES,\n _PROC_MACRO_DEV_DEPENDENCIES,\n _BUILD_DEPENDENCIES,\n _BUILD_PROC_MACRO_DEPENDENCIES,\n ]).pop(package_name, {})\n\n # Combine all conditional packages so we can easily index over a flat list\n # TODO: Perhaps this should actually return select statements and maintain\n # the conditionals of the dependencies\n flat_deps = {}\n for deps_set in dependencies.values():\n for crate_name, crate_label in deps_set.items():\n flat_deps.update({crate_name: crate_label})\n\n missing_crates = []\n crate_targets = []\n for crate_target in deps:\n if crate_target not in flat_deps:\n missing_crates.append(crate_target)\n else:\n crate_targets.append(flat_deps[crate_target])\n\n if missing_crates:\n fail(\"Could not find crates `{}` among dependencies of `{}`. Available dependencies were `{}`\".format(\n missing_crates,\n package_name,\n dependencies,\n ))\n\n return crate_targets\n\ndef all_crate_deps(\n normal = False, \n normal_dev = False, \n proc_macro = False, \n proc_macro_dev = False,\n build = False,\n build_proc_macro = False,\n package_name = None):\n \"\"\"Finds the fully qualified label of all requested direct crate dependencies \\\n for the package where this macro is called.\n\n If no parameters are set, all normal dependencies are returned. Setting any one flag will\n otherwise impact the contents of the returned list.\n\n Args:\n normal (bool, optional): If True, normal dependencies are included in the\n output list.\n normal_dev (bool, optional): If True, normal dev dependencies will be\n included in the output list.\n proc_macro (bool, optional): If True, proc_macro dependencies are included\n in the output list.\n proc_macro_dev (bool, optional): If True, dev proc_macro dependencies are\n included in the output list.\n build (bool, optional): If True, build dependencies are included\n in the output list.\n build_proc_macro (bool, optional): If True, build proc_macro dependencies are\n included in the output list.\n package_name (str, optional): The package name of the set of dependencies to look up.\n Defaults to `native.package_name()` when unset.\n\n Returns:\n list: A list of labels to generated rust targets (str)\n \"\"\"\n\n if package_name == None:\n package_name = native.package_name()\n\n # Determine the relevant maps to use\n all_dependency_maps = []\n if normal:\n all_dependency_maps.append(_NORMAL_DEPENDENCIES)\n if normal_dev:\n all_dependency_maps.append(_NORMAL_DEV_DEPENDENCIES)\n if proc_macro:\n all_dependency_maps.append(_PROC_MACRO_DEPENDENCIES)\n if proc_macro_dev:\n all_dependency_maps.append(_PROC_MACRO_DEV_DEPENDENCIES)\n if build:\n all_dependency_maps.append(_BUILD_DEPENDENCIES)\n if build_proc_macro:\n all_dependency_maps.append(_BUILD_PROC_MACRO_DEPENDENCIES)\n\n # Default to always using normal dependencies\n if not all_dependency_maps:\n all_dependency_maps.append(_NORMAL_DEPENDENCIES)\n\n dependencies = _flatten_dependency_maps(all_dependency_maps).pop(package_name, None)\n\n if not dependencies:\n if dependencies == None:\n fail(\"Tried to get all_crate_deps for package \" + package_name + \" but that package had no Cargo.toml file\")\n else:\n return []\n\n crate_deps = list(dependencies.pop(_COMMON_CONDITION, {}).values())\n for condition, deps in dependencies.items():\n crate_deps += selects.with_or({\n tuple(_CONDITIONS[condition]): deps.values(),\n \"//conditions:default\": [],\n })\n\n return crate_deps\n\ndef aliases(\n normal = False,\n normal_dev = False,\n proc_macro = False,\n proc_macro_dev = False,\n build = False,\n build_proc_macro = False,\n package_name = None):\n \"\"\"Produces a map of Crate alias names to their original label\n\n If no dependency kinds are specified, `normal` and `proc_macro` are used by default.\n Setting any one flag will otherwise determine the contents of the returned dict.\n\n Args:\n normal (bool, optional): If True, normal dependencies are included in the\n output list.\n normal_dev (bool, optional): If True, normal dev dependencies will be\n included in the output list..\n proc_macro (bool, optional): If True, proc_macro dependencies are included\n in the output list.\n proc_macro_dev (bool, optional): If True, dev proc_macro dependencies are\n included in the output list.\n build (bool, optional): If True, build dependencies are included\n in the output list.\n build_proc_macro (bool, optional): If True, build proc_macro dependencies are\n included in the output list.\n package_name (str, optional): The package name of the set of dependencies to look up.\n Defaults to `native.package_name()` when unset.\n\n Returns:\n dict: The aliases of all associated packages\n \"\"\"\n if package_name == None:\n package_name = native.package_name()\n\n # Determine the relevant maps to use\n all_aliases_maps = []\n if normal:\n all_aliases_maps.append(_NORMAL_ALIASES)\n if normal_dev:\n all_aliases_maps.append(_NORMAL_DEV_ALIASES)\n if proc_macro:\n all_aliases_maps.append(_PROC_MACRO_ALIASES)\n if proc_macro_dev:\n all_aliases_maps.append(_PROC_MACRO_DEV_ALIASES)\n if build:\n all_aliases_maps.append(_BUILD_ALIASES)\n if build_proc_macro:\n all_aliases_maps.append(_BUILD_PROC_MACRO_ALIASES)\n\n # Default to always using normal aliases\n if not all_aliases_maps:\n all_aliases_maps.append(_NORMAL_ALIASES)\n all_aliases_maps.append(_PROC_MACRO_ALIASES)\n\n aliases = _flatten_dependency_maps(all_aliases_maps).pop(package_name, None)\n\n if not aliases:\n return dict()\n\n common_items = aliases.pop(_COMMON_CONDITION, {}).items()\n\n # If there are only common items in the dictionary, immediately return them\n if not len(aliases.keys()) == 1:\n return dict(common_items)\n\n # Build a single select statement where each conditional has accounted for the\n # common set of aliases.\n crate_aliases = {\"//conditions:default\": dict(common_items)}\n for condition, deps in aliases.items():\n condition_triples = _CONDITIONS[condition]\n for triple in condition_triples:\n if triple in crate_aliases:\n crate_aliases[triple].update(deps)\n else:\n crate_aliases.update({triple: dict(deps.items() + common_items)})\n\n return select(crate_aliases)\n\n###############################################################################\n# WORKSPACE MEMBER DEPS AND ALIASES\n###############################################################################\n\n_NORMAL_DEPENDENCIES = {\n \"third_party/crates_io\": {\n _COMMON_CONDITION: {\n \"aes\": Label(\"@rust_crates//:aes-0.8.4\"),\n \"aes-gcm\": Label(\"@rust_crates//:aes-gcm-0.10.3\"),\n \"aligned\": Label(\"@rust_crates//:aligned-0.4.3\"),\n \"anyhow\": Label(\"@rust_crates//:anyhow-1.0.103\"),\n \"bitfield\": Label(\"@rust_crates//:bitfield-0.14.0\"),\n \"bitflags\": Label(\"@rust_crates//:bitflags-2.13.0\"),\n \"byteorder\": Label(\"@rust_crates//:byteorder-1.5.0\"),\n \"cfg-if\": Label(\"@rust_crates//:cfg-if-1.0.4\"),\n \"cipher\": Label(\"@rust_crates//:cipher-0.4.4\"),\n \"clap\": Label(\"@rust_crates//:clap-4.6.1\"),\n \"compiler_builtins\": Label(\"@rust_crates//:compiler_builtins-0.1.160\"),\n \"cortex-m\": Label(\"@rust_crates//:cortex-m-0.7.7\"),\n \"cortex-m-rt\": Label(\"@rust_crates//:cortex-m-rt-0.7.5\"),\n \"cortex-m-semihosting\": Label(\"@rust_crates//:cortex-m-semihosting-0.5.0\"),\n \"critical-section\": Label(\"@rust_crates//:critical-section-1.2.0\"),\n \"ctr\": Label(\"@rust_crates//:ctr-0.9.2\"),\n \"ecdsa\": Label(\"@rust_crates//:ecdsa-0.16.9\"),\n \"embedded-hal\": Label(\"@rust_crates//:embedded-hal-1.0.0\"),\n \"embedded-hal-async\": Label(\"@rust_crates//:embedded-hal-async-1.0.0\"),\n \"embedded-hal-nb\": Label(\"@rust_crates//:embedded-hal-nb-1.0.0\"),\n \"embedded-io\": Label(\"@rust_crates//:embedded-io-0.6.1\"),\n \"embedded-storage\": Label(\"@rust_crates//:embedded-storage-0.3.1\"),\n \"fugit\": Label(\"@rust_crates//:fugit-0.3.9\"),\n \"futures\": Label(\"@rust_crates//:futures-0.3.32\"),\n \"heapless\": Label(\"@rust_crates//:heapless-0.9.3\"),\n \"hex\": Label(\"@rust_crates//:hex-0.4.3\"),\n \"hex-literal\": Label(\"@rust_crates//:hex-literal-0.4.1\"),\n \"hmac\": Label(\"@rust_crates//:hmac-0.12.1\"),\n \"k256\": Label(\"@rust_crates//:k256-0.13.4\"),\n \"log\": Label(\"@rust_crates//:log-0.4.32\"),\n \"mctp\": Label(\"@rust_crates//:mctp-0.2.0\"),\n \"mctp-lib\": Label(\"@rust_crates//:mctp-lib-0.1.0\"),\n \"memoffset\": Label(\"@rust_crates//:memoffset-0.9.1\"),\n \"minijinja\": Label(\"@rust_crates//:minijinja-2.20.0\"),\n \"nb\": Label(\"@rust_crates//:nb-1.1.0\"),\n \"nom\": Label(\"@rust_crates//:nom-7.1.3\"),\n \"object\": Label(\"@rust_crates//:object-0.37.3\"),\n \"openprot-hal-blocking\": Label(\"@rust_crates//:openprot-hal-blocking-0.1.0\"),\n \"p256\": Label(\"@rust_crates//:p256-0.13.2\"),\n \"p384\": Label(\"@rust_crates//:p384-0.13.1\"),\n \"panic-halt\": Label(\"@rust_crates//:panic-halt-1.0.0\"),\n \"pldm-common\": Label(\"@rust_crates//:pldm-common-0.1.0\"),\n \"pldm-interface\": Label(\"@rust_crates//:pldm-interface-0.1.0\"),\n \"proc-macro2\": Label(\"@rust_crates//:proc-macro2-1.0.106\"),\n \"prost\": Label(\"@rust_crates//:prost-0.13.5\"),\n \"quote\": Label(\"@rust_crates//:quote-1.0.45\"),\n \"rand_core\": Label(\"@rust_crates//:rand_core-0.9.5\"),\n \"riscv\": Label(\"@rust_crates//:riscv-0.12.1\"),\n \"riscv-rt\": Label(\"@rust_crates//:riscv-rt-0.12.2\"),\n \"riscv-semihosting\": Label(\"@rust_crates//:riscv-semihosting-0.1.3\"),\n \"rustc-demangle\": Label(\"@rust_crates//:rustc-demangle-0.1.27\"),\n \"sec1\": Label(\"@rust_crates//:sec1-0.7.3\"),\n \"serde\": Label(\"@rust_crates//:serde-1.0.228\"),\n \"serde_json5\": Label(\"@rust_crates//:serde_json5-0.2.1\"),\n \"sha2\": Label(\"@rust_crates//:sha2-0.10.9\"),\n \"sha3\": Label(\"@rust_crates//:sha3-0.10.9\"),\n \"smlang\": Label(\"@rust_crates//:smlang-0.8.0\"),\n \"spdm-lib\": Label(\"@rust_crates//:spdm-lib-0.1.0\"),\n \"subtle\": Label(\"@rust_crates//:subtle-2.6.1\"),\n \"syn1\": Label(\"@rust_crates//:syn-1.0.109\"),\n \"syn\": Label(\"@rust_crates//:syn-2.0.118\"),\n \"thiserror\": Label(\"@rust_crates//:thiserror-2.0.18\"),\n \"tock-registers\": Label(\"@rust_crates//:tock-registers-0.9.0\"),\n \"tokio\": Label(\"@rust_crates//:tokio-1.52.3\"),\n \"tokio-util\": Label(\"@rust_crates//:tokio-util-0.7.18\"),\n \"vcell\": Label(\"@rust_crates//:vcell-0.1.3\"),\n \"zerocopy\": Label(\"@rust_crates//:zerocopy-0.8.52\"),\n \"zeroize\": Label(\"@rust_crates//:zeroize-1.9.0\"),\n },\n },\n}\n\n\n_NORMAL_ALIASES = {\n \"third_party/crates_io\": {\n _COMMON_CONDITION: {\n Label(\"@rust_crates//:syn-1.0.109\"): \"syn1\",\n },\n },\n}\n\n\n_NORMAL_DEV_DEPENDENCIES = {\n \"third_party/crates_io\": {\n },\n}\n\n\n_NORMAL_DEV_ALIASES = {\n \"third_party/crates_io\": {\n },\n}\n\n\n_PROC_MACRO_DEPENDENCIES = {\n \"third_party/crates_io\": {\n _COMMON_CONDITION: {\n \"bitfield-struct\": Label(\"@rust_crates//:bitfield-struct-0.11.0\"),\n \"paste\": Label(\"@rust_crates//:paste-1.0.15\"),\n \"serde_derive\": Label(\"@rust_crates//:serde_derive-1.0.228\"),\n },\n },\n}\n\n\n_PROC_MACRO_ALIASES = {\n \"third_party/crates_io\": {\n },\n}\n\n\n_PROC_MACRO_DEV_DEPENDENCIES = {\n \"third_party/crates_io\": {\n },\n}\n\n\n_PROC_MACRO_DEV_ALIASES = {\n \"third_party/crates_io\": {\n },\n}\n\n\n_BUILD_DEPENDENCIES = {\n \"third_party/crates_io\": {\n },\n}\n\n\n_BUILD_ALIASES = {\n \"third_party/crates_io\": {\n },\n}\n\n\n_BUILD_PROC_MACRO_DEPENDENCIES = {\n \"third_party/crates_io\": {\n },\n}\n\n\n_BUILD_PROC_MACRO_ALIASES = {\n \"third_party/crates_io\": {\n },\n}\n\n\n_CONDITIONS = {\n \"aarch64-apple-darwin\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\"],\n \"aarch64-linux-android\": [],\n \"aarch64-unknown-linux-gnu\": [\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\"],\n \"cfg(all(any(target_os = \\\"linux\\\", target_os = \\\"android\\\"), any(rustix_use_libc, miri, not(all(target_os = \\\"linux\\\", any(target_endian = \\\"little\\\", any(target_arch = \\\"s390x\\\", target_arch = \\\"powerpc\\\")), any(target_arch = \\\"arm\\\", all(target_arch = \\\"aarch64\\\", target_pointer_width = \\\"64\\\"), target_arch = \\\"riscv64\\\", all(rustix_use_experimental_asm, target_arch = \\\"powerpc\\\"), all(rustix_use_experimental_asm, target_arch = \\\"powerpc64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"s390x\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips32r6\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64r6\\\"), target_arch = \\\"x86\\\", all(target_arch = \\\"x86_64\\\", target_pointer_width = \\\"64\\\")))))))\": [],\n \"cfg(all(not(rustix_use_libc), not(miri), target_os = \\\"linux\\\", any(target_endian = \\\"little\\\", any(target_arch = \\\"s390x\\\", target_arch = \\\"powerpc\\\")), any(target_arch = \\\"arm\\\", all(target_arch = \\\"aarch64\\\", target_pointer_width = \\\"64\\\"), target_arch = \\\"riscv64\\\", all(rustix_use_experimental_asm, target_arch = \\\"powerpc\\\"), all(rustix_use_experimental_asm, target_arch = \\\"powerpc64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"s390x\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips32r6\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64r6\\\"), target_arch = \\\"x86\\\", all(target_arch = \\\"x86_64\\\", target_pointer_width = \\\"64\\\"))))\": [\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \\\"linux\\\", any(target_endian = \\\"little\\\", any(target_arch = \\\"s390x\\\", target_arch = \\\"powerpc\\\")), any(target_arch = \\\"arm\\\", all(target_arch = \\\"aarch64\\\", target_pointer_width = \\\"64\\\"), target_arch = \\\"riscv64\\\", all(rustix_use_experimental_asm, target_arch = \\\"powerpc\\\"), all(rustix_use_experimental_asm, target_arch = \\\"powerpc64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"s390x\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips32r6\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64r6\\\"), target_arch = \\\"x86\\\", all(target_arch = \\\"x86_64\\\", target_pointer_width = \\\"64\\\")))))))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\",\"@rules_rust//rust/platform:thumbv7em-none-eabi\",\"@rules_rust//rust/platform:x86_64-apple-darwin\"],\n \"cfg(all(target_arch = \\\"aarch64\\\", target_os = \\\"linux\\\"))\": [\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\"],\n \"cfg(all(target_arch = \\\"aarch64\\\", target_vendor = \\\"apple\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\"],\n \"cfg(all(target_arch = \\\"loongarch64\\\", target_os = \\\"linux\\\"))\": [],\n \"cfg(any())\": [],\n \"cfg(any(target_arch = \\\"aarch64\\\", target_arch = \\\"x86_64\\\", target_arch = \\\"x86\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(any(target_arch = \\\"arm\\\", target_pointer_width = \\\"32\\\", target_pointer_width = \\\"64\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\",\"@rules_rust//rust/platform:thumbv7em-none-eabi\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(any(unix, target_os = \\\"hermit\\\", target_os = \\\"wasi\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(any(unix, target_os = \\\"wasi\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(target_arch = \\\"aarch64\\\")\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\"],\n \"cfg(target_os = \\\"hermit\\\")\": [],\n \"cfg(target_os = \\\"redox\\\")\": [],\n \"cfg(target_os = \\\"wasi\\\")\": [],\n \"cfg(unix)\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(windows)\": [],\n \"riscv32imc-unknown-none-elf\": [\"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\"],\n \"thumbv7em-none-eabi\": [\"@rules_rust//rust/platform:thumbv7em-none-eabi\"],\n \"x86_64-apple-darwin\": [\"@rules_rust//rust/platform:x86_64-apple-darwin\"],\n \"x86_64-unknown-linux-gnu\": [\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n}\n\n###############################################################################\n\ndef crate_repositories():\n \"\"\"A macro for defining repositories for all generated crates.\n\n Returns:\n A list of repos visible to the module through the module extension.\n \"\"\"\n maybe(\n http_archive,\n name = \"rust_crates__adler2-2.0.1\",\n sha256 = \"320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/adler2/2.0.1/download\"],\n strip_prefix = \"adler2-2.0.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.adler2-2.0.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__aead-0.5.2\",\n sha256 = \"d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/aead/0.5.2/download\"],\n strip_prefix = \"aead-0.5.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.aead-0.5.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__aes-0.8.4\",\n sha256 = \"b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/aes/0.8.4/download\"],\n strip_prefix = \"aes-0.8.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.aes-0.8.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__aes-gcm-0.10.3\",\n sha256 = \"831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/aes-gcm/0.10.3/download\"],\n strip_prefix = \"aes-gcm-0.10.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.aes-gcm-0.10.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__aligned-0.4.3\",\n sha256 = \"ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/aligned/0.4.3/download\"],\n strip_prefix = \"aligned-0.4.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.aligned-0.4.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__anstream-1.0.0\",\n sha256 = \"824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstream/1.0.0/download\"],\n strip_prefix = \"anstream-1.0.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.anstream-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__anstyle-1.0.14\",\n sha256 = \"940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstyle/1.0.14/download\"],\n strip_prefix = \"anstyle-1.0.14\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.anstyle-1.0.14.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__anstyle-parse-1.0.0\",\n sha256 = \"52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstyle-parse/1.0.0/download\"],\n strip_prefix = \"anstyle-parse-1.0.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.anstyle-parse-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__anstyle-query-1.1.5\",\n sha256 = \"40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstyle-query/1.1.5/download\"],\n strip_prefix = \"anstyle-query-1.1.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.anstyle-query-1.1.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__anstyle-wincon-3.0.11\",\n sha256 = \"291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstyle-wincon/3.0.11/download\"],\n strip_prefix = \"anstyle-wincon-3.0.11\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.anstyle-wincon-3.0.11.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__anyhow-1.0.103\",\n sha256 = \"2a4385e2e34eb35d6b3efe798b9eb88096925d87726c0798709bf56d9ed84af3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anyhow/1.0.103/download\"],\n strip_prefix = \"anyhow-1.0.103\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.anyhow-1.0.103.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__as-slice-0.2.1\",\n sha256 = \"516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/as-slice/0.2.1/download\"],\n strip_prefix = \"as-slice-0.2.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.as-slice-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__autocfg-1.5.1\",\n sha256 = \"f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/autocfg/1.5.1/download\"],\n strip_prefix = \"autocfg-1.5.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.autocfg-1.5.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__bare-metal-0.2.5\",\n sha256 = \"5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bare-metal/0.2.5/download\"],\n strip_prefix = \"bare-metal-0.2.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.bare-metal-0.2.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__base16ct-0.2.0\",\n sha256 = \"4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/base16ct/0.2.0/download\"],\n strip_prefix = \"base16ct-0.2.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.base16ct-0.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__bitfield-0.13.2\",\n sha256 = \"46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bitfield/0.13.2/download\"],\n strip_prefix = \"bitfield-0.13.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.bitfield-0.13.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__bitfield-0.14.0\",\n sha256 = \"2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bitfield/0.14.0/download\"],\n strip_prefix = \"bitfield-0.14.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.bitfield-0.14.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__bitfield-struct-0.11.0\",\n sha256 = \"d3ca019570363e800b05ad4fd890734f28ac7b72f563ad8a35079efb793616f8\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bitfield-struct/0.11.0/download\"],\n strip_prefix = \"bitfield-struct-0.11.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.bitfield-struct-0.11.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__bitflags-2.13.0\",\n sha256 = \"b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bitflags/2.13.0/download\"],\n strip_prefix = \"bitflags-2.13.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.bitflags-2.13.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__block-buffer-0.10.4\",\n sha256 = \"3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/block-buffer/0.10.4/download\"],\n strip_prefix = \"block-buffer-0.10.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.block-buffer-0.10.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__byteorder-1.5.0\",\n sha256 = \"1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/byteorder/1.5.0/download\"],\n strip_prefix = \"byteorder-1.5.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.byteorder-1.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__bytes-1.11.1\",\n sha256 = \"1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bytes/1.11.1/download\"],\n strip_prefix = \"bytes-1.11.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.bytes-1.11.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__cfg-if-1.0.4\",\n sha256 = \"9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cfg-if/1.0.4/download\"],\n strip_prefix = \"cfg-if-1.0.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.cfg-if-1.0.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__cipher-0.4.4\",\n sha256 = \"773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cipher/0.4.4/download\"],\n strip_prefix = \"cipher-0.4.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.cipher-0.4.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__clap-4.6.1\",\n sha256 = \"1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/clap/4.6.1/download\"],\n strip_prefix = \"clap-4.6.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.clap-4.6.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__clap_builder-4.6.0\",\n sha256 = \"714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/clap_builder/4.6.0/download\"],\n strip_prefix = \"clap_builder-4.6.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.clap_builder-4.6.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__clap_derive-4.6.1\",\n sha256 = \"f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/clap_derive/4.6.1/download\"],\n strip_prefix = \"clap_derive-4.6.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.clap_derive-4.6.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__clap_lex-1.1.0\",\n sha256 = \"c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/clap_lex/1.1.0/download\"],\n strip_prefix = \"clap_lex-1.1.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.clap_lex-1.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__colorchoice-1.0.5\",\n sha256 = \"1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/colorchoice/1.0.5/download\"],\n strip_prefix = \"colorchoice-1.0.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.colorchoice-1.0.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__compiler_builtins-0.1.160\",\n sha256 = \"6376049cfa92c0aa8b9ac95fae22184b981c658208d4ed8a1dc553cd83612895\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/compiler_builtins/0.1.160/download\"],\n strip_prefix = \"compiler_builtins-0.1.160\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.compiler_builtins-0.1.160.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__const-oid-0.9.6\",\n sha256 = \"c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/const-oid/0.9.6/download\"],\n strip_prefix = \"const-oid-0.9.6\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.const-oid-0.9.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__cortex-m-0.7.7\",\n sha256 = \"8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cortex-m/0.7.7/download\"],\n strip_prefix = \"cortex-m-0.7.7\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.cortex-m-0.7.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__cortex-m-rt-0.7.5\",\n sha256 = \"801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cortex-m-rt/0.7.5/download\"],\n strip_prefix = \"cortex-m-rt-0.7.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.cortex-m-rt-0.7.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__cortex-m-rt-macros-0.7.5\",\n sha256 = \"e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cortex-m-rt-macros/0.7.5/download\"],\n strip_prefix = \"cortex-m-rt-macros-0.7.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.cortex-m-rt-macros-0.7.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__cortex-m-semihosting-0.5.0\",\n sha256 = \"c23234600452033cc77e4b761e740e02d2c4168e11dbf36ab14a0f58973592b0\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cortex-m-semihosting/0.5.0/download\"],\n strip_prefix = \"cortex-m-semihosting-0.5.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.cortex-m-semihosting-0.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__cpufeatures-0.2.17\",\n sha256 = \"59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cpufeatures/0.2.17/download\"],\n strip_prefix = \"cpufeatures-0.2.17\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.cpufeatures-0.2.17.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__crc-3.4.0\",\n sha256 = \"5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/crc/3.4.0/download\"],\n strip_prefix = \"crc-3.4.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.crc-3.4.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__crc-catalog-2.5.0\",\n sha256 = \"217698eaf96b4a3f0bc4f3662aaa55bdf913cd54d7204591faa790070c6d0853\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/crc-catalog/2.5.0/download\"],\n strip_prefix = \"crc-catalog-2.5.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.crc-catalog-2.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__crc32fast-1.5.0\",\n sha256 = \"9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/crc32fast/1.5.0/download\"],\n strip_prefix = \"crc32fast-1.5.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.crc32fast-1.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__critical-section-1.2.0\",\n sha256 = \"790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/critical-section/1.2.0/download\"],\n strip_prefix = \"critical-section-1.2.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.critical-section-1.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__crypto-bigint-0.5.5\",\n sha256 = \"0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/crypto-bigint/0.5.5/download\"],\n strip_prefix = \"crypto-bigint-0.5.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.crypto-bigint-0.5.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__crypto-common-0.1.7\",\n sha256 = \"78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/crypto-common/0.1.7/download\"],\n strip_prefix = \"crypto-common-0.1.7\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.crypto-common-0.1.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__ctr-0.9.2\",\n sha256 = \"0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ctr/0.9.2/download\"],\n strip_prefix = \"ctr-0.9.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.ctr-0.9.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__der-0.7.10\",\n sha256 = \"e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/der/0.7.10/download\"],\n strip_prefix = \"der-0.7.10\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.der-0.7.10.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__digest-0.10.7\",\n sha256 = \"9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/digest/0.10.7/download\"],\n strip_prefix = \"digest-0.10.7\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.digest-0.10.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__ecdsa-0.16.9\",\n sha256 = \"ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ecdsa/0.16.9/download\"],\n strip_prefix = \"ecdsa-0.16.9\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.ecdsa-0.16.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__either-1.16.0\",\n sha256 = \"91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/either/1.16.0/download\"],\n strip_prefix = \"either-1.16.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.either-1.16.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__elliptic-curve-0.13.8\",\n sha256 = \"b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/elliptic-curve/0.13.8/download\"],\n strip_prefix = \"elliptic-curve-0.13.8\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.elliptic-curve-0.13.8.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__embedded-crc-macros-1.0.0\",\n sha256 = \"4f1c75747a43b086df1a87fb2a889590bc0725e0abf54bba6d0c4bf7bd9e762c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-crc-macros/1.0.0/download\"],\n strip_prefix = \"embedded-crc-macros-1.0.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.embedded-crc-macros-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__embedded-hal-0.2.7\",\n sha256 = \"35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-hal/0.2.7/download\"],\n strip_prefix = \"embedded-hal-0.2.7\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.embedded-hal-0.2.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__embedded-hal-1.0.0\",\n sha256 = \"361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-hal/1.0.0/download\"],\n strip_prefix = \"embedded-hal-1.0.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.embedded-hal-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__embedded-hal-async-1.0.0\",\n sha256 = \"0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-hal-async/1.0.0/download\"],\n strip_prefix = \"embedded-hal-async-1.0.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.embedded-hal-async-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__embedded-hal-nb-1.0.0\",\n sha256 = \"fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-hal-nb/1.0.0/download\"],\n strip_prefix = \"embedded-hal-nb-1.0.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.embedded-hal-nb-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__embedded-io-0.6.1\",\n sha256 = \"edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-io/0.6.1/download\"],\n strip_prefix = \"embedded-io-0.6.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.embedded-io-0.6.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__embedded-io-async-0.6.1\",\n sha256 = \"3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-io-async/0.6.1/download\"],\n strip_prefix = \"embedded-io-async-0.6.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.embedded-io-async-0.6.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__embedded-storage-0.3.1\",\n sha256 = \"a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-storage/0.3.1/download\"],\n strip_prefix = \"embedded-storage-0.3.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.embedded-storage-0.3.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__equivalent-1.0.2\",\n sha256 = \"877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/equivalent/1.0.2/download\"],\n strip_prefix = \"equivalent-1.0.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.equivalent-1.0.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__errno-0.3.14\",\n sha256 = \"39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/errno/0.3.14/download\"],\n strip_prefix = \"errno-0.3.14\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.errno-0.3.14.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__ff-0.13.1\",\n sha256 = \"c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ff/0.13.1/download\"],\n strip_prefix = \"ff-0.13.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.ff-0.13.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__flate2-1.1.9\",\n sha256 = \"843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/flate2/1.1.9/download\"],\n strip_prefix = \"flate2-1.1.9\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.flate2-1.1.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__foldhash-0.1.5\",\n sha256 = \"d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/foldhash/0.1.5/download\"],\n strip_prefix = \"foldhash-0.1.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.foldhash-0.1.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__fugit-0.3.9\",\n sha256 = \"4e639847d312d9a82d2e75b0edcc1e934efcc64e6cb7aa94f0b1fbec0bc231d6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/fugit/0.3.9/download\"],\n strip_prefix = \"fugit-0.3.9\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.fugit-0.3.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__futures-0.3.32\",\n sha256 = \"8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures/0.3.32/download\"],\n strip_prefix = \"futures-0.3.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.futures-0.3.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__futures-channel-0.3.32\",\n sha256 = \"07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-channel/0.3.32/download\"],\n strip_prefix = \"futures-channel-0.3.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.futures-channel-0.3.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__futures-core-0.3.32\",\n sha256 = \"7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-core/0.3.32/download\"],\n strip_prefix = \"futures-core-0.3.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.futures-core-0.3.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__futures-executor-0.3.32\",\n sha256 = \"baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-executor/0.3.32/download\"],\n strip_prefix = \"futures-executor-0.3.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.futures-executor-0.3.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__futures-io-0.3.32\",\n sha256 = \"cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-io/0.3.32/download\"],\n strip_prefix = \"futures-io-0.3.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.futures-io-0.3.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__futures-macro-0.3.32\",\n sha256 = \"e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-macro/0.3.32/download\"],\n strip_prefix = \"futures-macro-0.3.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.futures-macro-0.3.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__futures-sink-0.3.32\",\n sha256 = \"c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-sink/0.3.32/download\"],\n strip_prefix = \"futures-sink-0.3.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.futures-sink-0.3.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__futures-task-0.3.32\",\n sha256 = \"037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-task/0.3.32/download\"],\n strip_prefix = \"futures-task-0.3.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.futures-task-0.3.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__futures-util-0.3.32\",\n sha256 = \"389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-util/0.3.32/download\"],\n strip_prefix = \"futures-util-0.3.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.futures-util-0.3.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__gcd-2.3.0\",\n sha256 = \"1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/gcd/2.3.0/download\"],\n strip_prefix = \"gcd-2.3.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.gcd-2.3.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__generic-array-0.14.7\",\n sha256 = \"85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/generic-array/0.14.7/download\"],\n strip_prefix = \"generic-array-0.14.7\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.generic-array-0.14.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__ghash-0.5.1\",\n sha256 = \"f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ghash/0.5.1/download\"],\n strip_prefix = \"ghash-0.5.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.ghash-0.5.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__group-0.13.0\",\n sha256 = \"f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/group/0.13.0/download\"],\n strip_prefix = \"group-0.13.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.group-0.13.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__hash32-0.3.1\",\n sha256 = \"47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hash32/0.3.1/download\"],\n strip_prefix = \"hash32-0.3.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.hash32-0.3.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__hashbrown-0.15.5\",\n sha256 = \"9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hashbrown/0.15.5/download\"],\n strip_prefix = \"hashbrown-0.15.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.hashbrown-0.15.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__hashbrown-0.17.1\",\n sha256 = \"ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hashbrown/0.17.1/download\"],\n strip_prefix = \"hashbrown-0.17.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.hashbrown-0.17.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__heapless-0.8.0\",\n sha256 = \"0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/heapless/0.8.0/download\"],\n strip_prefix = \"heapless-0.8.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.heapless-0.8.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__heapless-0.9.3\",\n sha256 = \"25ba4bd83f9415b58b4ed8dc5714c76e626a105be4646c02630ad730ad3b5aa4\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/heapless/0.9.3/download\"],\n strip_prefix = \"heapless-0.9.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.heapless-0.9.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__heck-0.5.0\",\n sha256 = \"2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/heck/0.5.0/download\"],\n strip_prefix = \"heck-0.5.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.heck-0.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__hex-0.4.3\",\n sha256 = \"7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hex/0.4.3/download\"],\n strip_prefix = \"hex-0.4.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.hex-0.4.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__hex-literal-0.4.1\",\n sha256 = \"6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hex-literal/0.4.1/download\"],\n strip_prefix = \"hex-literal-0.4.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.hex-literal-0.4.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__hmac-0.12.1\",\n sha256 = \"6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hmac/0.12.1/download\"],\n strip_prefix = \"hmac-0.12.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.hmac-0.12.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__indexmap-2.14.0\",\n sha256 = \"d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/indexmap/2.14.0/download\"],\n strip_prefix = \"indexmap-2.14.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.indexmap-2.14.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__inout-0.1.4\",\n sha256 = \"879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/inout/0.1.4/download\"],\n strip_prefix = \"inout-0.1.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.inout-0.1.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__is_terminal_polyfill-1.70.2\",\n sha256 = \"a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/is_terminal_polyfill/1.70.2/download\"],\n strip_prefix = \"is_terminal_polyfill-1.70.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.is_terminal_polyfill-1.70.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__itertools-0.14.0\",\n sha256 = \"2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/itertools/0.14.0/download\"],\n strip_prefix = \"itertools-0.14.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.itertools-0.14.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__k256-0.13.4\",\n sha256 = \"f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/k256/0.13.4/download\"],\n strip_prefix = \"k256-0.13.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.k256-0.13.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__keccak-0.1.6\",\n sha256 = \"cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/keccak/0.1.6/download\"],\n strip_prefix = \"keccak-0.1.6\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.keccak-0.1.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__libc-0.2.186\",\n sha256 = \"68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/libc/0.2.186/download\"],\n strip_prefix = \"libc-0.2.186\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.libc-0.2.186.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__linux-raw-sys-0.12.1\",\n sha256 = \"32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/linux-raw-sys/0.12.1/download\"],\n strip_prefix = \"linux-raw-sys-0.12.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.linux-raw-sys-0.12.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__lock_api-0.4.14\",\n sha256 = \"224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/lock_api/0.4.14/download\"],\n strip_prefix = \"lock_api-0.4.14\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.lock_api-0.4.14.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__log-0.4.32\",\n sha256 = \"953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/log/0.4.32/download\"],\n strip_prefix = \"log-0.4.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.log-0.4.32.bazel\"),\n )\n\n maybe(\n git_repository,\n name = \"rust_crates__mctp-0.2.0\",\n commit = \"5a7b9067b4a4515b05ef8b5f4948ba542e8ae1c9\",\n init_submodules = True,\n remote = \"https://github.com/CodeConstruct/mctp-rs.git\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.mctp-0.2.0.bazel\"),\n strip_prefix = \"mctp\",\n )\n\n maybe(\n git_repository,\n name = \"rust_crates__mctp-estack-0.1.0\",\n commit = \"5a7b9067b4a4515b05ef8b5f4948ba542e8ae1c9\",\n init_submodules = True,\n remote = \"https://github.com/CodeConstruct/mctp-rs.git\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.mctp-estack-0.1.0.bazel\"),\n strip_prefix = \"mctp-estack\",\n )\n\n maybe(\n git_repository,\n name = \"rust_crates__mctp-lib-0.1.0\",\n commit = \"742fa0e991aa2b87509ff12739e011a674643d91\",\n init_submodules = True,\n remote = \"https://github.com/OpenPRoT/mctp-lib.git\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.mctp-lib-0.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__memchr-2.8.2\",\n sha256 = \"88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/memchr/2.8.2/download\"],\n strip_prefix = \"memchr-2.8.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.memchr-2.8.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__memo-map-0.3.3\",\n sha256 = \"38d1115007560874e373613744c6fba374c17688327a71c1476d1a5954cc857b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/memo-map/0.3.3/download\"],\n strip_prefix = \"memo-map-0.3.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.memo-map-0.3.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__memoffset-0.9.1\",\n sha256 = \"488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/memoffset/0.9.1/download\"],\n strip_prefix = \"memoffset-0.9.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.memoffset-0.9.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__minijinja-2.20.0\",\n sha256 = \"2929e494b2280e1e18959bb2e121da03347ae896896fdfaceaab43c88a02803f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/minijinja/2.20.0/download\"],\n strip_prefix = \"minijinja-2.20.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.minijinja-2.20.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__minimal-lexical-0.2.1\",\n sha256 = \"68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/minimal-lexical/0.2.1/download\"],\n strip_prefix = \"minimal-lexical-0.2.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.minimal-lexical-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__miniz_oxide-0.8.9\",\n sha256 = \"1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/miniz_oxide/0.8.9/download\"],\n strip_prefix = \"miniz_oxide-0.8.9\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.miniz_oxide-0.8.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__mio-1.2.1\",\n sha256 = \"02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/mio/1.2.1/download\"],\n strip_prefix = \"mio-1.2.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.mio-1.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__nb-0.1.3\",\n sha256 = \"801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/nb/0.1.3/download\"],\n strip_prefix = \"nb-0.1.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.nb-0.1.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__nb-1.1.0\",\n sha256 = \"8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/nb/1.1.0/download\"],\n strip_prefix = \"nb-1.1.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.nb-1.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__nom-7.1.3\",\n sha256 = \"d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/nom/7.1.3/download\"],\n strip_prefix = \"nom-7.1.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.nom-7.1.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__object-0.37.3\",\n sha256 = \"ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/object/0.37.3/download\"],\n strip_prefix = \"object-0.37.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.object-0.37.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__once_cell_polyfill-1.70.2\",\n sha256 = \"384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/once_cell_polyfill/1.70.2/download\"],\n strip_prefix = \"once_cell_polyfill-1.70.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.once_cell_polyfill-1.70.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__opaque-debug-0.3.1\",\n sha256 = \"c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/opaque-debug/0.3.1/download\"],\n strip_prefix = \"opaque-debug-0.3.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.opaque-debug-0.3.1.bazel\"),\n )\n\n maybe(\n git_repository,\n name = \"rust_crates__openprot-hal-blocking-0.1.0\",\n commit = \"c6cd23a56f3cc7945b062ea1bcdabf3af0dba82d\",\n init_submodules = True,\n remote = \"https://github.com/rusty1968/openprot.git\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.openprot-hal-blocking-0.1.0.bazel\"),\n strip_prefix = \"hal/blocking\",\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__p256-0.13.2\",\n sha256 = \"c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/p256/0.13.2/download\"],\n strip_prefix = \"p256-0.13.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.p256-0.13.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__p384-0.13.1\",\n sha256 = \"fe42f1670a52a47d448f14b6a5c61dd78fce51856e68edaa38f7ae3a46b8d6b6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/p384/0.13.1/download\"],\n strip_prefix = \"p384-0.13.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.p384-0.13.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__panic-halt-1.0.0\",\n sha256 = \"a513e167849a384b7f9b746e517604398518590a9142f4846a32e3c2a4de7b11\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/panic-halt/1.0.0/download\"],\n strip_prefix = \"panic-halt-1.0.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.panic-halt-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__parking_lot-0.12.5\",\n sha256 = \"93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/parking_lot/0.12.5/download\"],\n strip_prefix = \"parking_lot-0.12.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.parking_lot-0.12.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__parking_lot_core-0.9.12\",\n sha256 = \"2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/parking_lot_core/0.9.12/download\"],\n strip_prefix = \"parking_lot_core-0.9.12\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.parking_lot_core-0.9.12.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__paste-1.0.15\",\n sha256 = \"57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/paste/1.0.15/download\"],\n strip_prefix = \"paste-1.0.15\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.paste-1.0.15.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__pest-2.8.6\",\n sha256 = \"e0848c601009d37dfa3430c4666e147e49cdcf1b92ecd3e63657d8a5f19da662\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pest/2.8.6/download\"],\n strip_prefix = \"pest-2.8.6\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.pest-2.8.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__pest_derive-2.8.6\",\n sha256 = \"11f486f1ea21e6c10ed15d5a7c77165d0ee443402f0780849d1768e7d9d6fe77\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pest_derive/2.8.6/download\"],\n strip_prefix = \"pest_derive-2.8.6\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.pest_derive-2.8.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__pest_generator-2.8.6\",\n sha256 = \"8040c4647b13b210a963c1ed407c1ff4fdfa01c31d6d2a098218702e6664f94f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pest_generator/2.8.6/download\"],\n strip_prefix = \"pest_generator-2.8.6\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.pest_generator-2.8.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__pest_meta-2.8.6\",\n sha256 = \"89815c69d36021a140146f26659a81d6c2afa33d216d736dd4be5381a7362220\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pest_meta/2.8.6/download\"],\n strip_prefix = \"pest_meta-2.8.6\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.pest_meta-2.8.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__pin-project-lite-0.2.17\",\n sha256 = \"a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pin-project-lite/0.2.17/download\"],\n strip_prefix = \"pin-project-lite-0.2.17\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.pin-project-lite-0.2.17.bazel\"),\n )\n\n maybe(\n git_repository,\n name = \"rust_crates__pldm-common-0.1.0\",\n commit = \"c709ae4adbc28b168f10e4a4531149abf5116b92\",\n init_submodules = True,\n remote = \"https://github.com/OpenPRoT/pldm-lib.git\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.pldm-common-0.1.0.bazel\"),\n strip_prefix = \"pldm-common\",\n )\n\n maybe(\n git_repository,\n name = \"rust_crates__pldm-interface-0.1.0\",\n commit = \"c709ae4adbc28b168f10e4a4531149abf5116b92\",\n init_submodules = True,\n remote = \"https://github.com/OpenPRoT/pldm-lib.git\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.pldm-interface-0.1.0.bazel\"),\n strip_prefix = \"pldm-interface\",\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__polyval-0.6.2\",\n sha256 = \"9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/polyval/0.6.2/download\"],\n strip_prefix = \"polyval-0.6.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.polyval-0.6.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__primeorder-0.13.6\",\n sha256 = \"353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/primeorder/0.13.6/download\"],\n strip_prefix = \"primeorder-0.13.6\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.primeorder-0.13.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__proc-macro2-1.0.106\",\n sha256 = \"8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/proc-macro2/1.0.106/download\"],\n strip_prefix = \"proc-macro2-1.0.106\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.proc-macro2-1.0.106.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__prost-0.13.5\",\n sha256 = \"2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/prost/0.13.5/download\"],\n strip_prefix = \"prost-0.13.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.prost-0.13.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__prost-derive-0.13.5\",\n sha256 = \"8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/prost-derive/0.13.5/download\"],\n strip_prefix = \"prost-derive-0.13.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.prost-derive-0.13.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__quote-1.0.45\",\n sha256 = \"41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/quote/1.0.45/download\"],\n strip_prefix = \"quote-1.0.45\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.quote-1.0.45.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__rand_core-0.6.4\",\n sha256 = \"ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rand_core/0.6.4/download\"],\n strip_prefix = \"rand_core-0.6.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.rand_core-0.6.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__rand_core-0.9.5\",\n sha256 = \"76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rand_core/0.9.5/download\"],\n strip_prefix = \"rand_core-0.9.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.rand_core-0.9.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__redox_syscall-0.5.18\",\n sha256 = \"ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/redox_syscall/0.5.18/download\"],\n strip_prefix = \"redox_syscall-0.5.18\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.redox_syscall-0.5.18.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__rfc6979-0.4.0\",\n sha256 = \"f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rfc6979/0.4.0/download\"],\n strip_prefix = \"rfc6979-0.4.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.rfc6979-0.4.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__riscv-0.11.1\",\n sha256 = \"2f5c1b8bf41ea746266cdee443d1d1e9125c86ce1447e1a2615abd34330d33a9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv/0.11.1/download\"],\n strip_prefix = \"riscv-0.11.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.riscv-0.11.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__riscv-0.12.1\",\n sha256 = \"5ea8ff73d3720bdd0a97925f0bf79ad2744b6da8ff36be3840c48ac81191d7a7\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv/0.12.1/download\"],\n strip_prefix = \"riscv-0.12.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.riscv-0.12.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__riscv-0.13.0\",\n sha256 = \"afa3cdbeccae4359f6839a00e8b77e5736caa200ba216caf38d24e4c16e2b586\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv/0.13.0/download\"],\n strip_prefix = \"riscv-0.13.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.riscv-0.13.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__riscv-macros-0.1.0\",\n sha256 = \"f265be5d634272320a7de94cea15c22a3bfdd4eb42eb43edc528415f066a1f25\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-macros/0.1.0/download\"],\n strip_prefix = \"riscv-macros-0.1.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.riscv-macros-0.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__riscv-macros-0.2.0\",\n sha256 = \"e8c4aa1ea1af6dcc83a61be12e8189f9b293c3ba5a487778a4cd89fb060fdbbc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-macros/0.2.0/download\"],\n strip_prefix = \"riscv-macros-0.2.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.riscv-macros-0.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__riscv-pac-0.2.0\",\n sha256 = \"8188909339ccc0c68cfb5a04648313f09621e8b87dc03095454f1a11f6c5d436\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-pac/0.2.0/download\"],\n strip_prefix = \"riscv-pac-0.2.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.riscv-pac-0.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__riscv-rt-0.12.2\",\n sha256 = \"c0d35e32cf1383183e8885d8a9aa4402a087fd094dc34c2cb6df6687d0229dfe\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-rt/0.12.2/download\"],\n strip_prefix = \"riscv-rt-0.12.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.riscv-rt-0.12.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__riscv-rt-macros-0.2.2\",\n sha256 = \"30f19a85fe107b65031e0ba8ec60c34c2494069fe910d6c297f5e7cb5a6f76d0\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-rt-macros/0.2.2/download\"],\n strip_prefix = \"riscv-rt-macros-0.2.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.riscv-rt-macros-0.2.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__riscv-semihosting-0.1.3\",\n sha256 = \"1086dd4bcc13de1cb14b93849411e3466de7e5907d2d8eb269032536e93facc6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-semihosting/0.1.3/download\"],\n strip_prefix = \"riscv-semihosting-0.1.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.riscv-semihosting-0.1.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__rustc-demangle-0.1.27\",\n sha256 = \"b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rustc-demangle/0.1.27/download\"],\n strip_prefix = \"rustc-demangle-0.1.27\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.rustc-demangle-0.1.27.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__rustc_version-0.2.3\",\n sha256 = \"138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rustc_version/0.2.3/download\"],\n strip_prefix = \"rustc_version-0.2.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.rustc_version-0.2.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__rustix-1.1.4\",\n sha256 = \"b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rustix/1.1.4/download\"],\n strip_prefix = \"rustix-1.1.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.rustix-1.1.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__ruzstd-0.8.3\",\n sha256 = \"a7c1c839d570d835527c9a5e4db7cb2198683a988cb9d7293fc8674e6bd58fc8\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ruzstd/0.8.3/download\"],\n strip_prefix = \"ruzstd-0.8.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.ruzstd-0.8.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__scopeguard-1.2.0\",\n sha256 = \"94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/scopeguard/1.2.0/download\"],\n strip_prefix = \"scopeguard-1.2.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.scopeguard-1.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__sec1-0.7.3\",\n sha256 = \"d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/sec1/0.7.3/download\"],\n strip_prefix = \"sec1-0.7.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.sec1-0.7.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__semver-0.9.0\",\n sha256 = \"1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/semver/0.9.0/download\"],\n strip_prefix = \"semver-0.9.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.semver-0.9.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__semver-parser-0.7.0\",\n sha256 = \"388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/semver-parser/0.7.0/download\"],\n strip_prefix = \"semver-parser-0.7.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.semver-parser-0.7.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__serde-1.0.228\",\n sha256 = \"9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde/1.0.228/download\"],\n strip_prefix = \"serde-1.0.228\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.serde-1.0.228.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__serde_core-1.0.228\",\n sha256 = \"41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde_core/1.0.228/download\"],\n strip_prefix = \"serde_core-1.0.228\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.serde_core-1.0.228.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__serde_derive-1.0.228\",\n sha256 = \"d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde_derive/1.0.228/download\"],\n strip_prefix = \"serde_derive-1.0.228\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.serde_derive-1.0.228.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__serde_json5-0.2.1\",\n sha256 = \"5d34d03f54462862f2a42918391c9526337f53171eaa4d8894562be7f252edd3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde_json5/0.2.1/download\"],\n strip_prefix = \"serde_json5-0.2.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.serde_json5-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__sha2-0.10.9\",\n sha256 = \"a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/sha2/0.10.9/download\"],\n strip_prefix = \"sha2-0.10.9\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.sha2-0.10.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__sha3-0.10.9\",\n sha256 = \"77fd7028345d415a4034cf8777cd4f8ab1851274233b45f84e3d955502d93874\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/sha3/0.10.9/download\"],\n strip_prefix = \"sha3-0.10.9\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.sha3-0.10.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__signal-hook-registry-1.4.8\",\n sha256 = \"c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/signal-hook-registry/1.4.8/download\"],\n strip_prefix = \"signal-hook-registry-1.4.8\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.signal-hook-registry-1.4.8.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__signature-2.2.0\",\n sha256 = \"77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/signature/2.2.0/download\"],\n strip_prefix = \"signature-2.2.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.signature-2.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__simd-adler32-0.3.9\",\n sha256 = \"703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/simd-adler32/0.3.9/download\"],\n strip_prefix = \"simd-adler32-0.3.9\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.simd-adler32-0.3.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__slab-0.4.12\",\n sha256 = \"0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/slab/0.4.12/download\"],\n strip_prefix = \"slab-0.4.12\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.slab-0.4.12.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__smallvec-1.15.2\",\n sha256 = \"8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/smallvec/1.15.2/download\"],\n strip_prefix = \"smallvec-1.15.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.smallvec-1.15.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__smbus-pec-1.0.1\",\n sha256 = \"ca0763a680cd5d72b28f7bfc8a054c117d8841380a6ad4f72f05bd2a34217d3e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/smbus-pec/1.0.1/download\"],\n strip_prefix = \"smbus-pec-1.0.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.smbus-pec-1.0.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__smlang-0.8.0\",\n sha256 = \"1de84f9f80bbe6272174e2bfdb8cf7ce4815b218038a42161c2f21c1d872c215\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/smlang/0.8.0/download\"],\n strip_prefix = \"smlang-0.8.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.smlang-0.8.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__smlang-macros-0.8.0\",\n sha256 = \"231b4425dcc43afc7e18c34e7c6738cd252d42d91d909c948df14107c9ae79f1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/smlang-macros/0.8.0/download\"],\n strip_prefix = \"smlang-macros-0.8.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.smlang-macros-0.8.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__socket2-0.6.4\",\n sha256 = \"52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/socket2/0.6.4/download\"],\n strip_prefix = \"socket2-0.6.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.socket2-0.6.4.bazel\"),\n )\n\n maybe(\n git_repository,\n name = \"rust_crates__spdm-lib-0.1.0\",\n commit = \"41d81717f5d2b4d6b004819a829ae015e44febce\",\n init_submodules = True,\n remote = \"https://github.com/OpenPRoT/spdm-lib.git\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.spdm-lib-0.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__stable_deref_trait-1.2.1\",\n sha256 = \"6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/stable_deref_trait/1.2.1/download\"],\n strip_prefix = \"stable_deref_trait-1.2.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.stable_deref_trait-1.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__string_morph-0.1.0\",\n sha256 = \"183aaf7fa637cc7b5f54c45b8f7cb6e8d73831f9f75a56b6defa5bf8c51d1699\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/string_morph/0.1.0/download\"],\n strip_prefix = \"string_morph-0.1.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.string_morph-0.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__strsim-0.11.1\",\n sha256 = \"7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/strsim/0.11.1/download\"],\n strip_prefix = \"strsim-0.11.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.strsim-0.11.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__subtle-2.6.1\",\n sha256 = \"13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/subtle/2.6.1/download\"],\n strip_prefix = \"subtle-2.6.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.subtle-2.6.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__syn-1.0.109\",\n sha256 = \"72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/syn/1.0.109/download\"],\n strip_prefix = \"syn-1.0.109\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.syn-1.0.109.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__syn-2.0.118\",\n sha256 = \"1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/syn/2.0.118/download\"],\n strip_prefix = \"syn-2.0.118\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.syn-2.0.118.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__terminal_size-0.4.4\",\n sha256 = \"230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/terminal_size/0.4.4/download\"],\n strip_prefix = \"terminal_size-0.4.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.terminal_size-0.4.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__thiserror-2.0.18\",\n sha256 = \"4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/thiserror/2.0.18/download\"],\n strip_prefix = \"thiserror-2.0.18\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.thiserror-2.0.18.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__thiserror-impl-2.0.18\",\n sha256 = \"ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/thiserror-impl/2.0.18/download\"],\n strip_prefix = \"thiserror-impl-2.0.18\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.thiserror-impl-2.0.18.bazel\"),\n )\n\n maybe(\n git_repository,\n name = \"rust_crates__tock-registers-0.9.0\",\n commit = \"9554639b17501a9f5940cef7a1770a0823e790c3\",\n init_submodules = True,\n remote = \"https://github.com/tock/tock.git\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.tock-registers-0.9.0.bazel\"),\n strip_prefix = \"libraries/tock-register-interface\",\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__tokio-1.52.3\",\n sha256 = \"8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/tokio/1.52.3/download\"],\n strip_prefix = \"tokio-1.52.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.tokio-1.52.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__tokio-macros-2.7.0\",\n sha256 = \"385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/tokio-macros/2.7.0/download\"],\n strip_prefix = \"tokio-macros-2.7.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.tokio-macros-2.7.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__tokio-util-0.7.18\",\n sha256 = \"9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/tokio-util/0.7.18/download\"],\n strip_prefix = \"tokio-util-0.7.18\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.tokio-util-0.7.18.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__twox-hash-2.1.2\",\n sha256 = \"9ea3136b675547379c4bd395ca6b938e5ad3c3d20fad76e7fe85f9e0d011419c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/twox-hash/2.1.2/download\"],\n strip_prefix = \"twox-hash-2.1.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.twox-hash-2.1.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__typenum-1.20.1\",\n sha256 = \"b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/typenum/1.20.1/download\"],\n strip_prefix = \"typenum-1.20.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.typenum-1.20.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__ucd-trie-0.1.7\",\n sha256 = \"2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ucd-trie/0.1.7/download\"],\n strip_prefix = \"ucd-trie-0.1.7\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.ucd-trie-0.1.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__unicode-ident-1.0.24\",\n sha256 = \"e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicode-ident/1.0.24/download\"],\n strip_prefix = \"unicode-ident-1.0.24\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.unicode-ident-1.0.24.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__universal-hash-0.5.1\",\n sha256 = \"fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/universal-hash/0.5.1/download\"],\n strip_prefix = \"universal-hash-0.5.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.universal-hash-0.5.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__utf8parse-0.2.2\",\n sha256 = \"06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/utf8parse/0.2.2/download\"],\n strip_prefix = \"utf8parse-0.2.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.utf8parse-0.2.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__uuid-1.23.3\",\n sha256 = \"144d6b123cef80b301b8f72a9e2ca4370ddec21950d0a103dd22c437006d2db7\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/uuid/1.23.3/download\"],\n strip_prefix = \"uuid-1.23.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.uuid-1.23.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__vcell-0.1.3\",\n sha256 = \"77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/vcell/0.1.3/download\"],\n strip_prefix = \"vcell-0.1.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.vcell-0.1.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__version_check-0.9.5\",\n sha256 = \"0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/version_check/0.9.5/download\"],\n strip_prefix = \"version_check-0.9.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.version_check-0.9.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__void-1.0.2\",\n sha256 = \"6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/void/1.0.2/download\"],\n strip_prefix = \"void-1.0.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.void-1.0.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__volatile-register-0.2.2\",\n sha256 = \"de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/volatile-register/0.2.2/download\"],\n strip_prefix = \"volatile-register-0.2.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.volatile-register-0.2.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__wasi-0.11.1-wasi-snapshot-preview1\",\n sha256 = \"ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/wasi/0.11.1+wasi-snapshot-preview1/download\"],\n strip_prefix = \"wasi-0.11.1+wasi-snapshot-preview1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.wasi-0.11.1+wasi-snapshot-preview1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__windows-link-0.2.1\",\n sha256 = \"f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows-link/0.2.1/download\"],\n strip_prefix = \"windows-link-0.2.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.windows-link-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__windows-sys-0.61.2\",\n sha256 = \"ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows-sys/0.61.2/download\"],\n strip_prefix = \"windows-sys-0.61.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.windows-sys-0.61.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__zerocopy-0.8.52\",\n sha256 = \"ce1022995ff5ff5d841ad7d994facc23098cd40152f2c1d11cd607c6f530653f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zerocopy/0.8.52/download\"],\n strip_prefix = \"zerocopy-0.8.52\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.zerocopy-0.8.52.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__zerocopy-derive-0.8.52\",\n sha256 = \"1ae7f38b72ec2a254e2b87ef277cf2cd4fb97cbebf944faa6f33354da0867930\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zerocopy-derive/0.8.52/download\"],\n strip_prefix = \"zerocopy-derive-0.8.52\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.zerocopy-derive-0.8.52.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__zeroize-1.9.0\",\n sha256 = \"e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zeroize/1.9.0/download\"],\n strip_prefix = \"zeroize-1.9.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.zeroize-1.9.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__zeroize_derive-1.5.0\",\n sha256 = \"3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zeroize_derive/1.5.0/download\"],\n strip_prefix = \"zeroize_derive-1.5.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.zeroize_derive-1.5.0.bazel\"),\n )\n\n return [\n struct(repo=\"rust_crates__aes-0.8.4\", is_dev_dep = False),\n struct(repo=\"rust_crates__aes-gcm-0.10.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__aligned-0.4.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__anyhow-1.0.103\", is_dev_dep = False),\n struct(repo=\"rust_crates__bitfield-0.14.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__bitfield-struct-0.11.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__bitflags-2.13.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__byteorder-1.5.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__cfg-if-1.0.4\", is_dev_dep = False),\n struct(repo=\"rust_crates__cipher-0.4.4\", is_dev_dep = False),\n struct(repo=\"rust_crates__clap-4.6.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__compiler_builtins-0.1.160\", is_dev_dep = False),\n struct(repo=\"rust_crates__cortex-m-0.7.7\", is_dev_dep = False),\n struct(repo=\"rust_crates__cortex-m-rt-0.7.5\", is_dev_dep = False),\n struct(repo=\"rust_crates__cortex-m-semihosting-0.5.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__critical-section-1.2.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__ctr-0.9.2\", is_dev_dep = False),\n struct(repo=\"rust_crates__ecdsa-0.16.9\", is_dev_dep = False),\n struct(repo=\"rust_crates__embedded-hal-1.0.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__embedded-hal-async-1.0.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__embedded-hal-nb-1.0.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__embedded-io-0.6.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__embedded-storage-0.3.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__fugit-0.3.9\", is_dev_dep = False),\n struct(repo=\"rust_crates__futures-0.3.32\", is_dev_dep = False),\n struct(repo=\"rust_crates__heapless-0.9.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__hex-0.4.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__hex-literal-0.4.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__hmac-0.12.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__k256-0.13.4\", is_dev_dep = False),\n struct(repo=\"rust_crates__log-0.4.32\", is_dev_dep = False),\n struct(repo=\"rust_crates__mctp-0.2.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__mctp-lib-0.1.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__memoffset-0.9.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__minijinja-2.20.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__nb-1.1.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__nom-7.1.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__object-0.37.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__openprot-hal-blocking-0.1.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__p256-0.13.2\", is_dev_dep = False),\n struct(repo=\"rust_crates__p384-0.13.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__panic-halt-1.0.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__paste-1.0.15\", is_dev_dep = False),\n struct(repo=\"rust_crates__pldm-common-0.1.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__pldm-interface-0.1.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__proc-macro2-1.0.106\", is_dev_dep = False),\n struct(repo=\"rust_crates__prost-0.13.5\", is_dev_dep = False),\n struct(repo=\"rust_crates__quote-1.0.45\", is_dev_dep = False),\n struct(repo=\"rust_crates__rand_core-0.9.5\", is_dev_dep = False),\n struct(repo=\"rust_crates__riscv-0.12.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__riscv-rt-0.12.2\", is_dev_dep = False),\n struct(repo=\"rust_crates__riscv-semihosting-0.1.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__rustc-demangle-0.1.27\", is_dev_dep = False),\n struct(repo=\"rust_crates__sec1-0.7.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__serde-1.0.228\", is_dev_dep = False),\n struct(repo=\"rust_crates__serde_derive-1.0.228\", is_dev_dep = False),\n struct(repo=\"rust_crates__serde_json5-0.2.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__sha2-0.10.9\", is_dev_dep = False),\n struct(repo=\"rust_crates__sha3-0.10.9\", is_dev_dep = False),\n struct(repo=\"rust_crates__smlang-0.8.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__spdm-lib-0.1.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__subtle-2.6.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__syn-1.0.109\", is_dev_dep = False),\n struct(repo=\"rust_crates__syn-2.0.118\", is_dev_dep = False),\n struct(repo=\"rust_crates__thiserror-2.0.18\", is_dev_dep = False),\n struct(repo=\"rust_crates__tock-registers-0.9.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__tokio-1.52.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__tokio-util-0.7.18\", is_dev_dep = False),\n struct(repo=\"rust_crates__vcell-0.1.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__zerocopy-0.8.52\", is_dev_dep = False),\n struct(repo=\"rust_crates__zeroize-1.9.0\", is_dev_dep = False),\n ]\n" + "defs.bzl": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\"\"\"\n# `crates_repository` API\n\n- [aliases](#aliases)\n- [crate_deps](#crate_deps)\n- [all_crate_deps](#all_crate_deps)\n- [crate_repositories](#crate_repositories)\n\n\"\"\"\n\nload(\"@bazel_tools//tools/build_defs/repo:git.bzl\", \"git_repository\")\nload(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\")\nload(\"@bazel_tools//tools/build_defs/repo:utils.bzl\", \"maybe\")\nload(\"@bazel_skylib//lib:selects.bzl\", \"selects\")\nload(\"@rules_rust//crate_universe/private:local_crate_mirror.bzl\", \"local_crate_mirror\")\n\n###############################################################################\n# MACROS API\n###############################################################################\n\n# An identifier that represent common dependencies (unconditional).\n_COMMON_CONDITION = \"\"\n\ndef _flatten_dependency_maps(all_dependency_maps):\n \"\"\"Flatten a list of dependency maps into one dictionary.\n\n Dependency maps have the following structure:\n\n ```python\n DEPENDENCIES_MAP = {\n # The first key in the map is a Bazel package\n # name of the workspace this file is defined in.\n \"workspace_member_package\": {\n\n # Not all dependencies are supported for all platforms.\n # the condition key is the condition required to be true\n # on the host platform.\n \"condition\": {\n\n # An alias to a crate target. # The label of the crate target the\n # Aliases are only crate names. # package name refers to.\n \"package_name\": \"@full//:label\",\n }\n }\n }\n ```\n\n Args:\n all_dependency_maps (list): A list of dicts as described above\n\n Returns:\n dict: A dictionary as described above\n \"\"\"\n dependencies = {}\n\n for workspace_deps_map in all_dependency_maps:\n for pkg_name, conditional_deps_map in workspace_deps_map.items():\n if pkg_name not in dependencies:\n non_frozen_map = dict()\n for key, values in conditional_deps_map.items():\n non_frozen_map.update({key: dict(values.items())})\n dependencies.setdefault(pkg_name, non_frozen_map)\n continue\n\n for condition, deps_map in conditional_deps_map.items():\n # If the condition has not been recorded, do so and continue\n if condition not in dependencies[pkg_name]:\n dependencies[pkg_name].setdefault(condition, dict(deps_map.items()))\n continue\n\n # Alert on any miss-matched dependencies\n inconsistent_entries = []\n for crate_name, crate_label in deps_map.items():\n existing = dependencies[pkg_name][condition].get(crate_name)\n if existing and existing != crate_label:\n inconsistent_entries.append((crate_name, existing, crate_label))\n dependencies[pkg_name][condition].update({crate_name: crate_label})\n\n return dependencies\n\ndef crate_deps(deps, package_name = None):\n \"\"\"Finds the fully qualified label of the requested crates for the package where this macro is called.\n\n Args:\n deps (list): The desired list of crate targets.\n package_name (str, optional): The package name of the set of dependencies to look up.\n Defaults to `native.package_name()`.\n\n Returns:\n list: A list of labels to generated rust targets (str)\n \"\"\"\n\n if not deps:\n return []\n\n if package_name == None:\n package_name = native.package_name()\n\n # Join both sets of dependencies\n dependencies = _flatten_dependency_maps([\n _NORMAL_DEPENDENCIES,\n _NORMAL_DEV_DEPENDENCIES,\n _PROC_MACRO_DEPENDENCIES,\n _PROC_MACRO_DEV_DEPENDENCIES,\n _BUILD_DEPENDENCIES,\n _BUILD_PROC_MACRO_DEPENDENCIES,\n ]).pop(package_name, {})\n\n # Combine all conditional packages so we can easily index over a flat list\n # TODO: Perhaps this should actually return select statements and maintain\n # the conditionals of the dependencies\n flat_deps = {}\n for deps_set in dependencies.values():\n for crate_name, crate_label in deps_set.items():\n flat_deps.update({crate_name: crate_label})\n\n missing_crates = []\n crate_targets = []\n for crate_target in deps:\n if crate_target not in flat_deps:\n missing_crates.append(crate_target)\n else:\n crate_targets.append(flat_deps[crate_target])\n\n if missing_crates:\n fail(\"Could not find crates `{}` among dependencies of `{}`. Available dependencies were `{}`\".format(\n missing_crates,\n package_name,\n dependencies,\n ))\n\n return crate_targets\n\ndef all_crate_deps(\n normal = False, \n normal_dev = False, \n proc_macro = False, \n proc_macro_dev = False,\n build = False,\n build_proc_macro = False,\n package_name = None):\n \"\"\"Finds the fully qualified label of all requested direct crate dependencies \\\n for the package where this macro is called.\n\n If no parameters are set, all normal dependencies are returned. Setting any one flag will\n otherwise impact the contents of the returned list.\n\n Args:\n normal (bool, optional): If True, normal dependencies are included in the\n output list.\n normal_dev (bool, optional): If True, normal dev dependencies will be\n included in the output list.\n proc_macro (bool, optional): If True, proc_macro dependencies are included\n in the output list.\n proc_macro_dev (bool, optional): If True, dev proc_macro dependencies are\n included in the output list.\n build (bool, optional): If True, build dependencies are included\n in the output list.\n build_proc_macro (bool, optional): If True, build proc_macro dependencies are\n included in the output list.\n package_name (str, optional): The package name of the set of dependencies to look up.\n Defaults to `native.package_name()` when unset.\n\n Returns:\n list: A list of labels to generated rust targets (str)\n \"\"\"\n\n if package_name == None:\n package_name = native.package_name()\n\n # Determine the relevant maps to use\n all_dependency_maps = []\n if normal:\n all_dependency_maps.append(_NORMAL_DEPENDENCIES)\n if normal_dev:\n all_dependency_maps.append(_NORMAL_DEV_DEPENDENCIES)\n if proc_macro:\n all_dependency_maps.append(_PROC_MACRO_DEPENDENCIES)\n if proc_macro_dev:\n all_dependency_maps.append(_PROC_MACRO_DEV_DEPENDENCIES)\n if build:\n all_dependency_maps.append(_BUILD_DEPENDENCIES)\n if build_proc_macro:\n all_dependency_maps.append(_BUILD_PROC_MACRO_DEPENDENCIES)\n\n # Default to always using normal dependencies\n if not all_dependency_maps:\n all_dependency_maps.append(_NORMAL_DEPENDENCIES)\n\n dependencies = _flatten_dependency_maps(all_dependency_maps).pop(package_name, None)\n\n if not dependencies:\n if dependencies == None:\n fail(\"Tried to get all_crate_deps for package \" + package_name + \" but that package had no Cargo.toml file\")\n else:\n return []\n\n crate_deps = list(dependencies.pop(_COMMON_CONDITION, {}).values())\n for condition, deps in dependencies.items():\n crate_deps += selects.with_or({\n tuple(_CONDITIONS[condition]): deps.values(),\n \"//conditions:default\": [],\n })\n\n return crate_deps\n\ndef aliases(\n normal = False,\n normal_dev = False,\n proc_macro = False,\n proc_macro_dev = False,\n build = False,\n build_proc_macro = False,\n package_name = None):\n \"\"\"Produces a map of Crate alias names to their original label\n\n If no dependency kinds are specified, `normal` and `proc_macro` are used by default.\n Setting any one flag will otherwise determine the contents of the returned dict.\n\n Args:\n normal (bool, optional): If True, normal dependencies are included in the\n output list.\n normal_dev (bool, optional): If True, normal dev dependencies will be\n included in the output list..\n proc_macro (bool, optional): If True, proc_macro dependencies are included\n in the output list.\n proc_macro_dev (bool, optional): If True, dev proc_macro dependencies are\n included in the output list.\n build (bool, optional): If True, build dependencies are included\n in the output list.\n build_proc_macro (bool, optional): If True, build proc_macro dependencies are\n included in the output list.\n package_name (str, optional): The package name of the set of dependencies to look up.\n Defaults to `native.package_name()` when unset.\n\n Returns:\n dict: The aliases of all associated packages\n \"\"\"\n if package_name == None:\n package_name = native.package_name()\n\n # Determine the relevant maps to use\n all_aliases_maps = []\n if normal:\n all_aliases_maps.append(_NORMAL_ALIASES)\n if normal_dev:\n all_aliases_maps.append(_NORMAL_DEV_ALIASES)\n if proc_macro:\n all_aliases_maps.append(_PROC_MACRO_ALIASES)\n if proc_macro_dev:\n all_aliases_maps.append(_PROC_MACRO_DEV_ALIASES)\n if build:\n all_aliases_maps.append(_BUILD_ALIASES)\n if build_proc_macro:\n all_aliases_maps.append(_BUILD_PROC_MACRO_ALIASES)\n\n # Default to always using normal aliases\n if not all_aliases_maps:\n all_aliases_maps.append(_NORMAL_ALIASES)\n all_aliases_maps.append(_PROC_MACRO_ALIASES)\n\n aliases = _flatten_dependency_maps(all_aliases_maps).pop(package_name, None)\n\n if not aliases:\n return dict()\n\n common_items = aliases.pop(_COMMON_CONDITION, {}).items()\n\n # If there are only common items in the dictionary, immediately return them\n if not len(aliases.keys()) == 1:\n return dict(common_items)\n\n # Build a single select statement where each conditional has accounted for the\n # common set of aliases.\n crate_aliases = {\"//conditions:default\": dict(common_items)}\n for condition, deps in aliases.items():\n condition_triples = _CONDITIONS[condition]\n for triple in condition_triples:\n if triple in crate_aliases:\n crate_aliases[triple].update(deps)\n else:\n crate_aliases.update({triple: dict(deps.items() + common_items)})\n\n return select(crate_aliases)\n\n###############################################################################\n# WORKSPACE MEMBER DEPS AND ALIASES\n###############################################################################\n\n_NORMAL_DEPENDENCIES = {\n \"third_party/crates_io\": {\n _COMMON_CONDITION: {\n \"aes\": Label(\"@rust_crates//:aes-0.8.4\"),\n \"aes-gcm\": Label(\"@rust_crates//:aes-gcm-0.10.3\"),\n \"aligned\": Label(\"@rust_crates//:aligned-0.4.3\"),\n \"anyhow\": Label(\"@rust_crates//:anyhow-1.0.103\"),\n \"bitfield\": Label(\"@rust_crates//:bitfield-0.14.0\"),\n \"bitflags\": Label(\"@rust_crates//:bitflags-2.13.0\"),\n \"byteorder\": Label(\"@rust_crates//:byteorder-1.5.0\"),\n \"cfg-if\": Label(\"@rust_crates//:cfg-if-1.0.4\"),\n \"cipher\": Label(\"@rust_crates//:cipher-0.4.4\"),\n \"clap\": Label(\"@rust_crates//:clap-4.6.1\"),\n \"compiler_builtins\": Label(\"@rust_crates//:compiler_builtins-0.1.160\"),\n \"cortex-m\": Label(\"@rust_crates//:cortex-m-0.7.7\"),\n \"cortex-m-rt\": Label(\"@rust_crates//:cortex-m-rt-0.7.5\"),\n \"cortex-m-semihosting\": Label(\"@rust_crates//:cortex-m-semihosting-0.5.0\"),\n \"critical-section\": Label(\"@rust_crates//:critical-section-1.2.0\"),\n \"ctr\": Label(\"@rust_crates//:ctr-0.9.2\"),\n \"ecdsa\": Label(\"@rust_crates//:ecdsa-0.16.9\"),\n \"embedded-hal\": Label(\"@rust_crates//:embedded-hal-1.0.0\"),\n \"embedded-hal-async\": Label(\"@rust_crates//:embedded-hal-async-1.0.0\"),\n \"embedded-hal-nb\": Label(\"@rust_crates//:embedded-hal-nb-1.0.0\"),\n \"embedded-io\": Label(\"@rust_crates//:embedded-io-0.6.1\"),\n \"embedded-storage\": Label(\"@rust_crates//:embedded-storage-0.3.1\"),\n \"fugit\": Label(\"@rust_crates//:fugit-0.3.9\"),\n \"futures\": Label(\"@rust_crates//:futures-0.3.32\"),\n \"heapless\": Label(\"@rust_crates//:heapless-0.9.3\"),\n \"hex\": Label(\"@rust_crates//:hex-0.4.3\"),\n \"hex-literal\": Label(\"@rust_crates//:hex-literal-0.4.1\"),\n \"hmac\": Label(\"@rust_crates//:hmac-0.12.1\"),\n \"k256\": Label(\"@rust_crates//:k256-0.13.4\"),\n \"log\": Label(\"@rust_crates//:log-0.4.32\"),\n \"mctp\": Label(\"@rust_crates//:mctp-0.2.0\"),\n \"mctp-lib\": Label(\"@rust_crates//:mctp-lib-0.1.0\"),\n \"memoffset\": Label(\"@rust_crates//:memoffset-0.9.1\"),\n \"minijinja\": Label(\"@rust_crates//:minijinja-2.20.0\"),\n \"nb\": Label(\"@rust_crates//:nb-1.1.0\"),\n \"nom\": Label(\"@rust_crates//:nom-7.1.3\"),\n \"object\": Label(\"@rust_crates//:object-0.40.0\"),\n \"openprot-hal-blocking\": Label(\"@rust_crates//:openprot-hal-blocking-0.1.0\"),\n \"p256\": Label(\"@rust_crates//:p256-0.13.2\"),\n \"p384\": Label(\"@rust_crates//:p384-0.13.1\"),\n \"panic-halt\": Label(\"@rust_crates//:panic-halt-1.0.0\"),\n \"pldm-common\": Label(\"@rust_crates//:pldm-common-0.1.0\"),\n \"pldm-interface\": Label(\"@rust_crates//:pldm-interface-0.1.0\"),\n \"proc-macro2\": Label(\"@rust_crates//:proc-macro2-1.0.106\"),\n \"prost\": Label(\"@rust_crates//:prost-0.13.5\"),\n \"quote\": Label(\"@rust_crates//:quote-1.0.45\"),\n \"rand_core\": Label(\"@rust_crates//:rand_core-0.9.5\"),\n \"riscv\": Label(\"@rust_crates//:riscv-0.12.1\"),\n \"riscv-rt\": Label(\"@rust_crates//:riscv-rt-0.12.2\"),\n \"riscv-semihosting\": Label(\"@rust_crates//:riscv-semihosting-0.1.3\"),\n \"rustc-demangle\": Label(\"@rust_crates//:rustc-demangle-0.1.27\"),\n \"sec1\": Label(\"@rust_crates//:sec1-0.7.3\"),\n \"serde\": Label(\"@rust_crates//:serde-1.0.228\"),\n \"serde_json5\": Label(\"@rust_crates//:serde_json5-0.2.1\"),\n \"sha2\": Label(\"@rust_crates//:sha2-0.10.9\"),\n \"sha3\": Label(\"@rust_crates//:sha3-0.10.9\"),\n \"smlang\": Label(\"@rust_crates//:smlang-0.8.0\"),\n \"spdm-lib\": Label(\"@rust_crates//:spdm-lib-0.1.0\"),\n \"subtle\": Label(\"@rust_crates//:subtle-2.6.1\"),\n \"syn1\": Label(\"@rust_crates//:syn-1.0.109\"),\n \"syn\": Label(\"@rust_crates//:syn-3.0.5\"),\n \"thiserror\": Label(\"@rust_crates//:thiserror-2.0.18\"),\n \"tock-registers\": Label(\"@rust_crates//:tock-registers-0.9.0\"),\n \"tokio\": Label(\"@rust_crates//:tokio-1.52.3\"),\n \"tokio-util\": Label(\"@rust_crates//:tokio-util-0.7.18\"),\n \"vcell\": Label(\"@rust_crates//:vcell-0.1.3\"),\n \"zerocopy\": Label(\"@rust_crates//:zerocopy-0.8.52\"),\n \"zeroize\": Label(\"@rust_crates//:zeroize-1.9.0\"),\n },\n },\n}\n\n\n_NORMAL_ALIASES = {\n \"third_party/crates_io\": {\n _COMMON_CONDITION: {\n Label(\"@rust_crates//:syn-1.0.109\"): \"syn1\",\n },\n },\n}\n\n\n_NORMAL_DEV_DEPENDENCIES = {\n \"third_party/crates_io\": {\n },\n}\n\n\n_NORMAL_DEV_ALIASES = {\n \"third_party/crates_io\": {\n },\n}\n\n\n_PROC_MACRO_DEPENDENCIES = {\n \"third_party/crates_io\": {\n _COMMON_CONDITION: {\n \"bitfield-struct\": Label(\"@rust_crates//:bitfield-struct-0.11.0\"),\n \"paste\": Label(\"@rust_crates//:paste-1.0.15\"),\n \"serde_derive\": Label(\"@rust_crates//:serde_derive-1.0.228\"),\n },\n },\n}\n\n\n_PROC_MACRO_ALIASES = {\n \"third_party/crates_io\": {\n },\n}\n\n\n_PROC_MACRO_DEV_DEPENDENCIES = {\n \"third_party/crates_io\": {\n },\n}\n\n\n_PROC_MACRO_DEV_ALIASES = {\n \"third_party/crates_io\": {\n },\n}\n\n\n_BUILD_DEPENDENCIES = {\n \"third_party/crates_io\": {\n },\n}\n\n\n_BUILD_ALIASES = {\n \"third_party/crates_io\": {\n },\n}\n\n\n_BUILD_PROC_MACRO_DEPENDENCIES = {\n \"third_party/crates_io\": {\n },\n}\n\n\n_BUILD_PROC_MACRO_ALIASES = {\n \"third_party/crates_io\": {\n },\n}\n\n\n_CONDITIONS = {\n \"aarch64-apple-darwin\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\"],\n \"aarch64-linux-android\": [],\n \"aarch64-unknown-linux-gnu\": [\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\"],\n \"cfg(all(any(target_os = \\\"linux\\\", target_os = \\\"android\\\"), any(rustix_use_libc, miri, not(all(target_os = \\\"linux\\\", any(target_endian = \\\"little\\\", any(target_arch = \\\"s390x\\\", target_arch = \\\"powerpc\\\")), any(target_arch = \\\"arm\\\", all(target_arch = \\\"aarch64\\\", target_pointer_width = \\\"64\\\"), target_arch = \\\"riscv64\\\", all(rustix_use_experimental_asm, target_arch = \\\"powerpc\\\"), all(rustix_use_experimental_asm, target_arch = \\\"powerpc64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"s390x\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips32r6\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64r6\\\"), target_arch = \\\"x86\\\", all(target_arch = \\\"x86_64\\\", target_pointer_width = \\\"64\\\")))))))\": [],\n \"cfg(all(not(rustix_use_libc), not(miri), target_os = \\\"linux\\\", any(target_endian = \\\"little\\\", any(target_arch = \\\"s390x\\\", target_arch = \\\"powerpc\\\")), any(target_arch = \\\"arm\\\", all(target_arch = \\\"aarch64\\\", target_pointer_width = \\\"64\\\"), target_arch = \\\"riscv64\\\", all(rustix_use_experimental_asm, target_arch = \\\"powerpc\\\"), all(rustix_use_experimental_asm, target_arch = \\\"powerpc64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"s390x\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips32r6\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64r6\\\"), target_arch = \\\"x86\\\", all(target_arch = \\\"x86_64\\\", target_pointer_width = \\\"64\\\"))))\": [\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \\\"linux\\\", any(target_endian = \\\"little\\\", any(target_arch = \\\"s390x\\\", target_arch = \\\"powerpc\\\")), any(target_arch = \\\"arm\\\", all(target_arch = \\\"aarch64\\\", target_pointer_width = \\\"64\\\"), target_arch = \\\"riscv64\\\", all(rustix_use_experimental_asm, target_arch = \\\"powerpc\\\"), all(rustix_use_experimental_asm, target_arch = \\\"powerpc64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"s390x\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips32r6\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64r6\\\"), target_arch = \\\"x86\\\", all(target_arch = \\\"x86_64\\\", target_pointer_width = \\\"64\\\")))))))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\",\"@rules_rust//rust/platform:thumbv7em-none-eabi\",\"@rules_rust//rust/platform:x86_64-apple-darwin\"],\n \"cfg(all(target_arch = \\\"aarch64\\\", target_os = \\\"linux\\\"))\": [\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\"],\n \"cfg(all(target_arch = \\\"aarch64\\\", target_vendor = \\\"apple\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\"],\n \"cfg(all(target_arch = \\\"loongarch64\\\", target_os = \\\"linux\\\"))\": [],\n \"cfg(any())\": [],\n \"cfg(any(target_arch = \\\"aarch64\\\", target_arch = \\\"x86_64\\\", target_arch = \\\"x86\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(any(target_arch = \\\"arm\\\", target_pointer_width = \\\"32\\\", target_pointer_width = \\\"64\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\",\"@rules_rust//rust/platform:thumbv7em-none-eabi\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(any(unix, target_os = \\\"hermit\\\", target_os = \\\"wasi\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(any(unix, target_os = \\\"wasi\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(target_arch = \\\"aarch64\\\")\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\"],\n \"cfg(target_os = \\\"hermit\\\")\": [],\n \"cfg(target_os = \\\"redox\\\")\": [],\n \"cfg(target_os = \\\"wasi\\\")\": [],\n \"cfg(unix)\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(windows)\": [],\n \"riscv32imc-unknown-none-elf\": [\"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\"],\n \"thumbv7em-none-eabi\": [\"@rules_rust//rust/platform:thumbv7em-none-eabi\"],\n \"x86_64-apple-darwin\": [\"@rules_rust//rust/platform:x86_64-apple-darwin\"],\n \"x86_64-unknown-linux-gnu\": [\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n}\n\n###############################################################################\n\ndef crate_repositories():\n \"\"\"A macro for defining repositories for all generated crates.\n\n Returns:\n A list of repos visible to the module through the module extension.\n \"\"\"\n maybe(\n http_archive,\n name = \"rust_crates__adler2-2.0.1\",\n sha256 = \"320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/adler2/2.0.1/download\"],\n strip_prefix = \"adler2-2.0.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.adler2-2.0.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__aead-0.5.2\",\n sha256 = \"d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/aead/0.5.2/download\"],\n strip_prefix = \"aead-0.5.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.aead-0.5.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__aes-0.8.4\",\n sha256 = \"b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/aes/0.8.4/download\"],\n strip_prefix = \"aes-0.8.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.aes-0.8.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__aes-gcm-0.10.3\",\n sha256 = \"831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/aes-gcm/0.10.3/download\"],\n strip_prefix = \"aes-gcm-0.10.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.aes-gcm-0.10.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__aligned-0.4.3\",\n sha256 = \"ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/aligned/0.4.3/download\"],\n strip_prefix = \"aligned-0.4.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.aligned-0.4.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__anstream-1.0.0\",\n sha256 = \"824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstream/1.0.0/download\"],\n strip_prefix = \"anstream-1.0.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.anstream-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__anstyle-1.0.14\",\n sha256 = \"940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstyle/1.0.14/download\"],\n strip_prefix = \"anstyle-1.0.14\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.anstyle-1.0.14.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__anstyle-parse-1.0.0\",\n sha256 = \"52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstyle-parse/1.0.0/download\"],\n strip_prefix = \"anstyle-parse-1.0.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.anstyle-parse-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__anstyle-query-1.1.5\",\n sha256 = \"40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstyle-query/1.1.5/download\"],\n strip_prefix = \"anstyle-query-1.1.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.anstyle-query-1.1.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__anstyle-wincon-3.0.11\",\n sha256 = \"291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstyle-wincon/3.0.11/download\"],\n strip_prefix = \"anstyle-wincon-3.0.11\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.anstyle-wincon-3.0.11.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__anyhow-1.0.103\",\n sha256 = \"2a4385e2e34eb35d6b3efe798b9eb88096925d87726c0798709bf56d9ed84af3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anyhow/1.0.103/download\"],\n strip_prefix = \"anyhow-1.0.103\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.anyhow-1.0.103.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__as-slice-0.2.1\",\n sha256 = \"516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/as-slice/0.2.1/download\"],\n strip_prefix = \"as-slice-0.2.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.as-slice-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__autocfg-1.5.1\",\n sha256 = \"f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/autocfg/1.5.1/download\"],\n strip_prefix = \"autocfg-1.5.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.autocfg-1.5.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__bare-metal-0.2.5\",\n sha256 = \"5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bare-metal/0.2.5/download\"],\n strip_prefix = \"bare-metal-0.2.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.bare-metal-0.2.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__base16ct-0.2.0\",\n sha256 = \"4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/base16ct/0.2.0/download\"],\n strip_prefix = \"base16ct-0.2.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.base16ct-0.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__bitfield-0.13.2\",\n sha256 = \"46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bitfield/0.13.2/download\"],\n strip_prefix = \"bitfield-0.13.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.bitfield-0.13.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__bitfield-0.14.0\",\n sha256 = \"2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bitfield/0.14.0/download\"],\n strip_prefix = \"bitfield-0.14.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.bitfield-0.14.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__bitfield-struct-0.11.0\",\n sha256 = \"d3ca019570363e800b05ad4fd890734f28ac7b72f563ad8a35079efb793616f8\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bitfield-struct/0.11.0/download\"],\n strip_prefix = \"bitfield-struct-0.11.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.bitfield-struct-0.11.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__bitflags-2.13.0\",\n sha256 = \"b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bitflags/2.13.0/download\"],\n strip_prefix = \"bitflags-2.13.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.bitflags-2.13.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__block-buffer-0.10.4\",\n sha256 = \"3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/block-buffer/0.10.4/download\"],\n strip_prefix = \"block-buffer-0.10.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.block-buffer-0.10.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__byteorder-1.5.0\",\n sha256 = \"1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/byteorder/1.5.0/download\"],\n strip_prefix = \"byteorder-1.5.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.byteorder-1.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__bytes-1.11.1\",\n sha256 = \"1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bytes/1.11.1/download\"],\n strip_prefix = \"bytes-1.11.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.bytes-1.11.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__cfg-if-1.0.4\",\n sha256 = \"9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cfg-if/1.0.4/download\"],\n strip_prefix = \"cfg-if-1.0.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.cfg-if-1.0.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__cipher-0.4.4\",\n sha256 = \"773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cipher/0.4.4/download\"],\n strip_prefix = \"cipher-0.4.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.cipher-0.4.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__clap-4.6.1\",\n sha256 = \"1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/clap/4.6.1/download\"],\n strip_prefix = \"clap-4.6.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.clap-4.6.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__clap_builder-4.6.0\",\n sha256 = \"714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/clap_builder/4.6.0/download\"],\n strip_prefix = \"clap_builder-4.6.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.clap_builder-4.6.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__clap_derive-4.6.1\",\n sha256 = \"f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/clap_derive/4.6.1/download\"],\n strip_prefix = \"clap_derive-4.6.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.clap_derive-4.6.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__clap_lex-1.1.0\",\n sha256 = \"c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/clap_lex/1.1.0/download\"],\n strip_prefix = \"clap_lex-1.1.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.clap_lex-1.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__colorchoice-1.0.5\",\n sha256 = \"1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/colorchoice/1.0.5/download\"],\n strip_prefix = \"colorchoice-1.0.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.colorchoice-1.0.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__compiler_builtins-0.1.160\",\n sha256 = \"6376049cfa92c0aa8b9ac95fae22184b981c658208d4ed8a1dc553cd83612895\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/compiler_builtins/0.1.160/download\"],\n strip_prefix = \"compiler_builtins-0.1.160\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.compiler_builtins-0.1.160.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__const-oid-0.9.6\",\n sha256 = \"c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/const-oid/0.9.6/download\"],\n strip_prefix = \"const-oid-0.9.6\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.const-oid-0.9.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__cortex-m-0.7.7\",\n sha256 = \"8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cortex-m/0.7.7/download\"],\n strip_prefix = \"cortex-m-0.7.7\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.cortex-m-0.7.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__cortex-m-rt-0.7.5\",\n sha256 = \"801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cortex-m-rt/0.7.5/download\"],\n strip_prefix = \"cortex-m-rt-0.7.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.cortex-m-rt-0.7.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__cortex-m-rt-macros-0.7.5\",\n sha256 = \"e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cortex-m-rt-macros/0.7.5/download\"],\n strip_prefix = \"cortex-m-rt-macros-0.7.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.cortex-m-rt-macros-0.7.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__cortex-m-semihosting-0.5.0\",\n sha256 = \"c23234600452033cc77e4b761e740e02d2c4168e11dbf36ab14a0f58973592b0\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cortex-m-semihosting/0.5.0/download\"],\n strip_prefix = \"cortex-m-semihosting-0.5.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.cortex-m-semihosting-0.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__cpufeatures-0.2.17\",\n sha256 = \"59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cpufeatures/0.2.17/download\"],\n strip_prefix = \"cpufeatures-0.2.17\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.cpufeatures-0.2.17.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__crc-3.4.0\",\n sha256 = \"5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/crc/3.4.0/download\"],\n strip_prefix = \"crc-3.4.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.crc-3.4.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__crc-catalog-2.5.0\",\n sha256 = \"217698eaf96b4a3f0bc4f3662aaa55bdf913cd54d7204591faa790070c6d0853\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/crc-catalog/2.5.0/download\"],\n strip_prefix = \"crc-catalog-2.5.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.crc-catalog-2.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__crc32fast-1.5.0\",\n sha256 = \"9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/crc32fast/1.5.0/download\"],\n strip_prefix = \"crc32fast-1.5.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.crc32fast-1.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__critical-section-1.2.0\",\n sha256 = \"790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/critical-section/1.2.0/download\"],\n strip_prefix = \"critical-section-1.2.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.critical-section-1.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__crypto-bigint-0.5.5\",\n sha256 = \"0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/crypto-bigint/0.5.5/download\"],\n strip_prefix = \"crypto-bigint-0.5.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.crypto-bigint-0.5.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__crypto-common-0.1.7\",\n sha256 = \"78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/crypto-common/0.1.7/download\"],\n strip_prefix = \"crypto-common-0.1.7\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.crypto-common-0.1.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__ctr-0.9.2\",\n sha256 = \"0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ctr/0.9.2/download\"],\n strip_prefix = \"ctr-0.9.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.ctr-0.9.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__der-0.7.10\",\n sha256 = \"e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/der/0.7.10/download\"],\n strip_prefix = \"der-0.7.10\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.der-0.7.10.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__digest-0.10.7\",\n sha256 = \"9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/digest/0.10.7/download\"],\n strip_prefix = \"digest-0.10.7\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.digest-0.10.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__ecdsa-0.16.9\",\n sha256 = \"ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ecdsa/0.16.9/download\"],\n strip_prefix = \"ecdsa-0.16.9\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.ecdsa-0.16.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__either-1.16.0\",\n sha256 = \"91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/either/1.16.0/download\"],\n strip_prefix = \"either-1.16.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.either-1.16.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__elliptic-curve-0.13.8\",\n sha256 = \"b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/elliptic-curve/0.13.8/download\"],\n strip_prefix = \"elliptic-curve-0.13.8\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.elliptic-curve-0.13.8.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__embedded-crc-macros-1.0.0\",\n sha256 = \"4f1c75747a43b086df1a87fb2a889590bc0725e0abf54bba6d0c4bf7bd9e762c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-crc-macros/1.0.0/download\"],\n strip_prefix = \"embedded-crc-macros-1.0.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.embedded-crc-macros-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__embedded-hal-0.2.7\",\n sha256 = \"35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-hal/0.2.7/download\"],\n strip_prefix = \"embedded-hal-0.2.7\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.embedded-hal-0.2.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__embedded-hal-1.0.0\",\n sha256 = \"361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-hal/1.0.0/download\"],\n strip_prefix = \"embedded-hal-1.0.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.embedded-hal-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__embedded-hal-async-1.0.0\",\n sha256 = \"0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-hal-async/1.0.0/download\"],\n strip_prefix = \"embedded-hal-async-1.0.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.embedded-hal-async-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__embedded-hal-nb-1.0.0\",\n sha256 = \"fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-hal-nb/1.0.0/download\"],\n strip_prefix = \"embedded-hal-nb-1.0.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.embedded-hal-nb-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__embedded-io-0.6.1\",\n sha256 = \"edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-io/0.6.1/download\"],\n strip_prefix = \"embedded-io-0.6.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.embedded-io-0.6.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__embedded-io-async-0.6.1\",\n sha256 = \"3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-io-async/0.6.1/download\"],\n strip_prefix = \"embedded-io-async-0.6.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.embedded-io-async-0.6.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__embedded-storage-0.3.1\",\n sha256 = \"a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-storage/0.3.1/download\"],\n strip_prefix = \"embedded-storage-0.3.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.embedded-storage-0.3.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__equivalent-1.0.2\",\n sha256 = \"877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/equivalent/1.0.2/download\"],\n strip_prefix = \"equivalent-1.0.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.equivalent-1.0.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__errno-0.3.14\",\n sha256 = \"39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/errno/0.3.14/download\"],\n strip_prefix = \"errno-0.3.14\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.errno-0.3.14.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__ff-0.13.1\",\n sha256 = \"c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ff/0.13.1/download\"],\n strip_prefix = \"ff-0.13.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.ff-0.13.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__flate2-1.1.9\",\n sha256 = \"843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/flate2/1.1.9/download\"],\n strip_prefix = \"flate2-1.1.9\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.flate2-1.1.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__foldhash-0.2.0\",\n sha256 = \"77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/foldhash/0.2.0/download\"],\n strip_prefix = \"foldhash-0.2.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.foldhash-0.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__fugit-0.3.9\",\n sha256 = \"4e639847d312d9a82d2e75b0edcc1e934efcc64e6cb7aa94f0b1fbec0bc231d6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/fugit/0.3.9/download\"],\n strip_prefix = \"fugit-0.3.9\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.fugit-0.3.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__futures-0.3.32\",\n sha256 = \"8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures/0.3.32/download\"],\n strip_prefix = \"futures-0.3.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.futures-0.3.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__futures-channel-0.3.32\",\n sha256 = \"07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-channel/0.3.32/download\"],\n strip_prefix = \"futures-channel-0.3.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.futures-channel-0.3.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__futures-core-0.3.32\",\n sha256 = \"7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-core/0.3.32/download\"],\n strip_prefix = \"futures-core-0.3.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.futures-core-0.3.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__futures-executor-0.3.32\",\n sha256 = \"baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-executor/0.3.32/download\"],\n strip_prefix = \"futures-executor-0.3.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.futures-executor-0.3.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__futures-io-0.3.32\",\n sha256 = \"cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-io/0.3.32/download\"],\n strip_prefix = \"futures-io-0.3.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.futures-io-0.3.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__futures-macro-0.3.32\",\n sha256 = \"e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-macro/0.3.32/download\"],\n strip_prefix = \"futures-macro-0.3.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.futures-macro-0.3.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__futures-sink-0.3.32\",\n sha256 = \"c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-sink/0.3.32/download\"],\n strip_prefix = \"futures-sink-0.3.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.futures-sink-0.3.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__futures-task-0.3.32\",\n sha256 = \"037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-task/0.3.32/download\"],\n strip_prefix = \"futures-task-0.3.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.futures-task-0.3.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__futures-util-0.3.32\",\n sha256 = \"389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-util/0.3.32/download\"],\n strip_prefix = \"futures-util-0.3.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.futures-util-0.3.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__gcd-2.3.0\",\n sha256 = \"1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/gcd/2.3.0/download\"],\n strip_prefix = \"gcd-2.3.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.gcd-2.3.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__generic-array-0.14.7\",\n sha256 = \"85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/generic-array/0.14.7/download\"],\n strip_prefix = \"generic-array-0.14.7\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.generic-array-0.14.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__ghash-0.5.1\",\n sha256 = \"f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ghash/0.5.1/download\"],\n strip_prefix = \"ghash-0.5.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.ghash-0.5.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__group-0.13.0\",\n sha256 = \"f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/group/0.13.0/download\"],\n strip_prefix = \"group-0.13.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.group-0.13.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__hash32-0.3.1\",\n sha256 = \"47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hash32/0.3.1/download\"],\n strip_prefix = \"hash32-0.3.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.hash32-0.3.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__hashbrown-0.17.1\",\n sha256 = \"ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hashbrown/0.17.1/download\"],\n strip_prefix = \"hashbrown-0.17.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.hashbrown-0.17.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__heapless-0.8.0\",\n sha256 = \"0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/heapless/0.8.0/download\"],\n strip_prefix = \"heapless-0.8.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.heapless-0.8.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__heapless-0.9.3\",\n sha256 = \"25ba4bd83f9415b58b4ed8dc5714c76e626a105be4646c02630ad730ad3b5aa4\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/heapless/0.9.3/download\"],\n strip_prefix = \"heapless-0.9.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.heapless-0.9.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__heck-0.5.0\",\n sha256 = \"2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/heck/0.5.0/download\"],\n strip_prefix = \"heck-0.5.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.heck-0.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__hex-0.4.3\",\n sha256 = \"7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hex/0.4.3/download\"],\n strip_prefix = \"hex-0.4.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.hex-0.4.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__hex-literal-0.4.1\",\n sha256 = \"6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hex-literal/0.4.1/download\"],\n strip_prefix = \"hex-literal-0.4.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.hex-literal-0.4.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__hmac-0.12.1\",\n sha256 = \"6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hmac/0.12.1/download\"],\n strip_prefix = \"hmac-0.12.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.hmac-0.12.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__indexmap-2.14.0\",\n sha256 = \"d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/indexmap/2.14.0/download\"],\n strip_prefix = \"indexmap-2.14.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.indexmap-2.14.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__inout-0.1.4\",\n sha256 = \"879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/inout/0.1.4/download\"],\n strip_prefix = \"inout-0.1.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.inout-0.1.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__is_terminal_polyfill-1.70.2\",\n sha256 = \"a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/is_terminal_polyfill/1.70.2/download\"],\n strip_prefix = \"is_terminal_polyfill-1.70.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.is_terminal_polyfill-1.70.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__itertools-0.14.0\",\n sha256 = \"2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/itertools/0.14.0/download\"],\n strip_prefix = \"itertools-0.14.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.itertools-0.14.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__k256-0.13.4\",\n sha256 = \"f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/k256/0.13.4/download\"],\n strip_prefix = \"k256-0.13.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.k256-0.13.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__keccak-0.1.6\",\n sha256 = \"cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/keccak/0.1.6/download\"],\n strip_prefix = \"keccak-0.1.6\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.keccak-0.1.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__libc-0.2.186\",\n sha256 = \"68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/libc/0.2.186/download\"],\n strip_prefix = \"libc-0.2.186\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.libc-0.2.186.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__linux-raw-sys-0.12.1\",\n sha256 = \"32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/linux-raw-sys/0.12.1/download\"],\n strip_prefix = \"linux-raw-sys-0.12.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.linux-raw-sys-0.12.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__lock_api-0.4.14\",\n sha256 = \"224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/lock_api/0.4.14/download\"],\n strip_prefix = \"lock_api-0.4.14\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.lock_api-0.4.14.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__log-0.4.32\",\n sha256 = \"953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/log/0.4.32/download\"],\n strip_prefix = \"log-0.4.32\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.log-0.4.32.bazel\"),\n )\n\n maybe(\n git_repository,\n name = \"rust_crates__mctp-0.2.0\",\n commit = \"5a7b9067b4a4515b05ef8b5f4948ba542e8ae1c9\",\n init_submodules = True,\n remote = \"https://github.com/CodeConstruct/mctp-rs.git\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.mctp-0.2.0.bazel\"),\n strip_prefix = \"mctp\",\n )\n\n maybe(\n git_repository,\n name = \"rust_crates__mctp-estack-0.1.0\",\n commit = \"5a7b9067b4a4515b05ef8b5f4948ba542e8ae1c9\",\n init_submodules = True,\n remote = \"https://github.com/CodeConstruct/mctp-rs.git\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.mctp-estack-0.1.0.bazel\"),\n strip_prefix = \"mctp-estack\",\n )\n\n maybe(\n git_repository,\n name = \"rust_crates__mctp-lib-0.1.0\",\n commit = \"742fa0e991aa2b87509ff12739e011a674643d91\",\n init_submodules = True,\n remote = \"https://github.com/OpenPRoT/mctp-lib.git\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.mctp-lib-0.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__memchr-2.8.2\",\n sha256 = \"88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/memchr/2.8.2/download\"],\n strip_prefix = \"memchr-2.8.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.memchr-2.8.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__memo-map-0.3.3\",\n sha256 = \"38d1115007560874e373613744c6fba374c17688327a71c1476d1a5954cc857b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/memo-map/0.3.3/download\"],\n strip_prefix = \"memo-map-0.3.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.memo-map-0.3.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__memoffset-0.9.1\",\n sha256 = \"488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/memoffset/0.9.1/download\"],\n strip_prefix = \"memoffset-0.9.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.memoffset-0.9.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__minijinja-2.20.0\",\n sha256 = \"2929e494b2280e1e18959bb2e121da03347ae896896fdfaceaab43c88a02803f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/minijinja/2.20.0/download\"],\n strip_prefix = \"minijinja-2.20.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.minijinja-2.20.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__minimal-lexical-0.2.1\",\n sha256 = \"68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/minimal-lexical/0.2.1/download\"],\n strip_prefix = \"minimal-lexical-0.2.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.minimal-lexical-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__miniz_oxide-0.8.9\",\n sha256 = \"1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/miniz_oxide/0.8.9/download\"],\n strip_prefix = \"miniz_oxide-0.8.9\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.miniz_oxide-0.8.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__mio-1.2.1\",\n sha256 = \"02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/mio/1.2.1/download\"],\n strip_prefix = \"mio-1.2.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.mio-1.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__nb-0.1.3\",\n sha256 = \"801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/nb/0.1.3/download\"],\n strip_prefix = \"nb-0.1.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.nb-0.1.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__nb-1.1.0\",\n sha256 = \"8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/nb/1.1.0/download\"],\n strip_prefix = \"nb-1.1.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.nb-1.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__nom-7.1.3\",\n sha256 = \"d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/nom/7.1.3/download\"],\n strip_prefix = \"nom-7.1.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.nom-7.1.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__object-0.40.0\",\n sha256 = \"dd229a0361b9d0d4396176e02d65897f487eebeab7caa6d443855ee152ca0b9c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/object/0.40.0/download\"],\n strip_prefix = \"object-0.40.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.object-0.40.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__once_cell_polyfill-1.70.2\",\n sha256 = \"384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/once_cell_polyfill/1.70.2/download\"],\n strip_prefix = \"once_cell_polyfill-1.70.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.once_cell_polyfill-1.70.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__opaque-debug-0.3.1\",\n sha256 = \"c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/opaque-debug/0.3.1/download\"],\n strip_prefix = \"opaque-debug-0.3.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.opaque-debug-0.3.1.bazel\"),\n )\n\n maybe(\n git_repository,\n name = \"rust_crates__openprot-hal-blocking-0.1.0\",\n commit = \"c6cd23a56f3cc7945b062ea1bcdabf3af0dba82d\",\n init_submodules = True,\n remote = \"https://github.com/rusty1968/openprot.git\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.openprot-hal-blocking-0.1.0.bazel\"),\n strip_prefix = \"hal/blocking\",\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__p256-0.13.2\",\n sha256 = \"c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/p256/0.13.2/download\"],\n strip_prefix = \"p256-0.13.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.p256-0.13.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__p384-0.13.1\",\n sha256 = \"fe42f1670a52a47d448f14b6a5c61dd78fce51856e68edaa38f7ae3a46b8d6b6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/p384/0.13.1/download\"],\n strip_prefix = \"p384-0.13.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.p384-0.13.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__panic-halt-1.0.0\",\n sha256 = \"a513e167849a384b7f9b746e517604398518590a9142f4846a32e3c2a4de7b11\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/panic-halt/1.0.0/download\"],\n strip_prefix = \"panic-halt-1.0.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.panic-halt-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__parking_lot-0.12.5\",\n sha256 = \"93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/parking_lot/0.12.5/download\"],\n strip_prefix = \"parking_lot-0.12.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.parking_lot-0.12.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__parking_lot_core-0.9.12\",\n sha256 = \"2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/parking_lot_core/0.9.12/download\"],\n strip_prefix = \"parking_lot_core-0.9.12\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.parking_lot_core-0.9.12.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__paste-1.0.15\",\n sha256 = \"57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/paste/1.0.15/download\"],\n strip_prefix = \"paste-1.0.15\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.paste-1.0.15.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__pest-2.8.6\",\n sha256 = \"e0848c601009d37dfa3430c4666e147e49cdcf1b92ecd3e63657d8a5f19da662\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pest/2.8.6/download\"],\n strip_prefix = \"pest-2.8.6\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.pest-2.8.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__pest_derive-2.8.6\",\n sha256 = \"11f486f1ea21e6c10ed15d5a7c77165d0ee443402f0780849d1768e7d9d6fe77\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pest_derive/2.8.6/download\"],\n strip_prefix = \"pest_derive-2.8.6\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.pest_derive-2.8.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__pest_generator-2.8.6\",\n sha256 = \"8040c4647b13b210a963c1ed407c1ff4fdfa01c31d6d2a098218702e6664f94f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pest_generator/2.8.6/download\"],\n strip_prefix = \"pest_generator-2.8.6\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.pest_generator-2.8.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__pest_meta-2.8.6\",\n sha256 = \"89815c69d36021a140146f26659a81d6c2afa33d216d736dd4be5381a7362220\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pest_meta/2.8.6/download\"],\n strip_prefix = \"pest_meta-2.8.6\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.pest_meta-2.8.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__pin-project-lite-0.2.17\",\n sha256 = \"a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pin-project-lite/0.2.17/download\"],\n strip_prefix = \"pin-project-lite-0.2.17\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.pin-project-lite-0.2.17.bazel\"),\n )\n\n maybe(\n git_repository,\n name = \"rust_crates__pldm-common-0.1.0\",\n commit = \"3d2fcf47ff14a71505d464a82bc2d7b110712d63\",\n init_submodules = True,\n remote = \"https://github.com/OpenPRoT/pldm-lib.git\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.pldm-common-0.1.0.bazel\"),\n strip_prefix = \"pldm-common\",\n )\n\n maybe(\n git_repository,\n name = \"rust_crates__pldm-interface-0.1.0\",\n commit = \"3d2fcf47ff14a71505d464a82bc2d7b110712d63\",\n init_submodules = True,\n remote = \"https://github.com/OpenPRoT/pldm-lib.git\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.pldm-interface-0.1.0.bazel\"),\n strip_prefix = \"pldm-interface\",\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__polyval-0.6.2\",\n sha256 = \"9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/polyval/0.6.2/download\"],\n strip_prefix = \"polyval-0.6.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.polyval-0.6.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__primeorder-0.13.6\",\n sha256 = \"353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/primeorder/0.13.6/download\"],\n strip_prefix = \"primeorder-0.13.6\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.primeorder-0.13.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__proc-macro2-1.0.106\",\n sha256 = \"8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/proc-macro2/1.0.106/download\"],\n strip_prefix = \"proc-macro2-1.0.106\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.proc-macro2-1.0.106.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__prost-0.13.5\",\n sha256 = \"2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/prost/0.13.5/download\"],\n strip_prefix = \"prost-0.13.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.prost-0.13.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__prost-derive-0.13.5\",\n sha256 = \"8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/prost-derive/0.13.5/download\"],\n strip_prefix = \"prost-derive-0.13.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.prost-derive-0.13.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__quote-1.0.45\",\n sha256 = \"41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/quote/1.0.45/download\"],\n strip_prefix = \"quote-1.0.45\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.quote-1.0.45.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__rand_core-0.6.4\",\n sha256 = \"ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rand_core/0.6.4/download\"],\n strip_prefix = \"rand_core-0.6.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.rand_core-0.6.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__rand_core-0.9.5\",\n sha256 = \"76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rand_core/0.9.5/download\"],\n strip_prefix = \"rand_core-0.9.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.rand_core-0.9.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__redox_syscall-0.5.18\",\n sha256 = \"ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/redox_syscall/0.5.18/download\"],\n strip_prefix = \"redox_syscall-0.5.18\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.redox_syscall-0.5.18.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__rfc6979-0.4.0\",\n sha256 = \"f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rfc6979/0.4.0/download\"],\n strip_prefix = \"rfc6979-0.4.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.rfc6979-0.4.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__riscv-0.11.1\",\n sha256 = \"2f5c1b8bf41ea746266cdee443d1d1e9125c86ce1447e1a2615abd34330d33a9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv/0.11.1/download\"],\n strip_prefix = \"riscv-0.11.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.riscv-0.11.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__riscv-0.12.1\",\n sha256 = \"5ea8ff73d3720bdd0a97925f0bf79ad2744b6da8ff36be3840c48ac81191d7a7\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv/0.12.1/download\"],\n strip_prefix = \"riscv-0.12.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.riscv-0.12.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__riscv-0.13.0\",\n sha256 = \"afa3cdbeccae4359f6839a00e8b77e5736caa200ba216caf38d24e4c16e2b586\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv/0.13.0/download\"],\n strip_prefix = \"riscv-0.13.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.riscv-0.13.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__riscv-macros-0.1.0\",\n sha256 = \"f265be5d634272320a7de94cea15c22a3bfdd4eb42eb43edc528415f066a1f25\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-macros/0.1.0/download\"],\n strip_prefix = \"riscv-macros-0.1.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.riscv-macros-0.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__riscv-macros-0.2.0\",\n sha256 = \"e8c4aa1ea1af6dcc83a61be12e8189f9b293c3ba5a487778a4cd89fb060fdbbc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-macros/0.2.0/download\"],\n strip_prefix = \"riscv-macros-0.2.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.riscv-macros-0.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__riscv-pac-0.2.0\",\n sha256 = \"8188909339ccc0c68cfb5a04648313f09621e8b87dc03095454f1a11f6c5d436\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-pac/0.2.0/download\"],\n strip_prefix = \"riscv-pac-0.2.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.riscv-pac-0.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__riscv-rt-0.12.2\",\n sha256 = \"c0d35e32cf1383183e8885d8a9aa4402a087fd094dc34c2cb6df6687d0229dfe\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-rt/0.12.2/download\"],\n strip_prefix = \"riscv-rt-0.12.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.riscv-rt-0.12.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__riscv-rt-macros-0.2.2\",\n sha256 = \"30f19a85fe107b65031e0ba8ec60c34c2494069fe910d6c297f5e7cb5a6f76d0\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-rt-macros/0.2.2/download\"],\n strip_prefix = \"riscv-rt-macros-0.2.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.riscv-rt-macros-0.2.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__riscv-semihosting-0.1.3\",\n sha256 = \"1086dd4bcc13de1cb14b93849411e3466de7e5907d2d8eb269032536e93facc6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-semihosting/0.1.3/download\"],\n strip_prefix = \"riscv-semihosting-0.1.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.riscv-semihosting-0.1.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__rustc-demangle-0.1.27\",\n sha256 = \"b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rustc-demangle/0.1.27/download\"],\n strip_prefix = \"rustc-demangle-0.1.27\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.rustc-demangle-0.1.27.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__rustc_version-0.2.3\",\n sha256 = \"138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rustc_version/0.2.3/download\"],\n strip_prefix = \"rustc_version-0.2.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.rustc_version-0.2.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__rustix-1.1.4\",\n sha256 = \"b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rustix/1.1.4/download\"],\n strip_prefix = \"rustix-1.1.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.rustix-1.1.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__ruzstd-0.9.1\",\n sha256 = \"69e4ce4a039f42bf25920b95667e4d789e98749ab11bbb8d2c2936f788421bb5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ruzstd/0.9.1/download\"],\n strip_prefix = \"ruzstd-0.9.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.ruzstd-0.9.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__scopeguard-1.2.0\",\n sha256 = \"94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/scopeguard/1.2.0/download\"],\n strip_prefix = \"scopeguard-1.2.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.scopeguard-1.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__sec1-0.7.3\",\n sha256 = \"d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/sec1/0.7.3/download\"],\n strip_prefix = \"sec1-0.7.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.sec1-0.7.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__semver-0.9.0\",\n sha256 = \"1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/semver/0.9.0/download\"],\n strip_prefix = \"semver-0.9.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.semver-0.9.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__semver-parser-0.7.0\",\n sha256 = \"388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/semver-parser/0.7.0/download\"],\n strip_prefix = \"semver-parser-0.7.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.semver-parser-0.7.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__serde-1.0.228\",\n sha256 = \"9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde/1.0.228/download\"],\n strip_prefix = \"serde-1.0.228\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.serde-1.0.228.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__serde_core-1.0.228\",\n sha256 = \"41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde_core/1.0.228/download\"],\n strip_prefix = \"serde_core-1.0.228\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.serde_core-1.0.228.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__serde_derive-1.0.228\",\n sha256 = \"d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde_derive/1.0.228/download\"],\n strip_prefix = \"serde_derive-1.0.228\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.serde_derive-1.0.228.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__serde_json5-0.2.1\",\n sha256 = \"5d34d03f54462862f2a42918391c9526337f53171eaa4d8894562be7f252edd3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde_json5/0.2.1/download\"],\n strip_prefix = \"serde_json5-0.2.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.serde_json5-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__sha2-0.10.9\",\n sha256 = \"a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/sha2/0.10.9/download\"],\n strip_prefix = \"sha2-0.10.9\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.sha2-0.10.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__sha3-0.10.9\",\n sha256 = \"77fd7028345d415a4034cf8777cd4f8ab1851274233b45f84e3d955502d93874\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/sha3/0.10.9/download\"],\n strip_prefix = \"sha3-0.10.9\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.sha3-0.10.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__signal-hook-registry-1.4.8\",\n sha256 = \"c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/signal-hook-registry/1.4.8/download\"],\n strip_prefix = \"signal-hook-registry-1.4.8\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.signal-hook-registry-1.4.8.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__signature-2.2.0\",\n sha256 = \"77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/signature/2.2.0/download\"],\n strip_prefix = \"signature-2.2.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.signature-2.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__simd-adler32-0.3.9\",\n sha256 = \"703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/simd-adler32/0.3.9/download\"],\n strip_prefix = \"simd-adler32-0.3.9\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.simd-adler32-0.3.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__slab-0.4.12\",\n sha256 = \"0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/slab/0.4.12/download\"],\n strip_prefix = \"slab-0.4.12\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.slab-0.4.12.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__smallvec-1.15.2\",\n sha256 = \"8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/smallvec/1.15.2/download\"],\n strip_prefix = \"smallvec-1.15.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.smallvec-1.15.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__smbus-pec-1.0.1\",\n sha256 = \"ca0763a680cd5d72b28f7bfc8a054c117d8841380a6ad4f72f05bd2a34217d3e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/smbus-pec/1.0.1/download\"],\n strip_prefix = \"smbus-pec-1.0.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.smbus-pec-1.0.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__smlang-0.8.0\",\n sha256 = \"1de84f9f80bbe6272174e2bfdb8cf7ce4815b218038a42161c2f21c1d872c215\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/smlang/0.8.0/download\"],\n strip_prefix = \"smlang-0.8.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.smlang-0.8.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__smlang-macros-0.8.0\",\n sha256 = \"231b4425dcc43afc7e18c34e7c6738cd252d42d91d909c948df14107c9ae79f1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/smlang-macros/0.8.0/download\"],\n strip_prefix = \"smlang-macros-0.8.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.smlang-macros-0.8.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__socket2-0.6.4\",\n sha256 = \"52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/socket2/0.6.4/download\"],\n strip_prefix = \"socket2-0.6.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.socket2-0.6.4.bazel\"),\n )\n\n maybe(\n git_repository,\n name = \"rust_crates__spdm-lib-0.1.0\",\n commit = \"41d81717f5d2b4d6b004819a829ae015e44febce\",\n init_submodules = True,\n remote = \"https://github.com/OpenPRoT/spdm-lib.git\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.spdm-lib-0.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__stable_deref_trait-1.2.1\",\n sha256 = \"6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/stable_deref_trait/1.2.1/download\"],\n strip_prefix = \"stable_deref_trait-1.2.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.stable_deref_trait-1.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__string_morph-0.1.0\",\n sha256 = \"183aaf7fa637cc7b5f54c45b8f7cb6e8d73831f9f75a56b6defa5bf8c51d1699\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/string_morph/0.1.0/download\"],\n strip_prefix = \"string_morph-0.1.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.string_morph-0.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__strsim-0.11.1\",\n sha256 = \"7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/strsim/0.11.1/download\"],\n strip_prefix = \"strsim-0.11.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.strsim-0.11.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__subtle-2.6.1\",\n sha256 = \"13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/subtle/2.6.1/download\"],\n strip_prefix = \"subtle-2.6.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.subtle-2.6.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__syn-1.0.109\",\n sha256 = \"72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/syn/1.0.109/download\"],\n strip_prefix = \"syn-1.0.109\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.syn-1.0.109.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__syn-2.0.119\",\n sha256 = \"872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/syn/2.0.119/download\"],\n strip_prefix = \"syn-2.0.119\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.syn-2.0.119.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__syn-3.0.5\",\n sha256 = \"12df2e0110f65b775f769bb17ef989067a1d931b2eb822bd4346631eeada89f9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/syn/3.0.5/download\"],\n strip_prefix = \"syn-3.0.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.syn-3.0.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__terminal_size-0.4.4\",\n sha256 = \"230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/terminal_size/0.4.4/download\"],\n strip_prefix = \"terminal_size-0.4.4\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.terminal_size-0.4.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__thiserror-2.0.18\",\n sha256 = \"4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/thiserror/2.0.18/download\"],\n strip_prefix = \"thiserror-2.0.18\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.thiserror-2.0.18.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__thiserror-impl-2.0.18\",\n sha256 = \"ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/thiserror-impl/2.0.18/download\"],\n strip_prefix = \"thiserror-impl-2.0.18\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.thiserror-impl-2.0.18.bazel\"),\n )\n\n maybe(\n git_repository,\n name = \"rust_crates__tock-registers-0.9.0\",\n commit = \"9554639b17501a9f5940cef7a1770a0823e790c3\",\n init_submodules = True,\n remote = \"https://github.com/tock/tock.git\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.tock-registers-0.9.0.bazel\"),\n strip_prefix = \"libraries/tock-register-interface\",\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__tokio-1.52.3\",\n sha256 = \"8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/tokio/1.52.3/download\"],\n strip_prefix = \"tokio-1.52.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.tokio-1.52.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__tokio-macros-2.7.0\",\n sha256 = \"385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/tokio-macros/2.7.0/download\"],\n strip_prefix = \"tokio-macros-2.7.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.tokio-macros-2.7.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__tokio-util-0.7.18\",\n sha256 = \"9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/tokio-util/0.7.18/download\"],\n strip_prefix = \"tokio-util-0.7.18\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.tokio-util-0.7.18.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__twox-hash-2.1.2\",\n sha256 = \"9ea3136b675547379c4bd395ca6b938e5ad3c3d20fad76e7fe85f9e0d011419c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/twox-hash/2.1.2/download\"],\n strip_prefix = \"twox-hash-2.1.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.twox-hash-2.1.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__typenum-1.20.1\",\n sha256 = \"b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/typenum/1.20.1/download\"],\n strip_prefix = \"typenum-1.20.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.typenum-1.20.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__ucd-trie-0.1.7\",\n sha256 = \"2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ucd-trie/0.1.7/download\"],\n strip_prefix = \"ucd-trie-0.1.7\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.ucd-trie-0.1.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__unicode-ident-1.0.24\",\n sha256 = \"e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicode-ident/1.0.24/download\"],\n strip_prefix = \"unicode-ident-1.0.24\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.unicode-ident-1.0.24.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__universal-hash-0.5.1\",\n sha256 = \"fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/universal-hash/0.5.1/download\"],\n strip_prefix = \"universal-hash-0.5.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.universal-hash-0.5.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__utf8parse-0.2.2\",\n sha256 = \"06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/utf8parse/0.2.2/download\"],\n strip_prefix = \"utf8parse-0.2.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.utf8parse-0.2.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__uuid-1.23.3\",\n sha256 = \"144d6b123cef80b301b8f72a9e2ca4370ddec21950d0a103dd22c437006d2db7\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/uuid/1.23.3/download\"],\n strip_prefix = \"uuid-1.23.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.uuid-1.23.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__vcell-0.1.3\",\n sha256 = \"77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/vcell/0.1.3/download\"],\n strip_prefix = \"vcell-0.1.3\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.vcell-0.1.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__version_check-0.9.5\",\n sha256 = \"0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/version_check/0.9.5/download\"],\n strip_prefix = \"version_check-0.9.5\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.version_check-0.9.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__void-1.0.2\",\n sha256 = \"6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/void/1.0.2/download\"],\n strip_prefix = \"void-1.0.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.void-1.0.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__volatile-register-0.2.2\",\n sha256 = \"de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/volatile-register/0.2.2/download\"],\n strip_prefix = \"volatile-register-0.2.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.volatile-register-0.2.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__wasi-0.11.1-wasi-snapshot-preview1\",\n sha256 = \"ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/wasi/0.11.1+wasi-snapshot-preview1/download\"],\n strip_prefix = \"wasi-0.11.1+wasi-snapshot-preview1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.wasi-0.11.1+wasi-snapshot-preview1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__windows-link-0.2.1\",\n sha256 = \"f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows-link/0.2.1/download\"],\n strip_prefix = \"windows-link-0.2.1\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.windows-link-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__windows-sys-0.61.2\",\n sha256 = \"ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows-sys/0.61.2/download\"],\n strip_prefix = \"windows-sys-0.61.2\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.windows-sys-0.61.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__zerocopy-0.8.52\",\n sha256 = \"ce1022995ff5ff5d841ad7d994facc23098cd40152f2c1d11cd607c6f530653f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zerocopy/0.8.52/download\"],\n strip_prefix = \"zerocopy-0.8.52\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.zerocopy-0.8.52.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__zerocopy-derive-0.8.52\",\n sha256 = \"1ae7f38b72ec2a254e2b87ef277cf2cd4fb97cbebf944faa6f33354da0867930\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zerocopy-derive/0.8.52/download\"],\n strip_prefix = \"zerocopy-derive-0.8.52\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.zerocopy-derive-0.8.52.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__zeroize-1.9.0\",\n sha256 = \"e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zeroize/1.9.0/download\"],\n strip_prefix = \"zeroize-1.9.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.zeroize-1.9.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"rust_crates__zeroize_derive-1.5.0\",\n sha256 = \"3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zeroize_derive/1.5.0/download\"],\n strip_prefix = \"zeroize_derive-1.5.0\",\n build_file = Label(\"@rust_crates//rust_crates:BUILD.zeroize_derive-1.5.0.bazel\"),\n )\n\n return [\n struct(repo=\"rust_crates__aes-0.8.4\", is_dev_dep = False),\n struct(repo=\"rust_crates__aes-gcm-0.10.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__aligned-0.4.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__anyhow-1.0.103\", is_dev_dep = False),\n struct(repo=\"rust_crates__bitfield-0.14.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__bitfield-struct-0.11.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__bitflags-2.13.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__byteorder-1.5.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__cfg-if-1.0.4\", is_dev_dep = False),\n struct(repo=\"rust_crates__cipher-0.4.4\", is_dev_dep = False),\n struct(repo=\"rust_crates__clap-4.6.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__compiler_builtins-0.1.160\", is_dev_dep = False),\n struct(repo=\"rust_crates__cortex-m-0.7.7\", is_dev_dep = False),\n struct(repo=\"rust_crates__cortex-m-rt-0.7.5\", is_dev_dep = False),\n struct(repo=\"rust_crates__cortex-m-semihosting-0.5.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__critical-section-1.2.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__ctr-0.9.2\", is_dev_dep = False),\n struct(repo=\"rust_crates__ecdsa-0.16.9\", is_dev_dep = False),\n struct(repo=\"rust_crates__embedded-hal-1.0.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__embedded-hal-async-1.0.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__embedded-hal-nb-1.0.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__embedded-io-0.6.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__embedded-storage-0.3.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__fugit-0.3.9\", is_dev_dep = False),\n struct(repo=\"rust_crates__futures-0.3.32\", is_dev_dep = False),\n struct(repo=\"rust_crates__heapless-0.9.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__hex-0.4.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__hex-literal-0.4.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__hmac-0.12.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__k256-0.13.4\", is_dev_dep = False),\n struct(repo=\"rust_crates__log-0.4.32\", is_dev_dep = False),\n struct(repo=\"rust_crates__mctp-0.2.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__mctp-lib-0.1.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__memoffset-0.9.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__minijinja-2.20.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__nb-1.1.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__nom-7.1.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__object-0.40.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__openprot-hal-blocking-0.1.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__p256-0.13.2\", is_dev_dep = False),\n struct(repo=\"rust_crates__p384-0.13.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__panic-halt-1.0.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__paste-1.0.15\", is_dev_dep = False),\n struct(repo=\"rust_crates__pldm-common-0.1.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__pldm-interface-0.1.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__proc-macro2-1.0.106\", is_dev_dep = False),\n struct(repo=\"rust_crates__prost-0.13.5\", is_dev_dep = False),\n struct(repo=\"rust_crates__quote-1.0.45\", is_dev_dep = False),\n struct(repo=\"rust_crates__rand_core-0.9.5\", is_dev_dep = False),\n struct(repo=\"rust_crates__riscv-0.12.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__riscv-rt-0.12.2\", is_dev_dep = False),\n struct(repo=\"rust_crates__riscv-semihosting-0.1.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__rustc-demangle-0.1.27\", is_dev_dep = False),\n struct(repo=\"rust_crates__sec1-0.7.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__serde-1.0.228\", is_dev_dep = False),\n struct(repo=\"rust_crates__serde_derive-1.0.228\", is_dev_dep = False),\n struct(repo=\"rust_crates__serde_json5-0.2.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__sha2-0.10.9\", is_dev_dep = False),\n struct(repo=\"rust_crates__sha3-0.10.9\", is_dev_dep = False),\n struct(repo=\"rust_crates__smlang-0.8.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__spdm-lib-0.1.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__subtle-2.6.1\", is_dev_dep = False),\n struct(repo=\"rust_crates__syn-1.0.109\", is_dev_dep = False),\n struct(repo=\"rust_crates__syn-3.0.5\", is_dev_dep = False),\n struct(repo=\"rust_crates__thiserror-2.0.18\", is_dev_dep = False),\n struct(repo=\"rust_crates__tock-registers-0.9.0\", is_dev_dep = False),\n struct(repo=\"rust_crates__tokio-1.52.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__tokio-util-0.7.18\", is_dev_dep = False),\n struct(repo=\"rust_crates__vcell-0.1.3\", is_dev_dep = False),\n struct(repo=\"rust_crates__zerocopy-0.8.52\", is_dev_dep = False),\n struct(repo=\"rust_crates__zeroize-1.9.0\", is_dev_dep = False),\n ]\n" } } }, @@ -2575,7 +2341,7 @@ "https://static.crates.io/crates/bitfield-struct/0.11.0/download" ], "strip_prefix": "bitfield-struct-0.11.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"bitfield_struct\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.118//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=bitfield-struct\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.11.0\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"bitfield_struct\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=bitfield-struct\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.11.0\",\n)\n" } }, "rust_crates__bitflags-2.13.0": { @@ -2719,7 +2485,7 @@ "https://static.crates.io/crates/clap_derive/4.6.1/download" ], "strip_prefix": "clap_derive-4.6.1", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"clap_derive\",\n deps = [\n \"@rust_crates__heck-0.5.0//:heck\",\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.118//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=clap_derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"4.6.1\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"clap_derive\",\n deps = [\n \"@rust_crates__heck-0.5.0//:heck\",\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=clap_derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"4.6.1\",\n)\n" } }, "rust_crates__clap_lex-1.1.0": { @@ -2831,7 +2597,7 @@ "https://static.crates.io/crates/cortex-m-rt-macros/0.7.5/download" ], "strip_prefix": "cortex-m-rt-macros-0.7.5", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"cortex_m_rt_macros\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.118//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cortex-m-rt-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.7.5\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"cortex_m_rt_macros\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cortex-m-rt-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.7.5\",\n)\n" } }, "rust_crates__cortex-m-semihosting-0.5.0": { @@ -3250,20 +3016,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"flate2\",\n deps = [\n \"@rust_crates__crc32fast-1.5.0//:crc32fast\",\n \"@rust_crates__miniz_oxide-0.8.9//:miniz_oxide\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"any_impl\",\n \"default\",\n \"miniz_oxide\",\n \"rust_backend\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=flate2\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.1.9\",\n)\n" } }, - "rust_crates__foldhash-0.1.5": { + "rust_crates__foldhash-0.2.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2", + "sha256": "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/foldhash/0.1.5/download" + "https://static.crates.io/crates/foldhash/0.2.0/download" ], - "strip_prefix": "foldhash-0.1.5", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"foldhash\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=foldhash\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.1.5\",\n)\n" + "strip_prefix": "foldhash-0.2.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"foldhash\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=foldhash\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.0\",\n)\n" } }, "rust_crates__fugit-0.3.9": { @@ -3375,7 +3141,7 @@ "https://static.crates.io/crates/futures-macro/0.3.32/download" ], "strip_prefix": "futures-macro-0.3.32", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"futures_macro\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.118//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures-macro\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.32\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"futures_macro\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures-macro\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.32\",\n)\n" } }, "rust_crates__futures-sink-0.3.32": { @@ -3506,22 +3272,6 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"hash32\",\n deps = [\n \"@rust_crates__byteorder-1.5.0//:byteorder\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2015\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=hash32\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.1\",\n)\n" } }, - "rust_crates__hashbrown-0.15.5": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "patch_args": [], - "patch_tool": "", - "patches": [], - "remote_patch_strip": 1, - "sha256": "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1", - "type": "tar.gz", - "urls": [ - "https://static.crates.io/crates/hashbrown/0.15.5/download" - ], - "strip_prefix": "hashbrown-0.15.5", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"hashbrown\",\n deps = [\n \"@rust_crates__foldhash-0.1.5//:foldhash\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default-hasher\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=hashbrown\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.15.5\",\n)\n" - } - }, "rust_crates__hashbrown-0.17.1": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { @@ -3535,7 +3285,7 @@ "https://static.crates.io/crates/hashbrown/0.17.1/download" ], "strip_prefix": "hashbrown-0.17.1", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"hashbrown\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=hashbrown\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.17.1\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"hashbrown\",\n deps = [\n \"@rust_crates__foldhash-0.2.0//:foldhash\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default-hasher\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=hashbrown\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.17.1\",\n)\n" } }, "rust_crates__heapless-0.8.0": { @@ -3996,20 +3746,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"nom\",\n deps = [\n \"@rust_crates__memchr-2.8.2//:memchr\",\n \"@rust_crates__minimal-lexical-0.2.1//:minimal_lexical\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=nom\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"7.1.3\",\n)\n" } }, - "rust_crates__object-0.37.3": { + "rust_crates__object-0.40.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe", + "sha256": "dd229a0361b9d0d4396176e02d65897f487eebeab7caa6d443855ee152ca0b9c", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/object/0.37.3/download" + "https://static.crates.io/crates/object/0.40.0/download" ], - "strip_prefix": "object-0.37.3", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"object\",\n deps = [\n \"@rust_crates__crc32fast-1.5.0//:crc32fast\",\n \"@rust_crates__flate2-1.1.9//:flate2\",\n \"@rust_crates__hashbrown-0.15.5//:hashbrown\",\n \"@rust_crates__indexmap-2.14.0//:indexmap\",\n \"@rust_crates__memchr-2.8.2//:memchr\",\n \"@rust_crates__object-0.37.3//:build_script_build\",\n \"@rust_crates__ruzstd-0.8.3//:ruzstd\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"archive\",\n \"build\",\n \"build_core\",\n \"coff\",\n \"compression\",\n \"default\",\n \"elf\",\n \"macho\",\n \"pe\",\n \"read\",\n \"read_core\",\n \"std\",\n \"unaligned\",\n \"write\",\n \"write_core\",\n \"write_std\",\n \"xcoff\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=object\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.37.3\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"archive\",\n \"build\",\n \"build_core\",\n \"coff\",\n \"compression\",\n \"default\",\n \"elf\",\n \"macho\",\n \"pe\",\n \"read\",\n \"read_core\",\n \"std\",\n \"unaligned\",\n \"write\",\n \"write_core\",\n \"write_std\",\n \"xcoff\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2018\",\n pkg_name = \"object\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=object\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.37.3\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "strip_prefix": "object-0.40.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"object\",\n deps = [\n \"@rust_crates__crc32fast-1.5.0//:crc32fast\",\n \"@rust_crates__flate2-1.1.9//:flate2\",\n \"@rust_crates__hashbrown-0.17.1//:hashbrown\",\n \"@rust_crates__indexmap-2.14.0//:indexmap\",\n \"@rust_crates__memchr-2.8.2//:memchr\",\n \"@rust_crates__ruzstd-0.9.1//:ruzstd\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"archive\",\n \"build\",\n \"build_core\",\n \"coff\",\n \"compression\",\n \"default\",\n \"elf\",\n \"macho\",\n \"pe\",\n \"read\",\n \"read_core\",\n \"std\",\n \"write\",\n \"write_core\",\n \"write_std\",\n \"xcoff\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=object\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.40.0\",\n)\n" } }, "rust_crates__once_cell_polyfill-1.70.2": { @@ -4199,7 +3949,7 @@ "https://static.crates.io/crates/pest_generator/2.8.6/download" ], "strip_prefix": "pest_generator-2.8.6", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"pest_generator\",\n deps = [\n \"@rust_crates__pest-2.8.6//:pest\",\n \"@rust_crates__pest_meta-2.8.6//:pest_meta\",\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.118//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=pest_generator\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.8.6\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"pest_generator\",\n deps = [\n \"@rust_crates__pest-2.8.6//:pest\",\n \"@rust_crates__pest_meta-2.8.6//:pest_meta\",\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=pest_generator\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.8.6\",\n)\n" } }, "rust_crates__pest_meta-2.8.6": { @@ -4245,7 +3995,7 @@ "remote": "https://github.com/OpenPRoT/pldm-lib.git", "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"pldm_common\",\n deps = [\n \"@rust_crates__bitfield-0.14.0//:bitfield\",\n \"@rust_crates__zerocopy-0.8.52//:zerocopy\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=pldm-common\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.1.0\",\n)\n", "strip_prefix": "pldm-common", - "commit": "c709ae4adbc28b168f10e4a4531149abf5116b92" + "commit": "3d2fcf47ff14a71505d464a82bc2d7b110712d63" } }, "rust_crates__pldm-interface-0.1.0": { @@ -4259,7 +4009,7 @@ "remote": "https://github.com/OpenPRoT/pldm-lib.git", "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"pldm_interface\",\n deps = [\n \"@rust_crates__bitfield-0.14.0//:bitfield\",\n \"@rust_crates__pldm-common-0.1.0//:pldm_common\",\n \"@rust_crates__zerocopy-0.8.52//:zerocopy\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=pldm-interface\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.1.0\",\n)\n", "strip_prefix": "pldm-interface", - "commit": "c709ae4adbc28b168f10e4a4531149abf5116b92" + "commit": "3d2fcf47ff14a71505d464a82bc2d7b110712d63" } }, "rust_crates__polyval-0.6.2": { @@ -4339,7 +4089,7 @@ "https://static.crates.io/crates/prost-derive/0.13.5/download" ], "strip_prefix": "prost-derive-0.13.5", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"prost_derive\",\n deps = [\n \"@rust_crates__anyhow-1.0.103//:anyhow\",\n \"@rust_crates__itertools-0.14.0//:itertools\",\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.118//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=prost-derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.13.5\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"prost_derive\",\n deps = [\n \"@rust_crates__anyhow-1.0.103//:anyhow\",\n \"@rust_crates__itertools-0.14.0//:itertools\",\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=prost-derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.13.5\",\n)\n" } }, "rust_crates__quote-1.0.45": { @@ -4483,7 +4233,7 @@ "https://static.crates.io/crates/riscv-macros/0.1.0/download" ], "strip_prefix": "riscv-macros-0.1.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"riscv_macros\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.118//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=riscv-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.1.0\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"riscv_macros\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=riscv-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.1.0\",\n)\n" } }, "rust_crates__riscv-macros-0.2.0": { @@ -4499,7 +4249,7 @@ "https://static.crates.io/crates/riscv-macros/0.2.0/download" ], "strip_prefix": "riscv-macros-0.2.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"riscv_macros\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.118//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=riscv-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.0\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"riscv_macros\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=riscv-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.0\",\n)\n" } }, "rust_crates__riscv-pac-0.2.0": { @@ -4547,7 +4297,7 @@ "https://static.crates.io/crates/riscv-rt-macros/0.2.2/download" ], "strip_prefix": "riscv-rt-macros-0.2.2", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"riscv_rt_macros\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.118//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=riscv-rt-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.2\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"riscv_rt_macros\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=riscv-rt-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.2\",\n)\n" } }, "rust_crates__riscv-semihosting-0.1.3": { @@ -4614,20 +4364,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"rustix\",\n deps = [\n \"@rust_crates__bitflags-2.13.0//:bitflags\",\n \"@rust_crates__rustix-1.1.4//:build_script_build\",\n ] + select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [\n \"@rust_crates__errno-0.3.14//:errno\", # aarch64-apple-darwin, cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_endian = \"little\", any(target_arch = \"s390x\", target_arch = \"powerpc\")), any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc\"), all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"s390x\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\")))))))\n \"@rust_crates__libc-0.2.186//:libc\", # aarch64-apple-darwin, cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_endian = \"little\", any(target_arch = \"s390x\", target_arch = \"powerpc\")), any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc\"), all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"s390x\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\")))))))\n ],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [\n \"@rust_crates__linux-raw-sys-0.12.1//:linux_raw_sys\", # cfg(all(not(rustix_use_libc), not(miri), target_os = \"linux\", any(target_endian = \"little\", any(target_arch = \"s390x\", target_arch = \"powerpc\")), any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc\"), all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"s390x\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"))))\n ],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [\n \"@rust_crates__errno-0.3.14//:errno\", # cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_endian = \"little\", any(target_arch = \"s390x\", target_arch = \"powerpc\")), any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc\"), all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"s390x\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\")))))))\n \"@rust_crates__libc-0.2.186//:libc\", # cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_endian = \"little\", any(target_arch = \"s390x\", target_arch = \"powerpc\")), any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc\"), all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"s390x\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\")))))))\n ],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [\n \"@rust_crates__errno-0.3.14//:errno\", # cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_endian = \"little\", any(target_arch = \"s390x\", target_arch = \"powerpc\")), any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc\"), all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"s390x\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\")))))))\n \"@rust_crates__libc-0.2.186//:libc\", # cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_endian = \"little\", any(target_arch = \"s390x\", target_arch = \"powerpc\")), any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc\"), all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"s390x\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\")))))))\n ],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [\n \"@rust_crates__errno-0.3.14//:errno\", # cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_endian = \"little\", any(target_arch = \"s390x\", target_arch = \"powerpc\")), any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc\"), all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"s390x\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"))))))), x86_64-apple-darwin\n \"@rust_crates__libc-0.2.186//:libc\", # cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_endian = \"little\", any(target_arch = \"s390x\", target_arch = \"powerpc\")), any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc\"), all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"s390x\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"))))))), x86_64-apple-darwin\n ],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [\n \"@rust_crates__linux-raw-sys-0.12.1//:linux_raw_sys\", # cfg(all(not(rustix_use_libc), not(miri), target_os = \"linux\", any(target_endian = \"little\", any(target_arch = \"s390x\", target_arch = \"powerpc\")), any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc\"), all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"s390x\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"))))\n ],\n \"//conditions:default\": [],\n }),\n aliases = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": {\n \"@rust_crates__errno-0.3.14//:errno\": \"libc_errno\", # aarch64-apple-darwin, cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_endian = \"little\", any(target_arch = \"s390x\", target_arch = \"powerpc\")), any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc\"), all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"s390x\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\")))))))\n },\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": {\n \"@rust_crates__errno-0.3.14//:errno\": \"libc_errno\", # cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_endian = \"little\", any(target_arch = \"s390x\", target_arch = \"powerpc\")), any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc\"), all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"s390x\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\")))))))\n },\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": {\n \"@rust_crates__errno-0.3.14//:errno\": \"libc_errno\", # cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_endian = \"little\", any(target_arch = \"s390x\", target_arch = \"powerpc\")), any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc\"), all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"s390x\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\")))))))\n },\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": {\n \"@rust_crates__errno-0.3.14//:errno\": \"libc_errno\", # cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_endian = \"little\", any(target_arch = \"s390x\", target_arch = \"powerpc\")), any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc\"), all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"s390x\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"))))))), x86_64-apple-darwin\n },\n \"//conditions:default\": {},\n }),\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"default\",\n \"std\",\n \"termios\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=rustix\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.1.4\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"default\",\n \"std\",\n \"termios\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"rustix\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=rustix\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"1.1.4\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, - "rust_crates__ruzstd-0.8.3": { + "rust_crates__ruzstd-0.9.1": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "a7c1c839d570d835527c9a5e4db7cb2198683a988cb9d7293fc8674e6bd58fc8", + "sha256": "69e4ce4a039f42bf25920b95667e4d789e98749ab11bbb8d2c2936f788421bb5", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/ruzstd/0.8.3/download" + "https://static.crates.io/crates/ruzstd/0.9.1/download" ], - "strip_prefix": "ruzstd-0.8.3", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"ruzstd\",\n deps = [\n \"@rust_crates__twox-hash-2.1.2//:twox_hash\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"hash\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=ruzstd\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.8.3\",\n)\n" + "strip_prefix": "ruzstd-0.9.1", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"ruzstd\",\n deps = [\n \"@rust_crates__twox-hash-2.1.2//:twox_hash\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"hash\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=ruzstd\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.9.1\",\n)\n" } }, "rust_crates__scopeguard-1.2.0": { @@ -4739,7 +4489,7 @@ "https://static.crates.io/crates/serde_derive/1.0.228/download" ], "strip_prefix": "serde_derive-1.0.228", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"serde_derive\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.118//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=serde_derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.0.228\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"serde_derive\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=serde_derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.0.228\",\n)\n" } }, "rust_crates__serde_json5-0.2.1": { @@ -5028,20 +4778,36 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"syn\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-1.0.109//:build_script_build\",\n \"@rust_crates__unicode-ident-1.0.24//:unicode_ident\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"clone-impls\",\n \"default\",\n \"derive\",\n \"extra-traits\",\n \"full\",\n \"parsing\",\n \"printing\",\n \"proc-macro\",\n \"quote\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=syn\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.0.109\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"clone-impls\",\n \"default\",\n \"derive\",\n \"extra-traits\",\n \"full\",\n \"parsing\",\n \"printing\",\n \"proc-macro\",\n \"quote\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2018\",\n pkg_name = \"syn\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=syn\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"1.0.109\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, - "rust_crates__syn-2.0.118": { + "rust_crates__syn-2.0.119": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "patch_args": [], + "patch_tool": "", + "patches": [], + "remote_patch_strip": 1, + "sha256": "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/syn/2.0.119/download" + ], + "strip_prefix": "syn-2.0.119", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"syn\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__unicode-ident-1.0.24//:unicode_ident\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"clone-impls\",\n \"default\",\n \"derive\",\n \"extra-traits\",\n \"full\",\n \"parsing\",\n \"printing\",\n \"proc-macro\",\n \"visit\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=syn\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.0.119\",\n)\n" + } + }, + "rust_crates__syn-3.0.5": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422", + "sha256": "12df2e0110f65b775f769bb17ef989067a1d931b2eb822bd4346631eeada89f9", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/syn/2.0.118/download" + "https://static.crates.io/crates/syn/3.0.5/download" ], - "strip_prefix": "syn-2.0.118", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"syn\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__unicode-ident-1.0.24//:unicode_ident\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"clone-impls\",\n \"default\",\n \"derive\",\n \"extra-traits\",\n \"full\",\n \"parsing\",\n \"printing\",\n \"proc-macro\",\n ] + select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [\n \"visit\", # aarch64-apple-darwin\n ],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [\n \"visit\", # aarch64-unknown-linux-gnu\n ],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [\n \"visit\", # x86_64-apple-darwin\n ],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [\n \"visit\", # x86_64-unknown-linux-gnu\n ],\n \"//conditions:default\": [],\n }),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=syn\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.0.118\",\n)\n" + "strip_prefix": "syn-3.0.5", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"syn\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__unicode-ident-1.0.24//:unicode_ident\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"clone-impls\",\n \"default\",\n \"derive\",\n \"extra-traits\",\n \"full\",\n \"parsing\",\n \"printing\",\n \"proc-macro\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=syn\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"3.0.5\",\n)\n" } }, "rust_crates__terminal_size-0.4.4": { @@ -5089,7 +4855,7 @@ "https://static.crates.io/crates/thiserror-impl/2.0.18/download" ], "strip_prefix": "thiserror-impl-2.0.18", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"thiserror_impl\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.118//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=thiserror-impl\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.0.18\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"thiserror_impl\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=thiserror-impl\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.0.18\",\n)\n" } }, "rust_crates__tock-registers-0.9.0": { @@ -5135,7 +4901,7 @@ "https://static.crates.io/crates/tokio-macros/2.7.0/download" ], "strip_prefix": "tokio-macros-2.7.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"tokio_macros\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.118//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=tokio-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.7.0\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"tokio_macros\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=tokio-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.7.0\",\n)\n" } }, "rust_crates__tokio-util-0.7.18": { @@ -5407,7 +5173,7 @@ "https://static.crates.io/crates/zerocopy-derive/0.8.52/download" ], "strip_prefix": "zerocopy-derive-0.8.52", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"zerocopy_derive\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.118//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=zerocopy-derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.8.52\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"zerocopy_derive\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=zerocopy-derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.8.52\",\n)\n" } }, "rust_crates__zeroize-1.9.0": { @@ -5439,49 +5205,49 @@ "https://static.crates.io/crates/zeroize_derive/1.5.0/download" ], "strip_prefix": "zeroize_derive-1.5.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"zeroize_derive\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.118//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=zeroize_derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.5.0\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'openprot'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"zeroize_derive\",\n deps = [\n \"@rust_crates__proc-macro2-1.0.106//:proc_macro2\",\n \"@rust_crates__quote-1.0.45//:quote\",\n \"@rust_crates__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=zeroize_derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv7em-none-eabi\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.5.0\",\n)\n" } }, "crates_no_std": { "repoRuleId": "@@rules_rust+//crate_universe:extensions.bzl%_generate_repo", "attributes": { "contents": { - "BUILD.bazel": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files(\n [\n \"cargo-bazel.json\",\n \"crates.bzl\",\n \"defs.bzl\",\n ] + glob(\n allow_empty = True,\n include = [\"*.bazel\"],\n ),\n)\n\nfilegroup(\n name = \"srcs\",\n srcs = glob(\n allow_empty = True,\n include = [\n \"*.bazel\",\n \"*.bzl\",\n ],\n ),\n)\n\n# Workspace Member Dependencies\nalias(\n name = \"bitflags-2.11.1\",\n actual = \"@crates_no_std__bitflags-2.11.1//:bitflags\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitflags\",\n actual = \"@crates_no_std__bitflags-2.11.1//:bitflags\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"byteorder-1.5.0\",\n actual = \"@crates_no_std__byteorder-1.5.0//:byteorder\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"byteorder\",\n actual = \"@crates_no_std__byteorder-1.5.0//:byteorder\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-0.7.7\",\n actual = \"@crates_no_std__cortex-m-0.7.7//:cortex_m\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m\",\n actual = \"@crates_no_std__cortex-m-0.7.7//:cortex_m\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-rt-0.7.5\",\n actual = \"@crates_no_std__cortex-m-rt-0.7.5//:cortex_m_rt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-rt\",\n actual = \"@crates_no_std__cortex-m-rt-0.7.5//:cortex_m_rt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-semihosting-0.5.0\",\n actual = \"@crates_no_std__cortex-m-semihosting-0.5.0//:cortex_m_semihosting\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-semihosting\",\n actual = \"@crates_no_std__cortex-m-semihosting-0.5.0//:cortex_m_semihosting\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-io-0.7.1\",\n actual = \"@crates_no_std__embedded-io-0.7.1//:embedded_io\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-io\",\n actual = \"@crates_no_std__embedded-io-0.7.1//:embedded_io\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"intrusive-collections-0.9.7\",\n actual = \"@crates_no_std__intrusive-collections-0.9.7//:intrusive_collections\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"intrusive-collections\",\n actual = \"@crates_no_std__intrusive-collections-0.9.7//:intrusive_collections\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"panic-halt-1.0.0\",\n actual = \"@crates_no_std__panic-halt-1.0.0//:panic_halt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"panic-halt\",\n actual = \"@crates_no_std__panic-halt-1.0.0//:panic_halt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"paste-1.0.15\",\n actual = \"@crates_no_std__paste-1.0.15//:paste\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"paste\",\n actual = \"@crates_no_std__paste-1.0.15//:paste\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-0.16.1\",\n actual = \"@crates_no_std__riscv-0.16.1//:riscv\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv\",\n actual = \"@crates_no_std__riscv-0.16.1//:riscv\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-rt-0.12.2\",\n actual = \"@crates_no_std__riscv-rt-0.12.2//:riscv_rt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-rt\",\n actual = \"@crates_no_std__riscv-rt-0.12.2//:riscv_rt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-semihosting-0.2.1\",\n actual = \"@crates_no_std__riscv-semihosting-0.2.1//:riscv_semihosting\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-semihosting\",\n actual = \"@crates_no_std__riscv-semihosting-0.2.1//:riscv_semihosting\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"rp235x-hal-0.4.0\",\n actual = \"@crates_no_std__rp235x-hal-0.4.0//:rp235x_hal\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"rp235x-hal\",\n actual = \"@crates_no_std__rp235x-hal-0.4.0//:rp235x_hal\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zerocopy-0.8.48\",\n actual = \"@crates_no_std__zerocopy-0.8.48//:zerocopy\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zerocopy\",\n actual = \"@crates_no_std__zerocopy-0.8.48//:zerocopy\",\n tags = [\"manual\"],\n)\n", + "BUILD.bazel": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files(\n [\n \"cargo-bazel.json\",\n \"crates.bzl\",\n \"defs.bzl\",\n ] + glob(\n allow_empty = True,\n include = [\"*.bazel\"],\n ),\n)\n\nfilegroup(\n name = \"srcs\",\n srcs = glob(\n allow_empty = True,\n include = [\n \"*.bazel\",\n \"*.bzl\",\n ],\n ),\n)\n\n# Workspace Member Dependencies\nalias(\n name = \"bitflags-2.13.1\",\n actual = \"@crates_no_std__bitflags-2.13.1//:bitflags\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitflags\",\n actual = \"@crates_no_std__bitflags-2.13.1//:bitflags\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"byteorder-1.5.0\",\n actual = \"@crates_no_std__byteorder-1.5.0//:byteorder\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"byteorder\",\n actual = \"@crates_no_std__byteorder-1.5.0//:byteorder\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-0.7.9\",\n actual = \"@crates_no_std__cortex-m-0.7.9//:cortex_m\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m\",\n actual = \"@crates_no_std__cortex-m-0.7.9//:cortex_m\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-rt-0.7.6\",\n actual = \"@crates_no_std__cortex-m-rt-0.7.6//:cortex_m_rt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-rt\",\n actual = \"@crates_no_std__cortex-m-rt-0.7.6//:cortex_m_rt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-semihosting-0.6.0\",\n actual = \"@crates_no_std__cortex-m-semihosting-0.6.0//:cortex_m_semihosting\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cortex-m-semihosting\",\n actual = \"@crates_no_std__cortex-m-semihosting-0.6.0//:cortex_m_semihosting\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-io-0.7.1\",\n actual = \"@crates_no_std__embedded-io-0.7.1//:embedded_io\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"embedded-io\",\n actual = \"@crates_no_std__embedded-io-0.7.1//:embedded_io\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"panic-halt-1.0.0\",\n actual = \"@crates_no_std__panic-halt-1.0.0//:panic_halt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"panic-halt\",\n actual = \"@crates_no_std__panic-halt-1.0.0//:panic_halt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"paste-1.0.15\",\n actual = \"@crates_no_std__paste-1.0.15//:paste\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"paste\",\n actual = \"@crates_no_std__paste-1.0.15//:paste\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-0.16.1\",\n actual = \"@crates_no_std__riscv-0.16.1//:riscv\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv\",\n actual = \"@crates_no_std__riscv-0.16.1//:riscv\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-rt-0.12.2\",\n actual = \"@crates_no_std__riscv-rt-0.12.2//:riscv_rt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-rt\",\n actual = \"@crates_no_std__riscv-rt-0.12.2//:riscv_rt\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-semihosting-0.2.1\",\n actual = \"@crates_no_std__riscv-semihosting-0.2.1//:riscv_semihosting\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"riscv-semihosting\",\n actual = \"@crates_no_std__riscv-semihosting-0.2.1//:riscv_semihosting\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"rp235x-hal-0.4.0\",\n actual = \"@crates_no_std__rp235x-hal-0.4.0//:rp235x_hal\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"rp235x-hal\",\n actual = \"@crates_no_std__rp235x-hal-0.4.0//:rp235x_hal\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zerocopy-0.8.56\",\n actual = \"@crates_no_std__zerocopy-0.8.56//:zerocopy\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zerocopy\",\n actual = \"@crates_no_std__zerocopy-0.8.56//:zerocopy\",\n tags = [\"manual\"],\n)\n", "alias_rules.bzl": "\"\"\"Alias that transitions its target to `compilation_mode=opt`. Use `transition_alias=\"opt\"` to enable.\"\"\"\n\nload(\"@rules_cc//cc:defs.bzl\", \"CcInfo\")\nload(\"@rules_rust//rust:rust_common.bzl\", \"COMMON_PROVIDERS\")\n\ndef _transition_alias_impl(ctx):\n # `ctx.attr.actual` is a list of 1 item due to the transition\n providers = [ctx.attr.actual[0][provider] for provider in COMMON_PROVIDERS]\n if CcInfo in ctx.attr.actual[0]:\n providers.append(ctx.attr.actual[0][CcInfo])\n return providers\n\ndef _change_compilation_mode(compilation_mode):\n def _change_compilation_mode_impl(_settings, _attr):\n return {\n \"//command_line_option:compilation_mode\": compilation_mode,\n }\n\n return transition(\n implementation = _change_compilation_mode_impl,\n inputs = [],\n outputs = [\n \"//command_line_option:compilation_mode\",\n ],\n )\n\ndef _transition_alias_rule(compilation_mode):\n return rule(\n implementation = _transition_alias_impl,\n provides = COMMON_PROVIDERS,\n attrs = {\n \"actual\": attr.label(\n mandatory = True,\n doc = \"`rust_library()` target to transition to `compilation_mode=opt`.\",\n providers = COMMON_PROVIDERS,\n cfg = _change_compilation_mode(compilation_mode),\n ),\n \"_allowlist_function_transition\": attr.label(\n default = \"@bazel_tools//tools/allowlists/function_transition_allowlist\",\n ),\n },\n doc = \"Transitions a Rust library crate to the `compilation_mode=opt`.\",\n )\n\ntransition_alias_dbg = _transition_alias_rule(\"dbg\")\ntransition_alias_fastbuild = _transition_alias_rule(\"fastbuild\")\ntransition_alias_opt = _transition_alias_rule(\"opt\")\n", - "defs.bzl": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\"\"\"\n# `crates_repository` API\n\n- [aliases](#aliases)\n- [crate_deps](#crate_deps)\n- [all_crate_deps](#all_crate_deps)\n- [crate_repositories](#crate_repositories)\n\n\"\"\"\n\nload(\"@bazel_tools//tools/build_defs/repo:git.bzl\", \"git_repository\")\nload(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\")\nload(\"@bazel_tools//tools/build_defs/repo:utils.bzl\", \"maybe\")\nload(\"@bazel_skylib//lib:selects.bzl\", \"selects\")\nload(\"@rules_rust//crate_universe/private:local_crate_mirror.bzl\", \"local_crate_mirror\")\n\n###############################################################################\n# MACROS API\n###############################################################################\n\n# An identifier that represent common dependencies (unconditional).\n_COMMON_CONDITION = \"\"\n\ndef _flatten_dependency_maps(all_dependency_maps):\n \"\"\"Flatten a list of dependency maps into one dictionary.\n\n Dependency maps have the following structure:\n\n ```python\n DEPENDENCIES_MAP = {\n # The first key in the map is a Bazel package\n # name of the workspace this file is defined in.\n \"workspace_member_package\": {\n\n # Not all dependencies are supported for all platforms.\n # the condition key is the condition required to be true\n # on the host platform.\n \"condition\": {\n\n # An alias to a crate target. # The label of the crate target the\n # Aliases are only crate names. # package name refers to.\n \"package_name\": \"@full//:label\",\n }\n }\n }\n ```\n\n Args:\n all_dependency_maps (list): A list of dicts as described above\n\n Returns:\n dict: A dictionary as described above\n \"\"\"\n dependencies = {}\n\n for workspace_deps_map in all_dependency_maps:\n for pkg_name, conditional_deps_map in workspace_deps_map.items():\n if pkg_name not in dependencies:\n non_frozen_map = dict()\n for key, values in conditional_deps_map.items():\n non_frozen_map.update({key: dict(values.items())})\n dependencies.setdefault(pkg_name, non_frozen_map)\n continue\n\n for condition, deps_map in conditional_deps_map.items():\n # If the condition has not been recorded, do so and continue\n if condition not in dependencies[pkg_name]:\n dependencies[pkg_name].setdefault(condition, dict(deps_map.items()))\n continue\n\n # Alert on any miss-matched dependencies\n inconsistent_entries = []\n for crate_name, crate_label in deps_map.items():\n existing = dependencies[pkg_name][condition].get(crate_name)\n if existing and existing != crate_label:\n inconsistent_entries.append((crate_name, existing, crate_label))\n dependencies[pkg_name][condition].update({crate_name: crate_label})\n\n return dependencies\n\ndef crate_deps(deps, package_name = None):\n \"\"\"Finds the fully qualified label of the requested crates for the package where this macro is called.\n\n Args:\n deps (list): The desired list of crate targets.\n package_name (str, optional): The package name of the set of dependencies to look up.\n Defaults to `native.package_name()`.\n\n Returns:\n list: A list of labels to generated rust targets (str)\n \"\"\"\n\n if not deps:\n return []\n\n if package_name == None:\n package_name = native.package_name()\n\n # Join both sets of dependencies\n dependencies = _flatten_dependency_maps([\n _NORMAL_DEPENDENCIES,\n _NORMAL_DEV_DEPENDENCIES,\n _PROC_MACRO_DEPENDENCIES,\n _PROC_MACRO_DEV_DEPENDENCIES,\n _BUILD_DEPENDENCIES,\n _BUILD_PROC_MACRO_DEPENDENCIES,\n ]).pop(package_name, {})\n\n # Combine all conditional packages so we can easily index over a flat list\n # TODO: Perhaps this should actually return select statements and maintain\n # the conditionals of the dependencies\n flat_deps = {}\n for deps_set in dependencies.values():\n for crate_name, crate_label in deps_set.items():\n flat_deps.update({crate_name: crate_label})\n\n missing_crates = []\n crate_targets = []\n for crate_target in deps:\n if crate_target not in flat_deps:\n missing_crates.append(crate_target)\n else:\n crate_targets.append(flat_deps[crate_target])\n\n if missing_crates:\n fail(\"Could not find crates `{}` among dependencies of `{}`. Available dependencies were `{}`\".format(\n missing_crates,\n package_name,\n dependencies,\n ))\n\n return crate_targets\n\ndef all_crate_deps(\n normal = False, \n normal_dev = False, \n proc_macro = False, \n proc_macro_dev = False,\n build = False,\n build_proc_macro = False,\n package_name = None):\n \"\"\"Finds the fully qualified label of all requested direct crate dependencies \\\n for the package where this macro is called.\n\n If no parameters are set, all normal dependencies are returned. Setting any one flag will\n otherwise impact the contents of the returned list.\n\n Args:\n normal (bool, optional): If True, normal dependencies are included in the\n output list.\n normal_dev (bool, optional): If True, normal dev dependencies will be\n included in the output list.\n proc_macro (bool, optional): If True, proc_macro dependencies are included\n in the output list.\n proc_macro_dev (bool, optional): If True, dev proc_macro dependencies are\n included in the output list.\n build (bool, optional): If True, build dependencies are included\n in the output list.\n build_proc_macro (bool, optional): If True, build proc_macro dependencies are\n included in the output list.\n package_name (str, optional): The package name of the set of dependencies to look up.\n Defaults to `native.package_name()` when unset.\n\n Returns:\n list: A list of labels to generated rust targets (str)\n \"\"\"\n\n if package_name == None:\n package_name = native.package_name()\n\n # Determine the relevant maps to use\n all_dependency_maps = []\n if normal:\n all_dependency_maps.append(_NORMAL_DEPENDENCIES)\n if normal_dev:\n all_dependency_maps.append(_NORMAL_DEV_DEPENDENCIES)\n if proc_macro:\n all_dependency_maps.append(_PROC_MACRO_DEPENDENCIES)\n if proc_macro_dev:\n all_dependency_maps.append(_PROC_MACRO_DEV_DEPENDENCIES)\n if build:\n all_dependency_maps.append(_BUILD_DEPENDENCIES)\n if build_proc_macro:\n all_dependency_maps.append(_BUILD_PROC_MACRO_DEPENDENCIES)\n\n # Default to always using normal dependencies\n if not all_dependency_maps:\n all_dependency_maps.append(_NORMAL_DEPENDENCIES)\n\n dependencies = _flatten_dependency_maps(all_dependency_maps).pop(package_name, None)\n\n if not dependencies:\n if dependencies == None:\n fail(\"Tried to get all_crate_deps for package \" + package_name + \" but that package had no Cargo.toml file\")\n else:\n return []\n\n crate_deps = list(dependencies.pop(_COMMON_CONDITION, {}).values())\n for condition, deps in dependencies.items():\n crate_deps += selects.with_or({\n tuple(_CONDITIONS[condition]): deps.values(),\n \"//conditions:default\": [],\n })\n\n return crate_deps\n\ndef aliases(\n normal = False,\n normal_dev = False,\n proc_macro = False,\n proc_macro_dev = False,\n build = False,\n build_proc_macro = False,\n package_name = None):\n \"\"\"Produces a map of Crate alias names to their original label\n\n If no dependency kinds are specified, `normal` and `proc_macro` are used by default.\n Setting any one flag will otherwise determine the contents of the returned dict.\n\n Args:\n normal (bool, optional): If True, normal dependencies are included in the\n output list.\n normal_dev (bool, optional): If True, normal dev dependencies will be\n included in the output list..\n proc_macro (bool, optional): If True, proc_macro dependencies are included\n in the output list.\n proc_macro_dev (bool, optional): If True, dev proc_macro dependencies are\n included in the output list.\n build (bool, optional): If True, build dependencies are included\n in the output list.\n build_proc_macro (bool, optional): If True, build proc_macro dependencies are\n included in the output list.\n package_name (str, optional): The package name of the set of dependencies to look up.\n Defaults to `native.package_name()` when unset.\n\n Returns:\n dict: The aliases of all associated packages\n \"\"\"\n if package_name == None:\n package_name = native.package_name()\n\n # Determine the relevant maps to use\n all_aliases_maps = []\n if normal:\n all_aliases_maps.append(_NORMAL_ALIASES)\n if normal_dev:\n all_aliases_maps.append(_NORMAL_DEV_ALIASES)\n if proc_macro:\n all_aliases_maps.append(_PROC_MACRO_ALIASES)\n if proc_macro_dev:\n all_aliases_maps.append(_PROC_MACRO_DEV_ALIASES)\n if build:\n all_aliases_maps.append(_BUILD_ALIASES)\n if build_proc_macro:\n all_aliases_maps.append(_BUILD_PROC_MACRO_ALIASES)\n\n # Default to always using normal aliases\n if not all_aliases_maps:\n all_aliases_maps.append(_NORMAL_ALIASES)\n all_aliases_maps.append(_PROC_MACRO_ALIASES)\n\n aliases = _flatten_dependency_maps(all_aliases_maps).pop(package_name, None)\n\n if not aliases:\n return dict()\n\n common_items = aliases.pop(_COMMON_CONDITION, {}).items()\n\n # If there are only common items in the dictionary, immediately return them\n if not len(aliases.keys()) == 1:\n return dict(common_items)\n\n # Build a single select statement where each conditional has accounted for the\n # common set of aliases.\n crate_aliases = {\"//conditions:default\": dict(common_items)}\n for condition, deps in aliases.items():\n condition_triples = _CONDITIONS[condition]\n for triple in condition_triples:\n if triple in crate_aliases:\n crate_aliases[triple].update(deps)\n else:\n crate_aliases.update({triple: dict(deps.items() + common_items)})\n\n return select(crate_aliases)\n\n###############################################################################\n# WORKSPACE MEMBER DEPS AND ALIASES\n###############################################################################\n\n_NORMAL_DEPENDENCIES = {\n \"third_party/crates_io/crates_no_std\": {\n _COMMON_CONDITION: {\n \"bitflags\": Label(\"@crates_no_std//:bitflags-2.11.1\"),\n \"byteorder\": Label(\"@crates_no_std//:byteorder-1.5.0\"),\n \"cortex-m\": Label(\"@crates_no_std//:cortex-m-0.7.7\"),\n \"cortex-m-rt\": Label(\"@crates_no_std//:cortex-m-rt-0.7.5\"),\n \"cortex-m-semihosting\": Label(\"@crates_no_std//:cortex-m-semihosting-0.5.0\"),\n \"embedded-io\": Label(\"@crates_no_std//:embedded-io-0.7.1\"),\n \"intrusive-collections\": Label(\"@crates_no_std//:intrusive-collections-0.9.7\"),\n \"panic-halt\": Label(\"@crates_no_std//:panic-halt-1.0.0\"),\n \"riscv\": Label(\"@crates_no_std//:riscv-0.16.1\"),\n \"riscv-rt\": Label(\"@crates_no_std//:riscv-rt-0.12.2\"),\n \"riscv-semihosting\": Label(\"@crates_no_std//:riscv-semihosting-0.2.1\"),\n \"rp235x-hal\": Label(\"@crates_no_std//:rp235x-hal-0.4.0\"),\n \"zerocopy\": Label(\"@crates_no_std//:zerocopy-0.8.48\"),\n },\n },\n}\n\n\n_NORMAL_ALIASES = {\n \"third_party/crates_io/crates_no_std\": {\n _COMMON_CONDITION: {\n },\n },\n}\n\n\n_NORMAL_DEV_DEPENDENCIES = {\n \"third_party/crates_io/crates_no_std\": {\n },\n}\n\n\n_NORMAL_DEV_ALIASES = {\n \"third_party/crates_io/crates_no_std\": {\n },\n}\n\n\n_PROC_MACRO_DEPENDENCIES = {\n \"third_party/crates_io/crates_no_std\": {\n _COMMON_CONDITION: {\n \"paste\": Label(\"@crates_no_std//:paste-1.0.15\"),\n },\n },\n}\n\n\n_PROC_MACRO_ALIASES = {\n \"third_party/crates_io/crates_no_std\": {\n },\n}\n\n\n_PROC_MACRO_DEV_DEPENDENCIES = {\n \"third_party/crates_io/crates_no_std\": {\n },\n}\n\n\n_PROC_MACRO_DEV_ALIASES = {\n \"third_party/crates_io/crates_no_std\": {\n },\n}\n\n\n_BUILD_DEPENDENCIES = {\n \"third_party/crates_io/crates_no_std\": {\n },\n}\n\n\n_BUILD_ALIASES = {\n \"third_party/crates_io/crates_no_std\": {\n },\n}\n\n\n_BUILD_PROC_MACRO_DEPENDENCIES = {\n \"third_party/crates_io/crates_no_std\": {\n },\n}\n\n\n_BUILD_PROC_MACRO_ALIASES = {\n \"third_party/crates_io/crates_no_std\": {\n },\n}\n\n\n_CONDITIONS = {\n \"aarch64-apple-darwin\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\"],\n \"aarch64-linux-android\": [],\n \"aarch64-unknown-linux-gnu\": [\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\"],\n \"aarch64-unknown-none\": [\"@rules_rust//rust/platform:aarch64-unknown-none\"],\n \"cfg(all(target_arch = \\\"aarch64\\\", target_os = \\\"linux\\\"))\": [\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\"],\n \"cfg(all(target_arch = \\\"aarch64\\\", target_vendor = \\\"apple\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\"],\n \"cfg(all(target_arch = \\\"loongarch64\\\", target_os = \\\"linux\\\"))\": [],\n \"cfg(target_arch = \\\"aarch64\\\")\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:aarch64-unknown-none\"],\n \"cfg(target_os = \\\"redox\\\")\": [],\n \"cfg(unix)\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(windows)\": [],\n \"riscv32imac-unknown-none-elf\": [\"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\"],\n \"riscv32imc-unknown-none-elf\": [\"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\"],\n \"thumbv6m-none-eabi\": [\"@rules_rust//rust/platform:thumbv6m-none-eabi\"],\n \"thumbv7m-none-eabi\": [\"@rules_rust//rust/platform:thumbv7m-none-eabi\"],\n \"thumbv8m.main-none-eabi\": [],\n \"thumbv8m.main-none-eabihf\": [\"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\"],\n \"x86_64-apple-darwin\": [\"@rules_rust//rust/platform:x86_64-apple-darwin\"],\n \"x86_64-unknown-linux-gnu\": [\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n}\n\n###############################################################################\n\ndef crate_repositories():\n \"\"\"A macro for defining repositories for all generated crates.\n\n Returns:\n A list of repos visible to the module through the module extension.\n \"\"\"\n maybe(\n http_archive,\n name = \"crates_no_std__aho-corasick-1.1.4\",\n sha256 = \"ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/aho-corasick/1.1.4/download\"],\n strip_prefix = \"aho-corasick-1.1.4\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.aho-corasick-1.1.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__arrayvec-0.7.6\",\n sha256 = \"7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/arrayvec/0.7.6/download\"],\n strip_prefix = \"arrayvec-0.7.6\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.arrayvec-0.7.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__ascii-canvas-4.0.0\",\n sha256 = \"ef1e3e699d84ab1b0911a1010c5c106aa34ae89aeac103be5ce0c3859db1e891\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ascii-canvas/4.0.0/download\"],\n strip_prefix = \"ascii-canvas-4.0.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.ascii-canvas-4.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__autocfg-1.5.0\",\n sha256 = \"c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/autocfg/1.5.0/download\"],\n strip_prefix = \"autocfg-1.5.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.autocfg-1.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__bare-metal-0.2.5\",\n sha256 = \"5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bare-metal/0.2.5/download\"],\n strip_prefix = \"bare-metal-0.2.5\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.bare-metal-0.2.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__bit-set-0.8.0\",\n sha256 = \"08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bit-set/0.8.0/download\"],\n strip_prefix = \"bit-set-0.8.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.bit-set-0.8.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__bit-vec-0.8.0\",\n sha256 = \"5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bit-vec/0.8.0/download\"],\n strip_prefix = \"bit-vec-0.8.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.bit-vec-0.8.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__bitfield-0.13.2\",\n sha256 = \"46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bitfield/0.13.2/download\"],\n strip_prefix = \"bitfield-0.13.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.bitfield-0.13.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__bitfield-0.14.0\",\n sha256 = \"2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bitfield/0.14.0/download\"],\n strip_prefix = \"bitfield-0.14.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.bitfield-0.14.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__bitflags-2.11.1\",\n sha256 = \"c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bitflags/2.11.1/download\"],\n strip_prefix = \"bitflags-2.11.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.bitflags-2.11.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__block-buffer-0.10.4\",\n sha256 = \"3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/block-buffer/0.10.4/download\"],\n strip_prefix = \"block-buffer-0.10.4\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.block-buffer-0.10.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__byteorder-1.5.0\",\n sha256 = \"1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/byteorder/1.5.0/download\"],\n strip_prefix = \"byteorder-1.5.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.byteorder-1.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__cfg-if-1.0.4\",\n sha256 = \"9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cfg-if/1.0.4/download\"],\n strip_prefix = \"cfg-if-1.0.4\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.cfg-if-1.0.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__codespan-reporting-0.11.1\",\n sha256 = \"3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/codespan-reporting/0.11.1/download\"],\n strip_prefix = \"codespan-reporting-0.11.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.codespan-reporting-0.11.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__cortex-m-0.7.7\",\n sha256 = \"8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cortex-m/0.7.7/download\"],\n strip_prefix = \"cortex-m-0.7.7\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.cortex-m-0.7.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__cortex-m-rt-0.7.5\",\n sha256 = \"801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cortex-m-rt/0.7.5/download\"],\n strip_prefix = \"cortex-m-rt-0.7.5\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.cortex-m-rt-0.7.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__cortex-m-rt-macros-0.7.5\",\n sha256 = \"e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cortex-m-rt-macros/0.7.5/download\"],\n strip_prefix = \"cortex-m-rt-macros-0.7.5\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.cortex-m-rt-macros-0.7.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__cortex-m-semihosting-0.5.0\",\n sha256 = \"c23234600452033cc77e4b761e740e02d2c4168e11dbf36ab14a0f58973592b0\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cortex-m-semihosting/0.5.0/download\"],\n strip_prefix = \"cortex-m-semihosting-0.5.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.cortex-m-semihosting-0.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__cpufeatures-0.2.17\",\n sha256 = \"59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cpufeatures/0.2.17/download\"],\n strip_prefix = \"cpufeatures-0.2.17\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.cpufeatures-0.2.17.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__critical-section-1.2.0\",\n sha256 = \"790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/critical-section/1.2.0/download\"],\n strip_prefix = \"critical-section-1.2.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.critical-section-1.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__crypto-common-0.1.7\",\n sha256 = \"78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/crypto-common/0.1.7/download\"],\n strip_prefix = \"crypto-common-0.1.7\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.crypto-common-0.1.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__digest-0.10.7\",\n sha256 = \"9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/digest/0.10.7/download\"],\n strip_prefix = \"digest-0.10.7\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.digest-0.10.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__either-1.15.0\",\n sha256 = \"48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/either/1.15.0/download\"],\n strip_prefix = \"either-1.15.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.either-1.15.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__embedded-dma-0.2.0\",\n sha256 = \"994f7e5b5cb23521c22304927195f236813053eb9c065dd2226a32ba64695446\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-dma/0.2.0/download\"],\n strip_prefix = \"embedded-dma-0.2.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.embedded-dma-0.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__embedded-hal-0.2.7\",\n sha256 = \"35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-hal/0.2.7/download\"],\n strip_prefix = \"embedded-hal-0.2.7\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.embedded-hal-0.2.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__embedded-hal-1.0.0\",\n sha256 = \"361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-hal/1.0.0/download\"],\n strip_prefix = \"embedded-hal-1.0.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.embedded-hal-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__embedded-hal-async-1.0.0\",\n sha256 = \"0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-hal-async/1.0.0/download\"],\n strip_prefix = \"embedded-hal-async-1.0.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.embedded-hal-async-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__embedded-hal-nb-1.0.0\",\n sha256 = \"fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-hal-nb/1.0.0/download\"],\n strip_prefix = \"embedded-hal-nb-1.0.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.embedded-hal-nb-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__embedded-io-0.7.1\",\n sha256 = \"9eb1aa714776b75c7e67e1da744b81a129b3ff919c8712b5e1b32252c1f07cc7\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-io/0.7.1/download\"],\n strip_prefix = \"embedded-io-0.7.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.embedded-io-0.7.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__ena-0.14.4\",\n sha256 = \"eabffdaee24bd1bf95c5ef7cec31260444317e72ea56c4c91750e8b7ee58d5f1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ena/0.14.4/download\"],\n strip_prefix = \"ena-0.14.4\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.ena-0.14.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__equivalent-1.0.2\",\n sha256 = \"877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/equivalent/1.0.2/download\"],\n strip_prefix = \"equivalent-1.0.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.equivalent-1.0.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__fixedbitset-0.5.7\",\n sha256 = \"1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/fixedbitset/0.5.7/download\"],\n strip_prefix = \"fixedbitset-0.5.7\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.fixedbitset-0.5.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__frunk-0.4.4\",\n sha256 = \"28aef0f9aa070bce60767c12ba9cb41efeaf1a2bc6427f87b7d83f11239a16d7\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/frunk/0.4.4/download\"],\n strip_prefix = \"frunk-0.4.4\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.frunk-0.4.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__frunk_core-0.4.4\",\n sha256 = \"476eeaa382e3462b84da5d6ba3da97b5786823c2d0d3a0d04ef088d073da225c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/frunk_core/0.4.4/download\"],\n strip_prefix = \"frunk_core-0.4.4\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.frunk_core-0.4.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__frunk_derives-0.4.4\",\n sha256 = \"a0b4095fc99e1d858e5b8c7125d2638372ec85aa0fe6c807105cf10b0265ca6c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/frunk_derives/0.4.4/download\"],\n strip_prefix = \"frunk_derives-0.4.4\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.frunk_derives-0.4.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__frunk_proc_macro_helpers-0.1.4\",\n sha256 = \"1952b802269f2db12ab7c0bd328d0ae8feaabf19f352a7b0af7bb0c5693abfce\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/frunk_proc_macro_helpers/0.1.4/download\"],\n strip_prefix = \"frunk_proc_macro_helpers-0.1.4\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.frunk_proc_macro_helpers-0.1.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__fugit-0.3.9\",\n sha256 = \"4e639847d312d9a82d2e75b0edcc1e934efcc64e6cb7aa94f0b1fbec0bc231d6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/fugit/0.3.9/download\"],\n strip_prefix = \"fugit-0.3.9\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.fugit-0.3.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__gcd-2.3.0\",\n sha256 = \"1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/gcd/2.3.0/download\"],\n strip_prefix = \"gcd-2.3.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.gcd-2.3.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__generic-array-0.14.7\",\n sha256 = \"85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/generic-array/0.14.7/download\"],\n strip_prefix = \"generic-array-0.14.7\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.generic-array-0.14.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__hash32-0.3.1\",\n sha256 = \"47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hash32/0.3.1/download\"],\n strip_prefix = \"hash32-0.3.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.hash32-0.3.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__hashbrown-0.17.1\",\n sha256 = \"ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hashbrown/0.17.1/download\"],\n strip_prefix = \"hashbrown-0.17.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.hashbrown-0.17.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__heapless-0.8.0\",\n sha256 = \"0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/heapless/0.8.0/download\"],\n strip_prefix = \"heapless-0.8.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.heapless-0.8.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__indexmap-2.14.0\",\n sha256 = \"d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/indexmap/2.14.0/download\"],\n strip_prefix = \"indexmap-2.14.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.indexmap-2.14.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__intrusive-collections-0.9.7\",\n sha256 = \"189d0897e4cbe8c75efedf3502c18c887b05046e59d28404d4d8e46cbc4d1e86\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/intrusive-collections/0.9.7/download\"],\n strip_prefix = \"intrusive-collections-0.9.7\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.intrusive-collections-0.9.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__itertools-0.13.0\",\n sha256 = \"413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/itertools/0.13.0/download\"],\n strip_prefix = \"itertools-0.13.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.itertools-0.13.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__itertools-0.14.0\",\n sha256 = \"2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/itertools/0.14.0/download\"],\n strip_prefix = \"itertools-0.14.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.itertools-0.14.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__keccak-0.1.6\",\n sha256 = \"cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/keccak/0.1.6/download\"],\n strip_prefix = \"keccak-0.1.6\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.keccak-0.1.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__lalrpop-0.22.2\",\n sha256 = \"ba4ebbd48ce411c1d10fb35185f5a51a7bfa3d8b24b4e330d30c9e3a34129501\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/lalrpop/0.22.2/download\"],\n strip_prefix = \"lalrpop-0.22.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.lalrpop-0.22.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__lalrpop-util-0.22.2\",\n sha256 = \"b5baa5e9ff84f1aefd264e6869907646538a52147a755d494517a8007fb48733\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/lalrpop-util/0.22.2/download\"],\n strip_prefix = \"lalrpop-util-0.22.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.lalrpop-util-0.22.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__libc-0.2.189\",\n sha256 = \"3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/libc/0.2.189/download\"],\n strip_prefix = \"libc-0.2.189\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.libc-0.2.189.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__lock_api-0.4.14\",\n sha256 = \"224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/lock_api/0.4.14/download\"],\n strip_prefix = \"lock_api-0.4.14\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.lock_api-0.4.14.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__log-0.4.33\",\n sha256 = \"0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/log/0.4.33/download\"],\n strip_prefix = \"log-0.4.33\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.log-0.4.33.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__memchr-2.8.3\",\n sha256 = \"cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/memchr/2.8.3/download\"],\n strip_prefix = \"memchr-2.8.3\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.memchr-2.8.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__memoffset-0.9.1\",\n sha256 = \"488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/memoffset/0.9.1/download\"],\n strip_prefix = \"memoffset-0.9.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.memoffset-0.9.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__nb-0.1.3\",\n sha256 = \"801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/nb/0.1.3/download\"],\n strip_prefix = \"nb-0.1.3\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.nb-0.1.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__nb-1.1.0\",\n sha256 = \"8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/nb/1.1.0/download\"],\n strip_prefix = \"nb-1.1.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.nb-1.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__new_debug_unreachable-1.0.6\",\n sha256 = \"650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/new_debug_unreachable/1.0.6/download\"],\n strip_prefix = \"new_debug_unreachable-1.0.6\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.new_debug_unreachable-1.0.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__num_enum-0.7.6\",\n sha256 = \"5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/num_enum/0.7.6/download\"],\n strip_prefix = \"num_enum-0.7.6\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.num_enum-0.7.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__num_enum_derive-0.7.6\",\n sha256 = \"680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/num_enum_derive/0.7.6/download\"],\n strip_prefix = \"num_enum_derive-0.7.6\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.num_enum_derive-0.7.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__panic-halt-1.0.0\",\n sha256 = \"a513e167849a384b7f9b746e517604398518590a9142f4846a32e3c2a4de7b11\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/panic-halt/1.0.0/download\"],\n strip_prefix = \"panic-halt-1.0.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.panic-halt-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__parking_lot-0.12.5\",\n sha256 = \"93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/parking_lot/0.12.5/download\"],\n strip_prefix = \"parking_lot-0.12.5\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.parking_lot-0.12.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__parking_lot_core-0.9.12\",\n sha256 = \"2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/parking_lot_core/0.9.12/download\"],\n strip_prefix = \"parking_lot_core-0.9.12\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.parking_lot_core-0.9.12.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__paste-1.0.15\",\n sha256 = \"57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/paste/1.0.15/download\"],\n strip_prefix = \"paste-1.0.15\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.paste-1.0.15.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__pastey-0.2.3\",\n sha256 = \"2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pastey/0.2.3/download\"],\n strip_prefix = \"pastey-0.2.3\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.pastey-0.2.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__petgraph-0.7.1\",\n sha256 = \"3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/petgraph/0.7.1/download\"],\n strip_prefix = \"petgraph-0.7.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.petgraph-0.7.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__phf_shared-0.11.3\",\n sha256 = \"67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/phf_shared/0.11.3/download\"],\n strip_prefix = \"phf_shared-0.11.3\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.phf_shared-0.11.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__pico-args-0.5.0\",\n sha256 = \"5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pico-args/0.5.0/download\"],\n strip_prefix = \"pico-args-0.5.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.pico-args-0.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__pio-0.3.0\",\n sha256 = \"d0ba4153cee9585abc451271aa437d9e8defdea8b468d48ba6b8f098cbe03d7f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pio/0.3.0/download\"],\n strip_prefix = \"pio-0.3.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.pio-0.3.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__pio-core-0.3.0\",\n sha256 = \"61d90fddc3d67f21bbf93683bc461b05d6a29c708caf3ffb79947d7ff7095406\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pio-core/0.3.0/download\"],\n strip_prefix = \"pio-core-0.3.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.pio-core-0.3.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__pio-parser-0.3.0\",\n sha256 = \"825266c1eaddf54f636d06eefa4bf3c99d774c14ec46a4a6c6e5128a0f10d205\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pio-parser/0.3.0/download\"],\n strip_prefix = \"pio-parser-0.3.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.pio-parser-0.3.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__pio-proc-0.3.0\",\n sha256 = \"ed4a76571f5fe51af43cc80ac870fe0c79cc0cdd686b9002a6c4c84bfdd0176b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pio-proc/0.3.0/download\"],\n strip_prefix = \"pio-proc-0.3.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.pio-proc-0.3.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__portable-atomic-1.13.1\",\n sha256 = \"c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/portable-atomic/1.13.1/download\"],\n strip_prefix = \"portable-atomic-1.13.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.portable-atomic-1.13.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__precomputed-hash-0.1.1\",\n sha256 = \"925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/precomputed-hash/0.1.1/download\"],\n strip_prefix = \"precomputed-hash-0.1.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.precomputed-hash-0.1.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__proc-macro-error-attr2-2.0.0\",\n sha256 = \"96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/proc-macro-error-attr2/2.0.0/download\"],\n strip_prefix = \"proc-macro-error-attr2-2.0.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.proc-macro-error-attr2-2.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__proc-macro-error2-2.0.1\",\n sha256 = \"11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/proc-macro-error2/2.0.1/download\"],\n strip_prefix = \"proc-macro-error2-2.0.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.proc-macro-error2-2.0.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__proc-macro2-1.0.106\",\n sha256 = \"8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/proc-macro2/1.0.106/download\"],\n strip_prefix = \"proc-macro2-1.0.106\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.proc-macro2-1.0.106.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__quote-1.0.45\",\n sha256 = \"41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/quote/1.0.45/download\"],\n strip_prefix = \"quote-1.0.45\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.quote-1.0.45.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__rand_core-0.9.5\",\n sha256 = \"76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rand_core/0.9.5/download\"],\n strip_prefix = \"rand_core-0.9.5\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.rand_core-0.9.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__redox_syscall-0.5.18\",\n sha256 = \"ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/redox_syscall/0.5.18/download\"],\n strip_prefix = \"redox_syscall-0.5.18\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.redox_syscall-0.5.18.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__regex-1.13.1\",\n sha256 = \"f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/regex/1.13.1/download\"],\n strip_prefix = \"regex-1.13.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.regex-1.13.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__regex-automata-0.4.16\",\n sha256 = \"8fcfdb36bda0c880c5931cdc7a2bcdc8ba4556847b9d912bca70bc94708711ad\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/regex-automata/0.4.16/download\"],\n strip_prefix = \"regex-automata-0.4.16\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.regex-automata-0.4.16.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__regex-syntax-0.8.11\",\n sha256 = \"d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/regex-syntax/0.8.11/download\"],\n strip_prefix = \"regex-syntax-0.8.11\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.regex-syntax-0.8.11.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__riscv-0.11.1\",\n sha256 = \"2f5c1b8bf41ea746266cdee443d1d1e9125c86ce1447e1a2615abd34330d33a9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv/0.11.1/download\"],\n strip_prefix = \"riscv-0.11.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.riscv-0.11.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__riscv-0.16.1\",\n sha256 = \"e42cdafa0aa3f0f956b7993cace26de5dafff7bb4f2c5b1dcb2c3723f4267a4f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv/0.16.1/download\"],\n strip_prefix = \"riscv-0.16.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.riscv-0.16.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__riscv-macros-0.4.1\",\n sha256 = \"6ad9f6dda08d90d091bc0743967cab369b8fe39ea74b26783ba2ca5c0ce39e86\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-macros/0.4.1/download\"],\n strip_prefix = \"riscv-macros-0.4.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.riscv-macros-0.4.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__riscv-rt-0.12.2\",\n sha256 = \"c0d35e32cf1383183e8885d8a9aa4402a087fd094dc34c2cb6df6687d0229dfe\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-rt/0.12.2/download\"],\n strip_prefix = \"riscv-rt-0.12.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.riscv-rt-0.12.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__riscv-rt-macros-0.2.2\",\n sha256 = \"30f19a85fe107b65031e0ba8ec60c34c2494069fe910d6c297f5e7cb5a6f76d0\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-rt-macros/0.2.2/download\"],\n strip_prefix = \"riscv-rt-macros-0.2.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.riscv-rt-macros-0.2.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__riscv-semihosting-0.2.1\",\n sha256 = \"c83afc16bdc415995941a8f522dfda32c1864f7743666ee905e54c681dce02ac\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-semihosting/0.2.1/download\"],\n strip_prefix = \"riscv-semihosting-0.2.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.riscv-semihosting-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__riscv-types-0.1.0\",\n sha256 = \"d3f2ad9f15a07f4a0e1677124f9120ce7e83ab7e1ca7186af0ca9da529b62e80\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-types/0.1.0/download\"],\n strip_prefix = \"riscv-types-0.1.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.riscv-types-0.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__rp-binary-info-0.1.2\",\n sha256 = \"f582261945fa215d40e2988b4df595d11c0908c0fff97a0fe23df766d117b790\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rp-binary-info/0.1.2/download\"],\n strip_prefix = \"rp-binary-info-0.1.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.rp-binary-info-0.1.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__rp-hal-common-0.1.0\",\n sha256 = \"8288358786b1458fb2caac8c4b40fb529ef4200d6c46467e2695b7a8ba573ae8\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rp-hal-common/0.1.0/download\"],\n strip_prefix = \"rp-hal-common-0.1.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.rp-hal-common-0.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__rp235x-hal-0.4.0\",\n sha256 = \"871a18f1bdad479deb080891d65b4d61d000f06f8e4227071f8ca5aa39c25d3a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rp235x-hal/0.4.0/download\"],\n strip_prefix = \"rp235x-hal-0.4.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.rp235x-hal-0.4.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__rp235x-hal-macros-0.1.0\",\n sha256 = \"74edd7a5979e9763bbb98e9746e711bac7464ee3397af7288e6c288ff0d3c764\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rp235x-hal-macros/0.1.0/download\"],\n strip_prefix = \"rp235x-hal-macros-0.1.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.rp235x-hal-macros-0.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__rp235x-pac-0.2.0\",\n sha256 = \"c3f1227561239cdfbcea69f6f1c66c78cc8197d5b4103db394eacf20aedf74fa\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rp235x-pac/0.2.0/download\"],\n strip_prefix = \"rp235x-pac-0.2.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.rp235x-pac-0.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__rustc_version-0.2.3\",\n sha256 = \"138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rustc_version/0.2.3/download\"],\n strip_prefix = \"rustc_version-0.2.3\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.rustc_version-0.2.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__rustversion-1.0.23\",\n sha256 = \"cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rustversion/1.0.23/download\"],\n strip_prefix = \"rustversion-1.0.23\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.rustversion-1.0.23.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__same-file-1.0.6\",\n sha256 = \"93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/same-file/1.0.6/download\"],\n strip_prefix = \"same-file-1.0.6\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.same-file-1.0.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__scopeguard-1.2.0\",\n sha256 = \"94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/scopeguard/1.2.0/download\"],\n strip_prefix = \"scopeguard-1.2.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.scopeguard-1.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__semver-0.9.0\",\n sha256 = \"1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/semver/0.9.0/download\"],\n strip_prefix = \"semver-0.9.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.semver-0.9.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__semver-parser-0.7.0\",\n sha256 = \"388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/semver-parser/0.7.0/download\"],\n strip_prefix = \"semver-parser-0.7.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.semver-parser-0.7.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__sha2-const-stable-0.1.0\",\n sha256 = \"5f179d4e11094a893b82fff208f74d448a7512f99f5a0acbd5c679b705f83ed9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/sha2-const-stable/0.1.0/download\"],\n strip_prefix = \"sha2-const-stable-0.1.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.sha2-const-stable-0.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__sha3-0.10.9\",\n sha256 = \"77fd7028345d415a4034cf8777cd4f8ab1851274233b45f84e3d955502d93874\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/sha3/0.10.9/download\"],\n strip_prefix = \"sha3-0.10.9\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.sha3-0.10.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__siphasher-1.0.3\",\n sha256 = \"8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/siphasher/1.0.3/download\"],\n strip_prefix = \"siphasher-1.0.3\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.siphasher-1.0.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__smallvec-1.15.2\",\n sha256 = \"8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/smallvec/1.15.2/download\"],\n strip_prefix = \"smallvec-1.15.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.smallvec-1.15.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__stable_deref_trait-1.2.1\",\n sha256 = \"6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/stable_deref_trait/1.2.1/download\"],\n strip_prefix = \"stable_deref_trait-1.2.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.stable_deref_trait-1.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__string_cache-0.8.9\",\n sha256 = \"bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/string_cache/0.8.9/download\"],\n strip_prefix = \"string_cache-0.8.9\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.string_cache-0.8.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__syn-2.0.117\",\n sha256 = \"e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/syn/2.0.117/download\"],\n strip_prefix = \"syn-2.0.117\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.syn-2.0.117.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__term-1.2.1\",\n sha256 = \"d8c27177b12a6399ffc08b98f76f7c9a1f4fe9fc967c784c5a071fa8d93cf7e1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/term/1.2.1/download\"],\n strip_prefix = \"term-1.2.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.term-1.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__termcolor-1.4.1\",\n sha256 = \"06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/termcolor/1.4.1/download\"],\n strip_prefix = \"termcolor-1.4.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.termcolor-1.4.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__typenum-1.20.1\",\n sha256 = \"b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/typenum/1.20.1/download\"],\n strip_prefix = \"typenum-1.20.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.typenum-1.20.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__unicode-ident-1.0.24\",\n sha256 = \"e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicode-ident/1.0.24/download\"],\n strip_prefix = \"unicode-ident-1.0.24\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.unicode-ident-1.0.24.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__unicode-width-0.1.14\",\n sha256 = \"7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicode-width/0.1.14/download\"],\n strip_prefix = \"unicode-width-0.1.14\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.unicode-width-0.1.14.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__unicode-xid-0.2.6\",\n sha256 = \"ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicode-xid/0.2.6/download\"],\n strip_prefix = \"unicode-xid-0.2.6\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.unicode-xid-0.2.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__usb-device-0.3.2\",\n sha256 = \"98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/usb-device/0.3.2/download\"],\n strip_prefix = \"usb-device-0.3.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.usb-device-0.3.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__vcell-0.1.3\",\n sha256 = \"77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/vcell/0.1.3/download\"],\n strip_prefix = \"vcell-0.1.3\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.vcell-0.1.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__version_check-0.9.5\",\n sha256 = \"0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/version_check/0.9.5/download\"],\n strip_prefix = \"version_check-0.9.5\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.version_check-0.9.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__void-1.0.2\",\n sha256 = \"6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/void/1.0.2/download\"],\n strip_prefix = \"void-1.0.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.void-1.0.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__volatile-register-0.2.2\",\n sha256 = \"de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/volatile-register/0.2.2/download\"],\n strip_prefix = \"volatile-register-0.2.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.volatile-register-0.2.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__walkdir-2.5.0\",\n sha256 = \"29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/walkdir/2.5.0/download\"],\n strip_prefix = \"walkdir-2.5.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.walkdir-2.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__winapi-util-0.1.11\",\n sha256 = \"c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/winapi-util/0.1.11/download\"],\n strip_prefix = \"winapi-util-0.1.11\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.winapi-util-0.1.11.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__windows-link-0.2.1\",\n sha256 = \"f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows-link/0.2.1/download\"],\n strip_prefix = \"windows-link-0.2.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.windows-link-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__windows-sys-0.61.2\",\n sha256 = \"ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows-sys/0.61.2/download\"],\n strip_prefix = \"windows-sys-0.61.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.windows-sys-0.61.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__zerocopy-0.8.48\",\n sha256 = \"eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zerocopy/0.8.48/download\"],\n strip_prefix = \"zerocopy-0.8.48\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.zerocopy-0.8.48.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__zerocopy-derive-0.8.48\",\n sha256 = \"70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zerocopy-derive/0.8.48/download\"],\n strip_prefix = \"zerocopy-derive-0.8.48\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.zerocopy-derive-0.8.48.bazel\"),\n )\n\n return [\n struct(repo=\"crates_no_std__bitflags-2.11.1\", is_dev_dep = False),\n struct(repo=\"crates_no_std__byteorder-1.5.0\", is_dev_dep = False),\n struct(repo=\"crates_no_std__cortex-m-0.7.7\", is_dev_dep = False),\n struct(repo=\"crates_no_std__cortex-m-rt-0.7.5\", is_dev_dep = False),\n struct(repo=\"crates_no_std__cortex-m-semihosting-0.5.0\", is_dev_dep = False),\n struct(repo=\"crates_no_std__embedded-io-0.7.1\", is_dev_dep = False),\n struct(repo=\"crates_no_std__intrusive-collections-0.9.7\", is_dev_dep = False),\n struct(repo=\"crates_no_std__panic-halt-1.0.0\", is_dev_dep = False),\n struct(repo=\"crates_no_std__paste-1.0.15\", is_dev_dep = False),\n struct(repo=\"crates_no_std__riscv-0.16.1\", is_dev_dep = False),\n struct(repo=\"crates_no_std__riscv-rt-0.12.2\", is_dev_dep = False),\n struct(repo=\"crates_no_std__riscv-semihosting-0.2.1\", is_dev_dep = False),\n struct(repo=\"crates_no_std__rp235x-hal-0.4.0\", is_dev_dep = False),\n struct(repo=\"crates_no_std__zerocopy-0.8.48\", is_dev_dep = False),\n ]\n" + "defs.bzl": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\"\"\"\n# `crates_repository` API\n\n- [aliases](#aliases)\n- [crate_deps](#crate_deps)\n- [all_crate_deps](#all_crate_deps)\n- [crate_repositories](#crate_repositories)\n\n\"\"\"\n\nload(\"@bazel_tools//tools/build_defs/repo:git.bzl\", \"git_repository\")\nload(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\")\nload(\"@bazel_tools//tools/build_defs/repo:utils.bzl\", \"maybe\")\nload(\"@bazel_skylib//lib:selects.bzl\", \"selects\")\nload(\"@rules_rust//crate_universe/private:local_crate_mirror.bzl\", \"local_crate_mirror\")\n\n###############################################################################\n# MACROS API\n###############################################################################\n\n# An identifier that represent common dependencies (unconditional).\n_COMMON_CONDITION = \"\"\n\ndef _flatten_dependency_maps(all_dependency_maps):\n \"\"\"Flatten a list of dependency maps into one dictionary.\n\n Dependency maps have the following structure:\n\n ```python\n DEPENDENCIES_MAP = {\n # The first key in the map is a Bazel package\n # name of the workspace this file is defined in.\n \"workspace_member_package\": {\n\n # Not all dependencies are supported for all platforms.\n # the condition key is the condition required to be true\n # on the host platform.\n \"condition\": {\n\n # An alias to a crate target. # The label of the crate target the\n # Aliases are only crate names. # package name refers to.\n \"package_name\": \"@full//:label\",\n }\n }\n }\n ```\n\n Args:\n all_dependency_maps (list): A list of dicts as described above\n\n Returns:\n dict: A dictionary as described above\n \"\"\"\n dependencies = {}\n\n for workspace_deps_map in all_dependency_maps:\n for pkg_name, conditional_deps_map in workspace_deps_map.items():\n if pkg_name not in dependencies:\n non_frozen_map = dict()\n for key, values in conditional_deps_map.items():\n non_frozen_map.update({key: dict(values.items())})\n dependencies.setdefault(pkg_name, non_frozen_map)\n continue\n\n for condition, deps_map in conditional_deps_map.items():\n # If the condition has not been recorded, do so and continue\n if condition not in dependencies[pkg_name]:\n dependencies[pkg_name].setdefault(condition, dict(deps_map.items()))\n continue\n\n # Alert on any miss-matched dependencies\n inconsistent_entries = []\n for crate_name, crate_label in deps_map.items():\n existing = dependencies[pkg_name][condition].get(crate_name)\n if existing and existing != crate_label:\n inconsistent_entries.append((crate_name, existing, crate_label))\n dependencies[pkg_name][condition].update({crate_name: crate_label})\n\n return dependencies\n\ndef crate_deps(deps, package_name = None):\n \"\"\"Finds the fully qualified label of the requested crates for the package where this macro is called.\n\n Args:\n deps (list): The desired list of crate targets.\n package_name (str, optional): The package name of the set of dependencies to look up.\n Defaults to `native.package_name()`.\n\n Returns:\n list: A list of labels to generated rust targets (str)\n \"\"\"\n\n if not deps:\n return []\n\n if package_name == None:\n package_name = native.package_name()\n\n # Join both sets of dependencies\n dependencies = _flatten_dependency_maps([\n _NORMAL_DEPENDENCIES,\n _NORMAL_DEV_DEPENDENCIES,\n _PROC_MACRO_DEPENDENCIES,\n _PROC_MACRO_DEV_DEPENDENCIES,\n _BUILD_DEPENDENCIES,\n _BUILD_PROC_MACRO_DEPENDENCIES,\n ]).pop(package_name, {})\n\n # Combine all conditional packages so we can easily index over a flat list\n # TODO: Perhaps this should actually return select statements and maintain\n # the conditionals of the dependencies\n flat_deps = {}\n for deps_set in dependencies.values():\n for crate_name, crate_label in deps_set.items():\n flat_deps.update({crate_name: crate_label})\n\n missing_crates = []\n crate_targets = []\n for crate_target in deps:\n if crate_target not in flat_deps:\n missing_crates.append(crate_target)\n else:\n crate_targets.append(flat_deps[crate_target])\n\n if missing_crates:\n fail(\"Could not find crates `{}` among dependencies of `{}`. Available dependencies were `{}`\".format(\n missing_crates,\n package_name,\n dependencies,\n ))\n\n return crate_targets\n\ndef all_crate_deps(\n normal = False, \n normal_dev = False, \n proc_macro = False, \n proc_macro_dev = False,\n build = False,\n build_proc_macro = False,\n package_name = None):\n \"\"\"Finds the fully qualified label of all requested direct crate dependencies \\\n for the package where this macro is called.\n\n If no parameters are set, all normal dependencies are returned. Setting any one flag will\n otherwise impact the contents of the returned list.\n\n Args:\n normal (bool, optional): If True, normal dependencies are included in the\n output list.\n normal_dev (bool, optional): If True, normal dev dependencies will be\n included in the output list.\n proc_macro (bool, optional): If True, proc_macro dependencies are included\n in the output list.\n proc_macro_dev (bool, optional): If True, dev proc_macro dependencies are\n included in the output list.\n build (bool, optional): If True, build dependencies are included\n in the output list.\n build_proc_macro (bool, optional): If True, build proc_macro dependencies are\n included in the output list.\n package_name (str, optional): The package name of the set of dependencies to look up.\n Defaults to `native.package_name()` when unset.\n\n Returns:\n list: A list of labels to generated rust targets (str)\n \"\"\"\n\n if package_name == None:\n package_name = native.package_name()\n\n # Determine the relevant maps to use\n all_dependency_maps = []\n if normal:\n all_dependency_maps.append(_NORMAL_DEPENDENCIES)\n if normal_dev:\n all_dependency_maps.append(_NORMAL_DEV_DEPENDENCIES)\n if proc_macro:\n all_dependency_maps.append(_PROC_MACRO_DEPENDENCIES)\n if proc_macro_dev:\n all_dependency_maps.append(_PROC_MACRO_DEV_DEPENDENCIES)\n if build:\n all_dependency_maps.append(_BUILD_DEPENDENCIES)\n if build_proc_macro:\n all_dependency_maps.append(_BUILD_PROC_MACRO_DEPENDENCIES)\n\n # Default to always using normal dependencies\n if not all_dependency_maps:\n all_dependency_maps.append(_NORMAL_DEPENDENCIES)\n\n dependencies = _flatten_dependency_maps(all_dependency_maps).pop(package_name, None)\n\n if not dependencies:\n if dependencies == None:\n fail(\"Tried to get all_crate_deps for package \" + package_name + \" but that package had no Cargo.toml file\")\n else:\n return []\n\n crate_deps = list(dependencies.pop(_COMMON_CONDITION, {}).values())\n for condition, deps in dependencies.items():\n crate_deps += selects.with_or({\n tuple(_CONDITIONS[condition]): deps.values(),\n \"//conditions:default\": [],\n })\n\n return crate_deps\n\ndef aliases(\n normal = False,\n normal_dev = False,\n proc_macro = False,\n proc_macro_dev = False,\n build = False,\n build_proc_macro = False,\n package_name = None):\n \"\"\"Produces a map of Crate alias names to their original label\n\n If no dependency kinds are specified, `normal` and `proc_macro` are used by default.\n Setting any one flag will otherwise determine the contents of the returned dict.\n\n Args:\n normal (bool, optional): If True, normal dependencies are included in the\n output list.\n normal_dev (bool, optional): If True, normal dev dependencies will be\n included in the output list..\n proc_macro (bool, optional): If True, proc_macro dependencies are included\n in the output list.\n proc_macro_dev (bool, optional): If True, dev proc_macro dependencies are\n included in the output list.\n build (bool, optional): If True, build dependencies are included\n in the output list.\n build_proc_macro (bool, optional): If True, build proc_macro dependencies are\n included in the output list.\n package_name (str, optional): The package name of the set of dependencies to look up.\n Defaults to `native.package_name()` when unset.\n\n Returns:\n dict: The aliases of all associated packages\n \"\"\"\n if package_name == None:\n package_name = native.package_name()\n\n # Determine the relevant maps to use\n all_aliases_maps = []\n if normal:\n all_aliases_maps.append(_NORMAL_ALIASES)\n if normal_dev:\n all_aliases_maps.append(_NORMAL_DEV_ALIASES)\n if proc_macro:\n all_aliases_maps.append(_PROC_MACRO_ALIASES)\n if proc_macro_dev:\n all_aliases_maps.append(_PROC_MACRO_DEV_ALIASES)\n if build:\n all_aliases_maps.append(_BUILD_ALIASES)\n if build_proc_macro:\n all_aliases_maps.append(_BUILD_PROC_MACRO_ALIASES)\n\n # Default to always using normal aliases\n if not all_aliases_maps:\n all_aliases_maps.append(_NORMAL_ALIASES)\n all_aliases_maps.append(_PROC_MACRO_ALIASES)\n\n aliases = _flatten_dependency_maps(all_aliases_maps).pop(package_name, None)\n\n if not aliases:\n return dict()\n\n common_items = aliases.pop(_COMMON_CONDITION, {}).items()\n\n # If there are only common items in the dictionary, immediately return them\n if not len(aliases.keys()) == 1:\n return dict(common_items)\n\n # Build a single select statement where each conditional has accounted for the\n # common set of aliases.\n crate_aliases = {\"//conditions:default\": dict(common_items)}\n for condition, deps in aliases.items():\n condition_triples = _CONDITIONS[condition]\n for triple in condition_triples:\n if triple in crate_aliases:\n crate_aliases[triple].update(deps)\n else:\n crate_aliases.update({triple: dict(deps.items() + common_items)})\n\n return select(crate_aliases)\n\n###############################################################################\n# WORKSPACE MEMBER DEPS AND ALIASES\n###############################################################################\n\n_NORMAL_DEPENDENCIES = {\n \"third_party/crates_io/crates_no_std\": {\n _COMMON_CONDITION: {\n \"bitflags\": Label(\"@crates_no_std//:bitflags-2.13.1\"),\n \"byteorder\": Label(\"@crates_no_std//:byteorder-1.5.0\"),\n \"cortex-m\": Label(\"@crates_no_std//:cortex-m-0.7.9\"),\n \"cortex-m-rt\": Label(\"@crates_no_std//:cortex-m-rt-0.7.6\"),\n \"cortex-m-semihosting\": Label(\"@crates_no_std//:cortex-m-semihosting-0.6.0\"),\n \"embedded-io\": Label(\"@crates_no_std//:embedded-io-0.7.1\"),\n \"panic-halt\": Label(\"@crates_no_std//:panic-halt-1.0.0\"),\n \"riscv\": Label(\"@crates_no_std//:riscv-0.16.1\"),\n \"riscv-rt\": Label(\"@crates_no_std//:riscv-rt-0.12.2\"),\n \"riscv-semihosting\": Label(\"@crates_no_std//:riscv-semihosting-0.2.1\"),\n \"rp235x-hal\": Label(\"@crates_no_std//:rp235x-hal-0.4.0\"),\n \"zerocopy\": Label(\"@crates_no_std//:zerocopy-0.8.56\"),\n },\n },\n}\n\n\n_NORMAL_ALIASES = {\n \"third_party/crates_io/crates_no_std\": {\n _COMMON_CONDITION: {\n },\n },\n}\n\n\n_NORMAL_DEV_DEPENDENCIES = {\n \"third_party/crates_io/crates_no_std\": {\n },\n}\n\n\n_NORMAL_DEV_ALIASES = {\n \"third_party/crates_io/crates_no_std\": {\n },\n}\n\n\n_PROC_MACRO_DEPENDENCIES = {\n \"third_party/crates_io/crates_no_std\": {\n _COMMON_CONDITION: {\n \"paste\": Label(\"@crates_no_std//:paste-1.0.15\"),\n },\n },\n}\n\n\n_PROC_MACRO_ALIASES = {\n \"third_party/crates_io/crates_no_std\": {\n },\n}\n\n\n_PROC_MACRO_DEV_DEPENDENCIES = {\n \"third_party/crates_io/crates_no_std\": {\n },\n}\n\n\n_PROC_MACRO_DEV_ALIASES = {\n \"third_party/crates_io/crates_no_std\": {\n },\n}\n\n\n_BUILD_DEPENDENCIES = {\n \"third_party/crates_io/crates_no_std\": {\n },\n}\n\n\n_BUILD_ALIASES = {\n \"third_party/crates_io/crates_no_std\": {\n },\n}\n\n\n_BUILD_PROC_MACRO_DEPENDENCIES = {\n \"third_party/crates_io/crates_no_std\": {\n },\n}\n\n\n_BUILD_PROC_MACRO_ALIASES = {\n \"third_party/crates_io/crates_no_std\": {\n },\n}\n\n\n_CONDITIONS = {\n \"aarch64-apple-darwin\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\"],\n \"aarch64-linux-android\": [],\n \"aarch64-unknown-linux-gnu\": [\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\"],\n \"aarch64-unknown-none\": [\"@rules_rust//rust/platform:aarch64-unknown-none\"],\n \"cfg(all(target_arch = \\\"aarch64\\\", target_os = \\\"linux\\\"))\": [\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\"],\n \"cfg(all(target_arch = \\\"aarch64\\\", target_vendor = \\\"apple\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\"],\n \"cfg(all(target_arch = \\\"loongarch64\\\", target_os = \\\"linux\\\"))\": [],\n \"cfg(target_arch = \\\"aarch64\\\")\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:aarch64-unknown-none\"],\n \"cfg(target_os = \\\"redox\\\")\": [],\n \"cfg(unix)\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(windows)\": [],\n \"riscv32imac-unknown-none-elf\": [\"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\"],\n \"riscv32imc-unknown-none-elf\": [\"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\"],\n \"thumbv6m-none-eabi\": [\"@rules_rust//rust/platform:thumbv6m-none-eabi\"],\n \"thumbv7m-none-eabi\": [\"@rules_rust//rust/platform:thumbv7m-none-eabi\"],\n \"thumbv8m.main-none-eabi\": [],\n \"thumbv8m.main-none-eabihf\": [\"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\"],\n \"x86_64-apple-darwin\": [\"@rules_rust//rust/platform:x86_64-apple-darwin\"],\n \"x86_64-unknown-linux-gnu\": [\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n}\n\n###############################################################################\n\ndef crate_repositories():\n \"\"\"A macro for defining repositories for all generated crates.\n\n Returns:\n A list of repos visible to the module through the module extension.\n \"\"\"\n maybe(\n http_archive,\n name = \"crates_no_std__aho-corasick-1.1.5\",\n sha256 = \"c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/aho-corasick/1.1.5/download\"],\n strip_prefix = \"aho-corasick-1.1.5\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.aho-corasick-1.1.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__arrayvec-0.7.8\",\n sha256 = \"d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/arrayvec/0.7.8/download\"],\n strip_prefix = \"arrayvec-0.7.8\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.arrayvec-0.7.8.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__ascii-canvas-4.0.0\",\n sha256 = \"ef1e3e699d84ab1b0911a1010c5c106aa34ae89aeac103be5ce0c3859db1e891\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ascii-canvas/4.0.0/download\"],\n strip_prefix = \"ascii-canvas-4.0.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.ascii-canvas-4.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__bare-metal-0.2.5\",\n sha256 = \"5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bare-metal/0.2.5/download\"],\n strip_prefix = \"bare-metal-0.2.5\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.bare-metal-0.2.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__bit-set-0.8.0\",\n sha256 = \"08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bit-set/0.8.0/download\"],\n strip_prefix = \"bit-set-0.8.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.bit-set-0.8.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__bit-vec-0.8.0\",\n sha256 = \"5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bit-vec/0.8.0/download\"],\n strip_prefix = \"bit-vec-0.8.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.bit-vec-0.8.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__bitfield-0.13.2\",\n sha256 = \"46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bitfield/0.13.2/download\"],\n strip_prefix = \"bitfield-0.13.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.bitfield-0.13.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__bitfield-0.14.0\",\n sha256 = \"2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bitfield/0.14.0/download\"],\n strip_prefix = \"bitfield-0.14.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.bitfield-0.14.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__bitflags-2.13.1\",\n sha256 = \"b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bitflags/2.13.1/download\"],\n strip_prefix = \"bitflags-2.13.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.bitflags-2.13.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__block-buffer-0.10.4\",\n sha256 = \"3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/block-buffer/0.10.4/download\"],\n strip_prefix = \"block-buffer-0.10.4\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.block-buffer-0.10.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__byteorder-1.5.0\",\n sha256 = \"1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/byteorder/1.5.0/download\"],\n strip_prefix = \"byteorder-1.5.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.byteorder-1.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__cfg-if-1.0.4\",\n sha256 = \"9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cfg-if/1.0.4/download\"],\n strip_prefix = \"cfg-if-1.0.4\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.cfg-if-1.0.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__codespan-reporting-0.11.1\",\n sha256 = \"3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/codespan-reporting/0.11.1/download\"],\n strip_prefix = \"codespan-reporting-0.11.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.codespan-reporting-0.11.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__cortex-m-0.7.9\",\n sha256 = \"844b9697e922c99847eed515c6eb6d101e7ce62ff556fcaec243798291427ee8\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cortex-m/0.7.9/download\"],\n strip_prefix = \"cortex-m-0.7.9\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.cortex-m-0.7.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__cortex-m-macros-0.7.8\",\n sha256 = \"6d1922be58519ad40368fc4ca595a2cefa51a7abf947be3b0c90586dc7dbd0e2\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cortex-m-macros/0.7.8/download\"],\n strip_prefix = \"cortex-m-macros-0.7.8\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.cortex-m-macros-0.7.8.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__cortex-m-rt-0.7.6\",\n sha256 = \"9c439b23bf18154d8a634543caf1ee73cceb723f2902f7ea243634159a00fd47\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cortex-m-rt/0.7.6/download\"],\n strip_prefix = \"cortex-m-rt-0.7.6\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.cortex-m-rt-0.7.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__cortex-m-rt-macros-0.7.6\",\n sha256 = \"061a75f3e7f3f01d649668d68e02d0ef92c7041a9c97b8fe6bc354ddbf40822d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cortex-m-rt-macros/0.7.6/download\"],\n strip_prefix = \"cortex-m-rt-macros-0.7.6\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.cortex-m-rt-macros-0.7.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__cortex-m-semihosting-0.6.0\",\n sha256 = \"fb6d409db102d77600a714dfa93744e379d9a7e03cbb175d64f09e14d3e921a2\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cortex-m-semihosting/0.6.0/download\"],\n strip_prefix = \"cortex-m-semihosting-0.6.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.cortex-m-semihosting-0.6.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__cpufeatures-0.2.17\",\n sha256 = \"59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cpufeatures/0.2.17/download\"],\n strip_prefix = \"cpufeatures-0.2.17\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.cpufeatures-0.2.17.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__critical-section-1.2.0\",\n sha256 = \"790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/critical-section/1.2.0/download\"],\n strip_prefix = \"critical-section-1.2.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.critical-section-1.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__crypto-common-0.1.7\",\n sha256 = \"78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/crypto-common/0.1.7/download\"],\n strip_prefix = \"crypto-common-0.1.7\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.crypto-common-0.1.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__digest-0.10.7\",\n sha256 = \"9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/digest/0.10.7/download\"],\n strip_prefix = \"digest-0.10.7\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.digest-0.10.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__either-1.18.0\",\n sha256 = \"252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/either/1.18.0/download\"],\n strip_prefix = \"either-1.18.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.either-1.18.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__embedded-dma-0.2.0\",\n sha256 = \"994f7e5b5cb23521c22304927195f236813053eb9c065dd2226a32ba64695446\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-dma/0.2.0/download\"],\n strip_prefix = \"embedded-dma-0.2.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.embedded-dma-0.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__embedded-hal-0.2.7\",\n sha256 = \"35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-hal/0.2.7/download\"],\n strip_prefix = \"embedded-hal-0.2.7\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.embedded-hal-0.2.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__embedded-hal-1.0.0\",\n sha256 = \"361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-hal/1.0.0/download\"],\n strip_prefix = \"embedded-hal-1.0.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.embedded-hal-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__embedded-hal-async-1.0.0\",\n sha256 = \"0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-hal-async/1.0.0/download\"],\n strip_prefix = \"embedded-hal-async-1.0.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.embedded-hal-async-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__embedded-hal-nb-1.0.0\",\n sha256 = \"fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-hal-nb/1.0.0/download\"],\n strip_prefix = \"embedded-hal-nb-1.0.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.embedded-hal-nb-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__embedded-io-0.7.1\",\n sha256 = \"9eb1aa714776b75c7e67e1da744b81a129b3ff919c8712b5e1b32252c1f07cc7\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/embedded-io/0.7.1/download\"],\n strip_prefix = \"embedded-io-0.7.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.embedded-io-0.7.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__ena-0.14.4\",\n sha256 = \"eabffdaee24bd1bf95c5ef7cec31260444317e72ea56c4c91750e8b7ee58d5f1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ena/0.14.4/download\"],\n strip_prefix = \"ena-0.14.4\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.ena-0.14.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__equivalent-1.0.2\",\n sha256 = \"877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/equivalent/1.0.2/download\"],\n strip_prefix = \"equivalent-1.0.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.equivalent-1.0.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__fixedbitset-0.5.7\",\n sha256 = \"1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/fixedbitset/0.5.7/download\"],\n strip_prefix = \"fixedbitset-0.5.7\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.fixedbitset-0.5.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__frunk-0.4.4\",\n sha256 = \"28aef0f9aa070bce60767c12ba9cb41efeaf1a2bc6427f87b7d83f11239a16d7\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/frunk/0.4.4/download\"],\n strip_prefix = \"frunk-0.4.4\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.frunk-0.4.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__frunk_core-0.4.4\",\n sha256 = \"476eeaa382e3462b84da5d6ba3da97b5786823c2d0d3a0d04ef088d073da225c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/frunk_core/0.4.4/download\"],\n strip_prefix = \"frunk_core-0.4.4\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.frunk_core-0.4.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__frunk_core-0.5.0\",\n sha256 = \"0bd3c9ba2e323e8b19e77f15873f60974a7d82f89b80e50c53be44b8b92927c1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/frunk_core/0.5.0/download\"],\n strip_prefix = \"frunk_core-0.5.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.frunk_core-0.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__frunk_derives-0.4.4\",\n sha256 = \"a0b4095fc99e1d858e5b8c7125d2638372ec85aa0fe6c807105cf10b0265ca6c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/frunk_derives/0.4.4/download\"],\n strip_prefix = \"frunk_derives-0.4.4\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.frunk_derives-0.4.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__frunk_proc_macro_helpers-0.1.5\",\n sha256 = \"b70229a1347a20d4af9c06116cc452acef34f798668c6b69e97dd5c8a88052bd\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/frunk_proc_macro_helpers/0.1.5/download\"],\n strip_prefix = \"frunk_proc_macro_helpers-0.1.5\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.frunk_proc_macro_helpers-0.1.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__fugit-0.3.9\",\n sha256 = \"4e639847d312d9a82d2e75b0edcc1e934efcc64e6cb7aa94f0b1fbec0bc231d6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/fugit/0.3.9/download\"],\n strip_prefix = \"fugit-0.3.9\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.fugit-0.3.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__gcd-2.3.0\",\n sha256 = \"1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/gcd/2.3.0/download\"],\n strip_prefix = \"gcd-2.3.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.gcd-2.3.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__generic-array-0.14.7\",\n sha256 = \"85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/generic-array/0.14.7/download\"],\n strip_prefix = \"generic-array-0.14.7\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.generic-array-0.14.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__hash32-0.3.1\",\n sha256 = \"47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hash32/0.3.1/download\"],\n strip_prefix = \"hash32-0.3.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.hash32-0.3.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__hashbrown-0.17.1\",\n sha256 = \"ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hashbrown/0.17.1/download\"],\n strip_prefix = \"hashbrown-0.17.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.hashbrown-0.17.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__heapless-0.8.0\",\n sha256 = \"0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/heapless/0.8.0/download\"],\n strip_prefix = \"heapless-0.8.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.heapless-0.8.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__indexmap-2.14.0\",\n sha256 = \"d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/indexmap/2.14.0/download\"],\n strip_prefix = \"indexmap-2.14.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.indexmap-2.14.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__itertools-0.13.0\",\n sha256 = \"413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/itertools/0.13.0/download\"],\n strip_prefix = \"itertools-0.13.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.itertools-0.13.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__itertools-0.14.0\",\n sha256 = \"2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/itertools/0.14.0/download\"],\n strip_prefix = \"itertools-0.14.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.itertools-0.14.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__keccak-0.1.6\",\n sha256 = \"cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/keccak/0.1.6/download\"],\n strip_prefix = \"keccak-0.1.6\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.keccak-0.1.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__lalrpop-0.22.2\",\n sha256 = \"ba4ebbd48ce411c1d10fb35185f5a51a7bfa3d8b24b4e330d30c9e3a34129501\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/lalrpop/0.22.2/download\"],\n strip_prefix = \"lalrpop-0.22.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.lalrpop-0.22.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__lalrpop-util-0.22.2\",\n sha256 = \"b5baa5e9ff84f1aefd264e6869907646538a52147a755d494517a8007fb48733\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/lalrpop-util/0.22.2/download\"],\n strip_prefix = \"lalrpop-util-0.22.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.lalrpop-util-0.22.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__libc-0.2.189\",\n sha256 = \"3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/libc/0.2.189/download\"],\n strip_prefix = \"libc-0.2.189\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.libc-0.2.189.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__lock_api-0.4.14\",\n sha256 = \"224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/lock_api/0.4.14/download\"],\n strip_prefix = \"lock_api-0.4.14\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.lock_api-0.4.14.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__log-0.4.34\",\n sha256 = \"f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/log/0.4.34/download\"],\n strip_prefix = \"log-0.4.34\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.log-0.4.34.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__memchr-2.8.3\",\n sha256 = \"cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/memchr/2.8.3/download\"],\n strip_prefix = \"memchr-2.8.3\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.memchr-2.8.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__nb-0.1.3\",\n sha256 = \"801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/nb/0.1.3/download\"],\n strip_prefix = \"nb-0.1.3\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.nb-0.1.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__nb-1.1.0\",\n sha256 = \"8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/nb/1.1.0/download\"],\n strip_prefix = \"nb-1.1.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.nb-1.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__new_debug_unreachable-1.0.6\",\n sha256 = \"650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/new_debug_unreachable/1.0.6/download\"],\n strip_prefix = \"new_debug_unreachable-1.0.6\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.new_debug_unreachable-1.0.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__num_enum-0.7.6\",\n sha256 = \"5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/num_enum/0.7.6/download\"],\n strip_prefix = \"num_enum-0.7.6\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.num_enum-0.7.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__num_enum_derive-0.7.6\",\n sha256 = \"680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/num_enum_derive/0.7.6/download\"],\n strip_prefix = \"num_enum_derive-0.7.6\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.num_enum_derive-0.7.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__panic-halt-1.0.0\",\n sha256 = \"a513e167849a384b7f9b746e517604398518590a9142f4846a32e3c2a4de7b11\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/panic-halt/1.0.0/download\"],\n strip_prefix = \"panic-halt-1.0.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.panic-halt-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__parking_lot-0.12.5\",\n sha256 = \"93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/parking_lot/0.12.5/download\"],\n strip_prefix = \"parking_lot-0.12.5\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.parking_lot-0.12.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__parking_lot_core-0.9.12\",\n sha256 = \"2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/parking_lot_core/0.9.12/download\"],\n strip_prefix = \"parking_lot_core-0.9.12\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.parking_lot_core-0.9.12.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__paste-1.0.15\",\n sha256 = \"57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/paste/1.0.15/download\"],\n strip_prefix = \"paste-1.0.15\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.paste-1.0.15.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__pastey-0.2.3\",\n sha256 = \"2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pastey/0.2.3/download\"],\n strip_prefix = \"pastey-0.2.3\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.pastey-0.2.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__petgraph-0.7.1\",\n sha256 = \"3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/petgraph/0.7.1/download\"],\n strip_prefix = \"petgraph-0.7.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.petgraph-0.7.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__phf_shared-0.11.3\",\n sha256 = \"67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/phf_shared/0.11.3/download\"],\n strip_prefix = \"phf_shared-0.11.3\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.phf_shared-0.11.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__pico-args-0.5.0\",\n sha256 = \"5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pico-args/0.5.0/download\"],\n strip_prefix = \"pico-args-0.5.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.pico-args-0.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__pio-0.3.0\",\n sha256 = \"d0ba4153cee9585abc451271aa437d9e8defdea8b468d48ba6b8f098cbe03d7f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pio/0.3.0/download\"],\n strip_prefix = \"pio-0.3.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.pio-0.3.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__pio-core-0.3.0\",\n sha256 = \"61d90fddc3d67f21bbf93683bc461b05d6a29c708caf3ffb79947d7ff7095406\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pio-core/0.3.0/download\"],\n strip_prefix = \"pio-core-0.3.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.pio-core-0.3.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__pio-parser-0.3.0\",\n sha256 = \"825266c1eaddf54f636d06eefa4bf3c99d774c14ec46a4a6c6e5128a0f10d205\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pio-parser/0.3.0/download\"],\n strip_prefix = \"pio-parser-0.3.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.pio-parser-0.3.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__pio-proc-0.3.0\",\n sha256 = \"ed4a76571f5fe51af43cc80ac870fe0c79cc0cdd686b9002a6c4c84bfdd0176b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pio-proc/0.3.0/download\"],\n strip_prefix = \"pio-proc-0.3.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.pio-proc-0.3.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__portable-atomic-1.15.0\",\n sha256 = \"05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/portable-atomic/1.15.0/download\"],\n strip_prefix = \"portable-atomic-1.15.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.portable-atomic-1.15.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__precomputed-hash-0.1.1\",\n sha256 = \"925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/precomputed-hash/0.1.1/download\"],\n strip_prefix = \"precomputed-hash-0.1.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.precomputed-hash-0.1.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__proc-macro-error-attr2-2.0.0\",\n sha256 = \"96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/proc-macro-error-attr2/2.0.0/download\"],\n strip_prefix = \"proc-macro-error-attr2-2.0.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.proc-macro-error-attr2-2.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__proc-macro-error2-2.0.1\",\n sha256 = \"11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/proc-macro-error2/2.0.1/download\"],\n strip_prefix = \"proc-macro-error2-2.0.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.proc-macro-error2-2.0.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__proc-macro2-1.0.107\",\n sha256 = \"985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/proc-macro2/1.0.107/download\"],\n strip_prefix = \"proc-macro2-1.0.107\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.proc-macro2-1.0.107.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__quote-1.0.47\",\n sha256 = \"1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/quote/1.0.47/download\"],\n strip_prefix = \"quote-1.0.47\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.quote-1.0.47.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__rand_core-0.9.5\",\n sha256 = \"76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rand_core/0.9.5/download\"],\n strip_prefix = \"rand_core-0.9.5\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.rand_core-0.9.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__redox_syscall-0.5.18\",\n sha256 = \"ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/redox_syscall/0.5.18/download\"],\n strip_prefix = \"redox_syscall-0.5.18\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.redox_syscall-0.5.18.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__regex-1.13.1\",\n sha256 = \"f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/regex/1.13.1/download\"],\n strip_prefix = \"regex-1.13.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.regex-1.13.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__regex-automata-0.4.18\",\n sha256 = \"ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/regex-automata/0.4.18/download\"],\n strip_prefix = \"regex-automata-0.4.18\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.regex-automata-0.4.18.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__regex-syntax-0.8.11\",\n sha256 = \"d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/regex-syntax/0.8.11/download\"],\n strip_prefix = \"regex-syntax-0.8.11\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.regex-syntax-0.8.11.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__riscv-0.11.1\",\n sha256 = \"2f5c1b8bf41ea746266cdee443d1d1e9125c86ce1447e1a2615abd34330d33a9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv/0.11.1/download\"],\n strip_prefix = \"riscv-0.11.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.riscv-0.11.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__riscv-0.16.1\",\n sha256 = \"e42cdafa0aa3f0f956b7993cace26de5dafff7bb4f2c5b1dcb2c3723f4267a4f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv/0.16.1/download\"],\n strip_prefix = \"riscv-0.16.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.riscv-0.16.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__riscv-macros-0.4.1\",\n sha256 = \"6ad9f6dda08d90d091bc0743967cab369b8fe39ea74b26783ba2ca5c0ce39e86\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-macros/0.4.1/download\"],\n strip_prefix = \"riscv-macros-0.4.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.riscv-macros-0.4.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__riscv-rt-0.12.2\",\n sha256 = \"c0d35e32cf1383183e8885d8a9aa4402a087fd094dc34c2cb6df6687d0229dfe\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-rt/0.12.2/download\"],\n strip_prefix = \"riscv-rt-0.12.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.riscv-rt-0.12.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__riscv-rt-macros-0.2.2\",\n sha256 = \"30f19a85fe107b65031e0ba8ec60c34c2494069fe910d6c297f5e7cb5a6f76d0\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-rt-macros/0.2.2/download\"],\n strip_prefix = \"riscv-rt-macros-0.2.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.riscv-rt-macros-0.2.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__riscv-semihosting-0.2.1\",\n sha256 = \"c83afc16bdc415995941a8f522dfda32c1864f7743666ee905e54c681dce02ac\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-semihosting/0.2.1/download\"],\n strip_prefix = \"riscv-semihosting-0.2.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.riscv-semihosting-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__riscv-types-0.1.0\",\n sha256 = \"d3f2ad9f15a07f4a0e1677124f9120ce7e83ab7e1ca7186af0ca9da529b62e80\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/riscv-types/0.1.0/download\"],\n strip_prefix = \"riscv-types-0.1.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.riscv-types-0.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__rp-binary-info-0.1.2\",\n sha256 = \"f582261945fa215d40e2988b4df595d11c0908c0fff97a0fe23df766d117b790\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rp-binary-info/0.1.2/download\"],\n strip_prefix = \"rp-binary-info-0.1.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.rp-binary-info-0.1.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__rp-hal-common-0.1.0\",\n sha256 = \"8288358786b1458fb2caac8c4b40fb529ef4200d6c46467e2695b7a8ba573ae8\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rp-hal-common/0.1.0/download\"],\n strip_prefix = \"rp-hal-common-0.1.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.rp-hal-common-0.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__rp235x-hal-0.4.0\",\n sha256 = \"871a18f1bdad479deb080891d65b4d61d000f06f8e4227071f8ca5aa39c25d3a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rp235x-hal/0.4.0/download\"],\n strip_prefix = \"rp235x-hal-0.4.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.rp235x-hal-0.4.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__rp235x-hal-macros-0.1.0\",\n sha256 = \"74edd7a5979e9763bbb98e9746e711bac7464ee3397af7288e6c288ff0d3c764\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rp235x-hal-macros/0.1.0/download\"],\n strip_prefix = \"rp235x-hal-macros-0.1.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.rp235x-hal-macros-0.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__rp235x-pac-0.2.0\",\n sha256 = \"c3f1227561239cdfbcea69f6f1c66c78cc8197d5b4103db394eacf20aedf74fa\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rp235x-pac/0.2.0/download\"],\n strip_prefix = \"rp235x-pac-0.2.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.rp235x-pac-0.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__rustc_version-0.2.3\",\n sha256 = \"138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rustc_version/0.2.3/download\"],\n strip_prefix = \"rustc_version-0.2.3\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.rustc_version-0.2.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__rustversion-1.0.23\",\n sha256 = \"cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rustversion/1.0.23/download\"],\n strip_prefix = \"rustversion-1.0.23\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.rustversion-1.0.23.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__same-file-1.0.6\",\n sha256 = \"93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/same-file/1.0.6/download\"],\n strip_prefix = \"same-file-1.0.6\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.same-file-1.0.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__scopeguard-1.2.0\",\n sha256 = \"94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/scopeguard/1.2.0/download\"],\n strip_prefix = \"scopeguard-1.2.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.scopeguard-1.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__semver-0.9.0\",\n sha256 = \"1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/semver/0.9.0/download\"],\n strip_prefix = \"semver-0.9.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.semver-0.9.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__semver-parser-0.7.0\",\n sha256 = \"388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/semver-parser/0.7.0/download\"],\n strip_prefix = \"semver-parser-0.7.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.semver-parser-0.7.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__sha2-const-stable-0.1.0\",\n sha256 = \"5f179d4e11094a893b82fff208f74d448a7512f99f5a0acbd5c679b705f83ed9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/sha2-const-stable/0.1.0/download\"],\n strip_prefix = \"sha2-const-stable-0.1.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.sha2-const-stable-0.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__sha3-0.10.9\",\n sha256 = \"77fd7028345d415a4034cf8777cd4f8ab1851274233b45f84e3d955502d93874\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/sha3/0.10.9/download\"],\n strip_prefix = \"sha3-0.10.9\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.sha3-0.10.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__siphasher-1.0.3\",\n sha256 = \"8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/siphasher/1.0.3/download\"],\n strip_prefix = \"siphasher-1.0.3\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.siphasher-1.0.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__smallvec-1.15.2\",\n sha256 = \"8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/smallvec/1.15.2/download\"],\n strip_prefix = \"smallvec-1.15.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.smallvec-1.15.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__stable_deref_trait-1.2.1\",\n sha256 = \"6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/stable_deref_trait/1.2.1/download\"],\n strip_prefix = \"stable_deref_trait-1.2.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.stable_deref_trait-1.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__string_cache-0.8.9\",\n sha256 = \"bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/string_cache/0.8.9/download\"],\n strip_prefix = \"string_cache-0.8.9\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.string_cache-0.8.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__syn-2.0.119\",\n sha256 = \"872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/syn/2.0.119/download\"],\n strip_prefix = \"syn-2.0.119\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.syn-2.0.119.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__term-1.2.1\",\n sha256 = \"d8c27177b12a6399ffc08b98f76f7c9a1f4fe9fc967c784c5a071fa8d93cf7e1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/term/1.2.1/download\"],\n strip_prefix = \"term-1.2.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.term-1.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__termcolor-1.4.1\",\n sha256 = \"06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/termcolor/1.4.1/download\"],\n strip_prefix = \"termcolor-1.4.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.termcolor-1.4.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__typenum-1.20.1\",\n sha256 = \"b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/typenum/1.20.1/download\"],\n strip_prefix = \"typenum-1.20.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.typenum-1.20.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__unicode-ident-1.0.24\",\n sha256 = \"e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicode-ident/1.0.24/download\"],\n strip_prefix = \"unicode-ident-1.0.24\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.unicode-ident-1.0.24.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__unicode-width-0.1.14\",\n sha256 = \"7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicode-width/0.1.14/download\"],\n strip_prefix = \"unicode-width-0.1.14\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.unicode-width-0.1.14.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__unicode-xid-0.2.6\",\n sha256 = \"ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicode-xid/0.2.6/download\"],\n strip_prefix = \"unicode-xid-0.2.6\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.unicode-xid-0.2.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__usb-device-0.3.2\",\n sha256 = \"98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/usb-device/0.3.2/download\"],\n strip_prefix = \"usb-device-0.3.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.usb-device-0.3.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__vcell-0.1.3\",\n sha256 = \"77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/vcell/0.1.3/download\"],\n strip_prefix = \"vcell-0.1.3\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.vcell-0.1.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__version_check-0.9.5\",\n sha256 = \"0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/version_check/0.9.5/download\"],\n strip_prefix = \"version_check-0.9.5\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.version_check-0.9.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__void-1.0.2\",\n sha256 = \"6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/void/1.0.2/download\"],\n strip_prefix = \"void-1.0.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.void-1.0.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__volatile-register-0.2.2\",\n sha256 = \"de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/volatile-register/0.2.2/download\"],\n strip_prefix = \"volatile-register-0.2.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.volatile-register-0.2.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__walkdir-2.5.0\",\n sha256 = \"29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/walkdir/2.5.0/download\"],\n strip_prefix = \"walkdir-2.5.0\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.walkdir-2.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__winapi-util-0.1.11\",\n sha256 = \"c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/winapi-util/0.1.11/download\"],\n strip_prefix = \"winapi-util-0.1.11\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.winapi-util-0.1.11.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__windows-link-0.2.1\",\n sha256 = \"f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows-link/0.2.1/download\"],\n strip_prefix = \"windows-link-0.2.1\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.windows-link-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__windows-sys-0.61.2\",\n sha256 = \"ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows-sys/0.61.2/download\"],\n strip_prefix = \"windows-sys-0.61.2\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.windows-sys-0.61.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__zerocopy-0.8.56\",\n sha256 = \"556764e583adb45a9f8d413c2a147fa7e8d821e48e12b14fd560b607998b75eb\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zerocopy/0.8.56/download\"],\n strip_prefix = \"zerocopy-0.8.56\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.zerocopy-0.8.56.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_no_std__zerocopy-derive-0.8.56\",\n sha256 = \"f2ab42fc20575779bd240faa45f94a74256f755c0fa9e89f0ede20d91d0cdfc1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zerocopy-derive/0.8.56/download\"],\n strip_prefix = \"zerocopy-derive-0.8.56\",\n build_file = Label(\"@crates_no_std//crates_no_std:BUILD.zerocopy-derive-0.8.56.bazel\"),\n )\n\n return [\n struct(repo=\"crates_no_std__bitflags-2.13.1\", is_dev_dep = False),\n struct(repo=\"crates_no_std__byteorder-1.5.0\", is_dev_dep = False),\n struct(repo=\"crates_no_std__cortex-m-0.7.9\", is_dev_dep = False),\n struct(repo=\"crates_no_std__cortex-m-rt-0.7.6\", is_dev_dep = False),\n struct(repo=\"crates_no_std__cortex-m-semihosting-0.6.0\", is_dev_dep = False),\n struct(repo=\"crates_no_std__embedded-io-0.7.1\", is_dev_dep = False),\n struct(repo=\"crates_no_std__panic-halt-1.0.0\", is_dev_dep = False),\n struct(repo=\"crates_no_std__paste-1.0.15\", is_dev_dep = False),\n struct(repo=\"crates_no_std__riscv-0.16.1\", is_dev_dep = False),\n struct(repo=\"crates_no_std__riscv-rt-0.12.2\", is_dev_dep = False),\n struct(repo=\"crates_no_std__riscv-semihosting-0.2.1\", is_dev_dep = False),\n struct(repo=\"crates_no_std__rp235x-hal-0.4.0\", is_dev_dep = False),\n struct(repo=\"crates_no_std__zerocopy-0.8.56\", is_dev_dep = False),\n ]\n" } } }, - "crates_no_std__aho-corasick-1.1.4": { + "crates_no_std__aho-corasick-1.1.5": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301", + "sha256": "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/aho-corasick/1.1.4/download" + "https://static.crates.io/crates/aho-corasick/1.1.5/download" ], - "strip_prefix": "aho-corasick-1.1.4", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"aho_corasick\",\n deps = [\n \"@crates_no_std__memchr-2.8.3//:memchr\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"perf-literal\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=aho-corasick\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.1.4\",\n)\n" + "strip_prefix": "aho-corasick-1.1.5", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"aho_corasick\",\n deps = [\n \"@crates_no_std__memchr-2.8.3//:memchr\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"perf-literal\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=aho-corasick\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.1.5\",\n)\n" } }, - "crates_no_std__arrayvec-0.7.6": { + "crates_no_std__arrayvec-0.7.8": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50", + "sha256": "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/arrayvec/0.7.6/download" + "https://static.crates.io/crates/arrayvec/0.7.8/download" ], - "strip_prefix": "arrayvec-0.7.6", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"arrayvec\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=arrayvec\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.7.6\",\n)\n" + "strip_prefix": "arrayvec-0.7.8", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"arrayvec\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=arrayvec\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.7.8\",\n)\n" } }, "crates_no_std__ascii-canvas-4.0.0": { @@ -5500,22 +5266,6 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"ascii_canvas\",\n deps = [\n \"@crates_no_std__term-1.2.1//:term\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=ascii-canvas\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"4.0.0\",\n)\n" } }, - "crates_no_std__autocfg-1.5.0": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "patch_args": [], - "patch_tool": "", - "patches": [], - "remote_patch_strip": 1, - "sha256": "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8", - "type": "tar.gz", - "urls": [ - "https://static.crates.io/crates/autocfg/1.5.0/download" - ], - "strip_prefix": "autocfg-1.5.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"autocfg\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2015\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=autocfg\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.5.0\",\n)\n" - } - }, "crates_no_std__bare-metal-0.2.5": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { @@ -5596,20 +5346,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"bitfield\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2015\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=bitfield\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.14.0\",\n)\n" } }, - "crates_no_std__bitflags-2.11.1": { + "crates_no_std__bitflags-2.13.1": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3", + "sha256": "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/bitflags/2.11.1/download" + "https://static.crates.io/crates/bitflags/2.13.1/download" ], - "strip_prefix": "bitflags-2.11.1", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"bitflags\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=bitflags\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.11.1\",\n)\n" + "strip_prefix": "bitflags-2.13.1", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"bitflags\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=bitflags\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.13.1\",\n)\n" } }, "crates_no_std__block-buffer-0.10.4": { @@ -5676,68 +5426,84 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"codespan_reporting\",\n deps = [\n \"@crates_no_std__termcolor-1.4.1//:termcolor\",\n \"@crates_no_std__unicode-width-0.1.14//:unicode_width\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=codespan-reporting\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.11.1\",\n)\n" } }, - "crates_no_std__cortex-m-0.7.7": { + "crates_no_std__cortex-m-0.7.9": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9", + "sha256": "844b9697e922c99847eed515c6eb6d101e7ce62ff556fcaec243798291427ee8", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/cortex-m/0.7.7/download" + "https://static.crates.io/crates/cortex-m/0.7.9/download" ], - "strip_prefix": "cortex-m-0.7.7", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"cortex_m\",\n deps = [\n \"@crates_no_std__bare-metal-0.2.5//:bare_metal\",\n \"@crates_no_std__bitfield-0.13.2//:bitfield\",\n \"@crates_no_std__cortex-m-0.7.7//:build_script_build\",\n \"@crates_no_std__embedded-hal-0.2.7//:embedded_hal\",\n \"@crates_no_std__volatile-register-0.2.2//:volatile_register\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cortex-m\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.7.7\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2018\",\n links = \"cortex-m\",\n pkg_name = \"cortex-m\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cortex-m\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.7.7\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "strip_prefix": "cortex-m-0.7.9", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"cortex_m\",\n deps = [\n \"@crates_no_std__bare-metal-0.2.5//:bare_metal\",\n \"@crates_no_std__bitfield-0.13.2//:bitfield\",\n \"@crates_no_std__cortex-m-0.7.9//:build_script_build\",\n \"@crates_no_std__critical-section-1.2.0//:critical_section\",\n \"@crates_no_std__embedded-hal-0.2.7//:embedded_hal\",\n \"@crates_no_std__embedded-hal-1.0.0//:embedded_hal\",\n \"@crates_no_std__volatile-register-0.2.2//:volatile_register\",\n ],\n proc_macro_deps = [\n \"@crates_no_std__cortex-m-macros-0.7.8//:cortex_m_macros\",\n ],\n aliases = {\n \"@crates_no_std__embedded-hal-0.2.7//:embedded_hal\": \"eh0\",\n \"@crates_no_std__embedded-hal-1.0.0//:embedded_hal\": \"eh1\",\n },\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"critical-section-single-core\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cortex-m\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.7.9\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"critical-section-single-core\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2024\",\n links = \"cortex-m\",\n pkg_name = \"cortex-m\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cortex-m\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.7.9\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, - "crates_no_std__cortex-m-rt-0.7.5": { + "crates_no_std__cortex-m-macros-0.7.8": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6", + "sha256": "6d1922be58519ad40368fc4ca595a2cefa51a7abf947be3b0c90586dc7dbd0e2", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/cortex-m-rt/0.7.5/download" + "https://static.crates.io/crates/cortex-m-macros/0.7.8/download" ], - "strip_prefix": "cortex-m-rt-0.7.5", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"cortex_m_rt\",\n deps = [\n \"@crates_no_std__cortex-m-rt-0.7.5//:build_script_build\",\n ],\n proc_macro_deps = [\n \"@crates_no_std__cortex-m-rt-macros-0.7.5//:cortex_m_rt_macros\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"device\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cortex-m-rt\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.7.5\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"device\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n links = \"cortex-m-rt\",\n pkg_name = \"cortex-m-rt\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cortex-m-rt\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.7.5\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "strip_prefix": "cortex-m-macros-0.7.8", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"cortex_m_macros\",\n deps = [\n \"@crates_no_std__cortex-m-macros-0.7.8//:build_script_build\",\n \"@crates_no_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_no_std__quote-1.0.47//:quote\",\n \"@crates_no_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cortex-m-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.7.8\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2024\",\n pkg_name = \"cortex-m-macros\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cortex-m-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.7.8\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, - "crates_no_std__cortex-m-rt-macros-0.7.5": { + "crates_no_std__cortex-m-rt-0.7.6": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472", + "sha256": "9c439b23bf18154d8a634543caf1ee73cceb723f2902f7ea243634159a00fd47", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/cortex-m-rt-macros/0.7.5/download" + "https://static.crates.io/crates/cortex-m-rt/0.7.6/download" ], - "strip_prefix": "cortex-m-rt-macros-0.7.5", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"cortex_m_rt_macros\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.106//:proc_macro2\",\n \"@crates_no_std__quote-1.0.45//:quote\",\n \"@crates_no_std__syn-2.0.117//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cortex-m-rt-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.7.5\",\n)\n" + "strip_prefix": "cortex-m-rt-0.7.6", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"cortex_m_rt\",\n deps = [\n \"@crates_no_std__cortex-m-rt-0.7.6//:build_script_build\",\n ],\n proc_macro_deps = [\n \"@crates_no_std__cortex-m-rt-macros-0.7.6//:cortex_m_rt_macros\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"device\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cortex-m-rt\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.7.6\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"device\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2024\",\n links = \"cortex-m-rt\",\n pkg_name = \"cortex-m-rt\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cortex-m-rt\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.7.6\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, - "crates_no_std__cortex-m-semihosting-0.5.0": { + "crates_no_std__cortex-m-rt-macros-0.7.6": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "c23234600452033cc77e4b761e740e02d2c4168e11dbf36ab14a0f58973592b0", + "sha256": "061a75f3e7f3f01d649668d68e02d0ef92c7041a9c97b8fe6bc354ddbf40822d", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/cortex-m-semihosting/0.5.0/download" + "https://static.crates.io/crates/cortex-m-rt-macros/0.7.6/download" ], - "strip_prefix": "cortex-m-semihosting-0.5.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"cortex_m_semihosting\",\n deps = [\n \"@crates_no_std__cortex-m-0.7.7//:cortex_m\",\n \"@crates_no_std__cortex-m-semihosting-0.5.0//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cortex-m-semihosting\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.5.0\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n link_deps = [\n \"@crates_no_std__cortex-m-0.7.7//:cortex_m\",\n ],\n edition = \"2021\",\n pkg_name = \"cortex-m-semihosting\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cortex-m-semihosting\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.5.0\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "strip_prefix": "cortex-m-rt-macros-0.7.6", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"cortex_m_rt_macros\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_no_std__quote-1.0.47//:quote\",\n \"@crates_no_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cortex-m-rt-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.7.6\",\n)\n" + } + }, + "crates_no_std__cortex-m-semihosting-0.6.0": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "patch_args": [], + "patch_tool": "", + "patches": [], + "remote_patch_strip": 1, + "sha256": "fb6d409db102d77600a714dfa93744e379d9a7e03cbb175d64f09e14d3e921a2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cortex-m-semihosting/0.6.0/download" + ], + "strip_prefix": "cortex-m-semihosting-0.6.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"cortex_m_semihosting\",\n deps = [\n \"@crates_no_std__cortex-m-semihosting-0.6.0//:build_script_build\",\n \"@crates_no_std__critical-section-1.2.0//:critical_section\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cortex-m-semihosting\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.6.0\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2024\",\n pkg_name = \"cortex-m-semihosting\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cortex-m-semihosting\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.6.0\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, "crates_no_std__cpufeatures-0.2.17": { @@ -5769,7 +5535,7 @@ "https://static.crates.io/crates/critical-section/1.2.0/download" ], "strip_prefix": "critical-section-1.2.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"critical_section\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"restore-state-u8\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=critical-section\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.2.0\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"critical_section\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"restore-state-u32\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=critical-section\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.2.0\",\n)\n" } }, "crates_no_std__crypto-common-0.1.7": { @@ -5804,20 +5570,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"digest\",\n deps = [\n \"@crates_no_std__block-buffer-0.10.4//:block_buffer\",\n \"@crates_no_std__crypto-common-0.1.7//:crypto_common\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"block-buffer\",\n \"core-api\",\n \"default\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=digest\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.10.7\",\n)\n" } }, - "crates_no_std__either-1.15.0": { + "crates_no_std__either-1.18.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719", + "sha256": "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/either/1.15.0/download" + "https://static.crates.io/crates/either/1.18.0/download" ], - "strip_prefix": "either-1.15.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"either\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [\n \"std\", # aarch64-apple-darwin\n \"use_std\", # aarch64-apple-darwin\n ],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [\n \"std\", # aarch64-unknown-linux-gnu\n \"use_std\", # aarch64-unknown-linux-gnu\n ],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [\n \"std\", # x86_64-apple-darwin\n \"use_std\", # x86_64-apple-darwin\n ],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [\n \"std\", # x86_64-unknown-linux-gnu\n \"use_std\", # x86_64-unknown-linux-gnu\n ],\n \"//conditions:default\": [],\n }),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=either\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.15.0\",\n)\n" + "strip_prefix": "either-1.18.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"either\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [\n \"std\", # aarch64-apple-darwin\n \"use_std\", # aarch64-apple-darwin\n ],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [\n \"std\", # aarch64-unknown-linux-gnu\n \"use_std\", # aarch64-unknown-linux-gnu\n ],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [\n \"std\", # x86_64-apple-darwin\n \"use_std\", # x86_64-apple-darwin\n ],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [\n \"std\", # x86_64-unknown-linux-gnu\n \"use_std\", # x86_64-unknown-linux-gnu\n ],\n \"//conditions:default\": [],\n }),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=either\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.18.0\",\n)\n" } }, "crates_no_std__embedded-dma-0.2.0": { @@ -5929,7 +5695,7 @@ "https://static.crates.io/crates/ena/0.14.4/download" ], "strip_prefix": "ena-0.14.4", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"ena\",\n deps = [\n \"@crates_no_std__log-0.4.33//:log\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2015\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=ena\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.14.4\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"ena\",\n deps = [\n \"@crates_no_std__log-0.4.34//:log\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2015\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=ena\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.14.4\",\n)\n" } }, "crates_no_std__equivalent-1.0.2": { @@ -5996,6 +5762,22 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"frunk_core\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=frunk_core\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.4.4\",\n)\n" } }, + "crates_no_std__frunk_core-0.5.0": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "patch_args": [], + "patch_tool": "", + "patches": [], + "remote_patch_strip": 1, + "sha256": "0bd3c9ba2e323e8b19e77f15873f60974a7d82f89b80e50c53be44b8b92927c1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/frunk_core/0.5.0/download" + ], + "strip_prefix": "frunk_core-0.5.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"frunk_core\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=frunk_core\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.5.0\",\n)\n" + } + }, "crates_no_std__frunk_derives-0.4.4": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { @@ -6009,23 +5791,23 @@ "https://static.crates.io/crates/frunk_derives/0.4.4/download" ], "strip_prefix": "frunk_derives-0.4.4", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"frunk_derives\",\n deps = [\n \"@crates_no_std__frunk_proc_macro_helpers-0.1.4//:frunk_proc_macro_helpers\",\n \"@crates_no_std__quote-1.0.45//:quote\",\n \"@crates_no_std__syn-2.0.117//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=frunk_derives\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.4.4\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"frunk_derives\",\n deps = [\n \"@crates_no_std__frunk_proc_macro_helpers-0.1.5//:frunk_proc_macro_helpers\",\n \"@crates_no_std__quote-1.0.47//:quote\",\n \"@crates_no_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=frunk_derives\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.4.4\",\n)\n" } }, - "crates_no_std__frunk_proc_macro_helpers-0.1.4": { + "crates_no_std__frunk_proc_macro_helpers-0.1.5": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "1952b802269f2db12ab7c0bd328d0ae8feaabf19f352a7b0af7bb0c5693abfce", + "sha256": "b70229a1347a20d4af9c06116cc452acef34f798668c6b69e97dd5c8a88052bd", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/frunk_proc_macro_helpers/0.1.4/download" + "https://static.crates.io/crates/frunk_proc_macro_helpers/0.1.5/download" ], - "strip_prefix": "frunk_proc_macro_helpers-0.1.4", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"frunk_proc_macro_helpers\",\n deps = [\n \"@crates_no_std__frunk_core-0.4.4//:frunk_core\",\n \"@crates_no_std__proc-macro2-1.0.106//:proc_macro2\",\n \"@crates_no_std__quote-1.0.45//:quote\",\n \"@crates_no_std__syn-2.0.117//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=frunk_proc_macro_helpers\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.1.4\",\n)\n" + "strip_prefix": "frunk_proc_macro_helpers-0.1.5", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"frunk_proc_macro_helpers\",\n deps = [\n \"@crates_no_std__frunk_core-0.5.0//:frunk_core\",\n \"@crates_no_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_no_std__quote-1.0.47//:quote\",\n \"@crates_no_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=frunk_proc_macro_helpers\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.1.5\",\n)\n" } }, "crates_no_std__fugit-0.3.9": { @@ -6140,22 +5922,6 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"indexmap\",\n deps = [\n \"@crates_no_std__equivalent-1.0.2//:equivalent\",\n \"@crates_no_std__hashbrown-0.17.1//:hashbrown\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=indexmap\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.14.0\",\n)\n" } }, - "crates_no_std__intrusive-collections-0.9.7": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "patch_args": [], - "patch_tool": "", - "patches": [], - "remote_patch_strip": 1, - "sha256": "189d0897e4cbe8c75efedf3502c18c887b05046e59d28404d4d8e46cbc4d1e86", - "type": "tar.gz", - "urls": [ - "https://static.crates.io/crates/intrusive-collections/0.9.7/download" - ], - "strip_prefix": "intrusive-collections-0.9.7", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"intrusive_collections\",\n deps = [\n \"@crates_no_std__memoffset-0.9.1//:memoffset\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=intrusive-collections\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.9.7\",\n)\n" - } - }, "crates_no_std__itertools-0.13.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { @@ -6169,7 +5935,7 @@ "https://static.crates.io/crates/itertools/0.13.0/download" ], "strip_prefix": "itertools-0.13.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"itertools\",\n deps = [\n \"@crates_no_std__either-1.15.0//:either\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=itertools\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.13.0\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"itertools\",\n deps = [\n \"@crates_no_std__either-1.18.0//:either\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=itertools\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.13.0\",\n)\n" } }, "crates_no_std__itertools-0.14.0": { @@ -6185,7 +5951,7 @@ "https://static.crates.io/crates/itertools/0.14.0/download" ], "strip_prefix": "itertools-0.14.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"itertools\",\n deps = [\n \"@crates_no_std__either-1.15.0//:either\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"use_alloc\",\n \"use_std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=itertools\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.14.0\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"itertools\",\n deps = [\n \"@crates_no_std__either-1.18.0//:either\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"use_alloc\",\n \"use_std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=itertools\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.14.0\",\n)\n" } }, "crates_no_std__keccak-0.1.6": { @@ -6233,7 +5999,7 @@ "https://static.crates.io/crates/lalrpop-util/0.22.2/download" ], "strip_prefix": "lalrpop-util-0.22.2", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"lalrpop_util\",\n deps = [\n \"@crates_no_std__regex-automata-0.4.16//:regex_automata\",\n ],\n proc_macro_deps = [\n \"@crates_no_std__rustversion-1.0.23//:rustversion\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"lexer\",\n \"regex-automata\",\n \"std\",\n \"unicode\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=lalrpop-util\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.22.2\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"lalrpop_util\",\n deps = [\n \"@crates_no_std__regex-automata-0.4.18//:regex_automata\",\n ],\n proc_macro_deps = [\n \"@crates_no_std__rustversion-1.0.23//:rustversion\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"lexer\",\n \"regex-automata\",\n \"std\",\n \"unicode\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=lalrpop-util\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.22.2\",\n)\n" } }, "crates_no_std__libc-0.2.189": { @@ -6268,20 +6034,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"lock_api\",\n deps = [\n \"@crates_no_std__scopeguard-1.2.0//:scopeguard\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"atomic_usize\",\n \"default\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=lock_api\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.4.14\",\n)\n" } }, - "crates_no_std__log-0.4.33": { + "crates_no_std__log-0.4.34": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad", + "sha256": "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/log/0.4.33/download" + "https://static.crates.io/crates/log/0.4.34/download" ], - "strip_prefix": "log-0.4.33", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"log\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=log\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.4.33\",\n)\n" + "strip_prefix": "log-0.4.34", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"log\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=log\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.4.34\",\n)\n" } }, "crates_no_std__memchr-2.8.3": { @@ -6300,22 +6066,6 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"memchr\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=memchr\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.8.3\",\n)\n" } }, - "crates_no_std__memoffset-0.9.1": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "patch_args": [], - "patch_tool": "", - "patches": [], - "remote_patch_strip": 1, - "sha256": "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a", - "type": "tar.gz", - "urls": [ - "https://static.crates.io/crates/memoffset/0.9.1/download" - ], - "strip_prefix": "memoffset-0.9.1", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"memoffset\",\n deps = [\n \"@crates_no_std__memoffset-0.9.1//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2015\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=memoffset\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.9.1\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n deps = [\n \"@crates_no_std__autocfg-1.5.0//:autocfg\",\n ],\n edition = \"2015\",\n pkg_name = \"memoffset\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=memoffset\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.9.1\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" - } - }, "crates_no_std__nb-0.1.3": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { @@ -6393,7 +6143,7 @@ "https://static.crates.io/crates/num_enum_derive/0.7.6/download" ], "strip_prefix": "num_enum_derive-0.7.6", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"num_enum_derive\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.106//:proc_macro2\",\n \"@crates_no_std__quote-1.0.45//:quote\",\n \"@crates_no_std__syn-2.0.117//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=num_enum_derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.7.6\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"num_enum_derive\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_no_std__quote-1.0.47//:quote\",\n \"@crates_no_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=num_enum_derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.7.6\",\n)\n" } }, "crates_no_std__panic-halt-1.0.0": { @@ -6553,7 +6303,7 @@ "https://static.crates.io/crates/pio-core/0.3.0/download" ], "strip_prefix": "pio-core-0.3.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"pio_core\",\n deps = [\n \"@crates_no_std__arrayvec-0.7.6//:arrayvec\",\n \"@crates_no_std__num_enum-0.7.6//:num_enum\",\n ],\n proc_macro_deps = [\n \"@crates_no_std__paste-1.0.15//:paste\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=pio-core\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.0\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"pio_core\",\n deps = [\n \"@crates_no_std__arrayvec-0.7.8//:arrayvec\",\n \"@crates_no_std__num_enum-0.7.6//:num_enum\",\n ],\n proc_macro_deps = [\n \"@crates_no_std__paste-1.0.15//:paste\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=pio-core\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.0\",\n)\n" } }, "crates_no_std__pio-parser-0.3.0": { @@ -6585,23 +6335,23 @@ "https://static.crates.io/crates/pio-proc/0.3.0/download" ], "strip_prefix": "pio-proc-0.3.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"pio_proc\",\n deps = [\n \"@crates_no_std__codespan-reporting-0.11.1//:codespan_reporting\",\n \"@crates_no_std__lalrpop-util-0.22.2//:lalrpop_util\",\n \"@crates_no_std__pio-core-0.3.0//:pio_core\",\n \"@crates_no_std__pio-parser-0.3.0//:pio_parser\",\n \"@crates_no_std__proc-macro-error2-2.0.1//:proc_macro_error2\",\n \"@crates_no_std__proc-macro2-1.0.106//:proc_macro2\",\n \"@crates_no_std__quote-1.0.45//:quote\",\n \"@crates_no_std__syn-2.0.117//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=pio-proc\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.0\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"pio_proc\",\n deps = [\n \"@crates_no_std__codespan-reporting-0.11.1//:codespan_reporting\",\n \"@crates_no_std__lalrpop-util-0.22.2//:lalrpop_util\",\n \"@crates_no_std__pio-core-0.3.0//:pio_core\",\n \"@crates_no_std__pio-parser-0.3.0//:pio_parser\",\n \"@crates_no_std__proc-macro-error2-2.0.1//:proc_macro_error2\",\n \"@crates_no_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_no_std__quote-1.0.47//:quote\",\n \"@crates_no_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=pio-proc\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.0\",\n)\n" } }, - "crates_no_std__portable-atomic-1.13.1": { + "crates_no_std__portable-atomic-1.15.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49", + "sha256": "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/portable-atomic/1.13.1/download" + "https://static.crates.io/crates/portable-atomic/1.15.0/download" ], - "strip_prefix": "portable-atomic-1.13.1", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"portable_atomic\",\n deps = [\n \"@crates_no_std__portable-atomic-1.13.1//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=portable-atomic\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.13.1\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2018\",\n pkg_name = \"portable-atomic\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=portable-atomic\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"1.13.1\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "strip_prefix": "portable-atomic-1.15.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"portable_atomic\",\n deps = [\n \"@crates_no_std__portable-atomic-1.15.0//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=portable-atomic\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.15.0\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2018\",\n pkg_name = \"portable-atomic\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=portable-atomic\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"1.15.0\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, "crates_no_std__precomputed-hash-0.1.1": { @@ -6633,7 +6383,7 @@ "https://static.crates.io/crates/proc-macro-error-attr2/2.0.0/download" ], "strip_prefix": "proc-macro-error-attr2-2.0.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"proc_macro_error_attr2\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.106//:proc_macro2\",\n \"@crates_no_std__quote-1.0.45//:quote\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=proc-macro-error-attr2\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.0.0\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"proc_macro_error_attr2\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_no_std__quote-1.0.47//:quote\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=proc-macro-error-attr2\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.0.0\",\n)\n" } }, "crates_no_std__proc-macro-error2-2.0.1": { @@ -6649,39 +6399,39 @@ "https://static.crates.io/crates/proc-macro-error2/2.0.1/download" ], "strip_prefix": "proc-macro-error2-2.0.1", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"proc_macro_error2\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.106//:proc_macro2\",\n \"@crates_no_std__quote-1.0.45//:quote\",\n \"@crates_no_std__syn-2.0.117//:syn\",\n ],\n proc_macro_deps = [\n \"@crates_no_std__proc-macro-error-attr2-2.0.0//:proc_macro_error_attr2\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"syn-error\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=proc-macro-error2\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.0.1\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"proc_macro_error2\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_no_std__quote-1.0.47//:quote\",\n \"@crates_no_std__syn-2.0.119//:syn\",\n ],\n proc_macro_deps = [\n \"@crates_no_std__proc-macro-error-attr2-2.0.0//:proc_macro_error_attr2\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"syn-error\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=proc-macro-error2\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.0.1\",\n)\n" } }, - "crates_no_std__proc-macro2-1.0.106": { + "crates_no_std__proc-macro2-1.0.107": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934", + "sha256": "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/proc-macro2/1.0.106/download" + "https://static.crates.io/crates/proc-macro2/1.0.107/download" ], - "strip_prefix": "proc-macro2-1.0.106", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"proc_macro2\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.106//:build_script_build\",\n \"@crates_no_std__unicode-ident-1.0.24//:unicode_ident\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"proc-macro\",\n \"span-locations\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=proc-macro2\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.0.106\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"proc-macro\",\n \"span-locations\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"proc-macro2\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=proc-macro2\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"1.0.106\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "strip_prefix": "proc-macro2-1.0.107", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"proc_macro2\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.107//:build_script_build\",\n \"@crates_no_std__unicode-ident-1.0.24//:unicode_ident\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"proc-macro\",\n \"span-locations\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=proc-macro2\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.0.107\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"proc-macro\",\n \"span-locations\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"proc-macro2\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=proc-macro2\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"1.0.107\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, - "crates_no_std__quote-1.0.45": { + "crates_no_std__quote-1.0.47": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924", + "sha256": "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/quote/1.0.45/download" + "https://static.crates.io/crates/quote/1.0.47/download" ], - "strip_prefix": "quote-1.0.45", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"quote\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.106//:proc_macro2\",\n \"@crates_no_std__quote-1.0.45//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"proc-macro\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=quote\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.0.45\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"proc-macro\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"quote\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=quote\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"1.0.45\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "strip_prefix": "quote-1.0.47", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"quote\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_no_std__quote-1.0.47//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"proc-macro\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=quote\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.0.47\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"proc-macro\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"quote\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=quote\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"1.0.47\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, "crates_no_std__rand_core-0.9.5": { @@ -6713,7 +6463,7 @@ "https://static.crates.io/crates/redox_syscall/0.5.18/download" ], "strip_prefix": "redox_syscall-0.5.18", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"syscall\",\n deps = [\n \"@crates_no_std__bitflags-2.11.1//:bitflags\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=redox_syscall\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.5.18\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"syscall\",\n deps = [\n \"@crates_no_std__bitflags-2.13.1//:bitflags\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=redox_syscall\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.5.18\",\n)\n" } }, "crates_no_std__regex-1.13.1": { @@ -6729,23 +6479,23 @@ "https://static.crates.io/crates/regex/1.13.1/download" ], "strip_prefix": "regex-1.13.1", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"regex\",\n deps = [\n \"@crates_no_std__regex-automata-0.4.16//:regex_automata\",\n \"@crates_no_std__regex-syntax-0.8.11//:regex_syntax\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"std\",\n \"unicode\",\n \"unicode-age\",\n \"unicode-bool\",\n \"unicode-case\",\n \"unicode-gencat\",\n \"unicode-perl\",\n \"unicode-script\",\n \"unicode-segment\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=regex\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.13.1\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"regex\",\n deps = [\n \"@crates_no_std__regex-automata-0.4.18//:regex_automata\",\n \"@crates_no_std__regex-syntax-0.8.11//:regex_syntax\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"std\",\n \"unicode\",\n \"unicode-age\",\n \"unicode-bool\",\n \"unicode-case\",\n \"unicode-gencat\",\n \"unicode-perl\",\n \"unicode-script\",\n \"unicode-segment\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=regex\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.13.1\",\n)\n" } }, - "crates_no_std__regex-automata-0.4.16": { + "crates_no_std__regex-automata-0.4.18": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "8fcfdb36bda0c880c5931cdc7a2bcdc8ba4556847b9d912bca70bc94708711ad", + "sha256": "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/regex-automata/0.4.16/download" + "https://static.crates.io/crates/regex-automata/0.4.18/download" ], - "strip_prefix": "regex-automata-0.4.16", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"regex_automata\",\n deps = [\n \"@crates_no_std__aho-corasick-1.1.4//:aho_corasick\",\n \"@crates_no_std__memchr-2.8.3//:memchr\",\n \"@crates_no_std__regex-syntax-0.8.11//:regex_syntax\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"hybrid\",\n \"meta\",\n \"nfa-pikevm\",\n \"nfa-thompson\",\n \"perf\",\n \"perf-inline\",\n \"perf-literal\",\n \"perf-literal-multisubstring\",\n \"perf-literal-substring\",\n \"std\",\n \"syntax\",\n \"unicode\",\n \"unicode-age\",\n \"unicode-bool\",\n \"unicode-case\",\n \"unicode-gencat\",\n \"unicode-perl\",\n \"unicode-script\",\n \"unicode-segment\",\n \"unicode-word-boundary\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=regex-automata\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.4.16\",\n)\n" + "strip_prefix": "regex-automata-0.4.18", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"regex_automata\",\n deps = [\n \"@crates_no_std__aho-corasick-1.1.5//:aho_corasick\",\n \"@crates_no_std__memchr-2.8.3//:memchr\",\n \"@crates_no_std__regex-syntax-0.8.11//:regex_syntax\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"hybrid\",\n \"meta\",\n \"nfa-pikevm\",\n \"nfa-thompson\",\n \"perf\",\n \"perf-inline\",\n \"perf-literal\",\n \"perf-literal-multisubstring\",\n \"perf-literal-substring\",\n \"std\",\n \"syntax\",\n \"unicode\",\n \"unicode-age\",\n \"unicode-bool\",\n \"unicode-case\",\n \"unicode-gencat\",\n \"unicode-perl\",\n \"unicode-script\",\n \"unicode-segment\",\n \"unicode-word-boundary\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=regex-automata\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.4.18\",\n)\n" } }, "crates_no_std__regex-syntax-0.8.11": { @@ -6809,7 +6559,7 @@ "https://static.crates.io/crates/riscv-macros/0.4.1/download" ], "strip_prefix": "riscv-macros-0.4.1", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"riscv_macros\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.106//:proc_macro2\",\n \"@crates_no_std__quote-1.0.45//:quote\",\n \"@crates_no_std__syn-2.0.117//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=riscv-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.4.1\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"riscv_macros\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_no_std__quote-1.0.47//:quote\",\n \"@crates_no_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=riscv-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.4.1\",\n)\n" } }, "crates_no_std__riscv-rt-0.12.2": { @@ -6841,7 +6591,7 @@ "https://static.crates.io/crates/riscv-rt-macros/0.2.2/download" ], "strip_prefix": "riscv-rt-macros-0.2.2", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"riscv_rt_macros\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.106//:proc_macro2\",\n \"@crates_no_std__quote-1.0.45//:quote\",\n \"@crates_no_std__syn-2.0.117//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=riscv-rt-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.2\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"riscv_rt_macros\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_no_std__quote-1.0.47//:quote\",\n \"@crates_no_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=riscv-rt-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.2\",\n)\n" } }, "crates_no_std__riscv-semihosting-0.2.1": { @@ -6921,7 +6671,7 @@ "https://static.crates.io/crates/rp235x-hal/0.4.0/download" ], "strip_prefix": "rp235x-hal-0.4.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"rp235x_hal\",\n deps = [\n \"@crates_no_std__bitfield-0.14.0//:bitfield\",\n \"@crates_no_std__critical-section-1.2.0//:critical_section\",\n \"@crates_no_std__embedded-dma-0.2.0//:embedded_dma\",\n \"@crates_no_std__embedded-hal-0.2.7//:embedded_hal\",\n \"@crates_no_std__embedded-hal-1.0.0//:embedded_hal\",\n \"@crates_no_std__embedded-hal-async-1.0.0//:embedded_hal_async\",\n \"@crates_no_std__embedded-hal-nb-1.0.0//:embedded_hal_nb\",\n \"@crates_no_std__embedded-io-0.7.1//:embedded_io\",\n \"@crates_no_std__frunk-0.4.4//:frunk\",\n \"@crates_no_std__fugit-0.3.9//:fugit\",\n \"@crates_no_std__gcd-2.3.0//:gcd\",\n \"@crates_no_std__itertools-0.13.0//:itertools\",\n \"@crates_no_std__nb-1.1.0//:nb\",\n \"@crates_no_std__pio-0.3.0//:pio\",\n \"@crates_no_std__rand_core-0.9.5//:rand_core\",\n \"@crates_no_std__rp-binary-info-0.1.2//:rp_binary_info\",\n \"@crates_no_std__rp-hal-common-0.1.0//:rp_hal_common\",\n \"@crates_no_std__rp235x-pac-0.2.0//:rp235x_pac\",\n \"@crates_no_std__sha2-const-stable-0.1.0//:sha2_const_stable\",\n \"@crates_no_std__usb-device-0.3.2//:usb_device\",\n \"@crates_no_std__vcell-0.1.3//:vcell\",\n \"@crates_no_std__void-1.0.2//:void\",\n ] + select({\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [\n \"@crates_no_std__riscv-0.11.1//:riscv\", # riscv32imac-unknown-none-elf\n \"@crates_no_std__riscv-rt-0.12.2//:riscv_rt\", # riscv32imac-unknown-none-elf\n ],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [\n \"@crates_no_std__cortex-m-0.7.7//:cortex_m\", # thumbv8m.main-none-eabihf\n \"@crates_no_std__cortex-m-rt-0.7.5//:cortex_m_rt\", # thumbv8m.main-none-eabihf\n ],\n \"//conditions:default\": [],\n }),\n proc_macro_deps = [\n \"@crates_no_std__paste-1.0.15//:paste\",\n \"@crates_no_std__rp235x-hal-macros-0.1.0//:rp235x_hal_macros\",\n ],\n aliases = {\n \"@crates_no_std__embedded-hal-0.2.7//:embedded_hal\": \"embedded_hal_0_2\",\n },\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"binary-info\",\n \"critical-section-impl\",\n \"rt\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=rp235x-hal\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.4.0\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"rp235x_hal\",\n deps = [\n \"@crates_no_std__bitfield-0.14.0//:bitfield\",\n \"@crates_no_std__critical-section-1.2.0//:critical_section\",\n \"@crates_no_std__embedded-dma-0.2.0//:embedded_dma\",\n \"@crates_no_std__embedded-hal-0.2.7//:embedded_hal\",\n \"@crates_no_std__embedded-hal-1.0.0//:embedded_hal\",\n \"@crates_no_std__embedded-hal-async-1.0.0//:embedded_hal_async\",\n \"@crates_no_std__embedded-hal-nb-1.0.0//:embedded_hal_nb\",\n \"@crates_no_std__embedded-io-0.7.1//:embedded_io\",\n \"@crates_no_std__frunk-0.4.4//:frunk\",\n \"@crates_no_std__fugit-0.3.9//:fugit\",\n \"@crates_no_std__gcd-2.3.0//:gcd\",\n \"@crates_no_std__itertools-0.13.0//:itertools\",\n \"@crates_no_std__nb-1.1.0//:nb\",\n \"@crates_no_std__pio-0.3.0//:pio\",\n \"@crates_no_std__rand_core-0.9.5//:rand_core\",\n \"@crates_no_std__rp-binary-info-0.1.2//:rp_binary_info\",\n \"@crates_no_std__rp-hal-common-0.1.0//:rp_hal_common\",\n \"@crates_no_std__rp235x-pac-0.2.0//:rp235x_pac\",\n \"@crates_no_std__sha2-const-stable-0.1.0//:sha2_const_stable\",\n \"@crates_no_std__usb-device-0.3.2//:usb_device\",\n \"@crates_no_std__vcell-0.1.3//:vcell\",\n \"@crates_no_std__void-1.0.2//:void\",\n ] + select({\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [\n \"@crates_no_std__riscv-0.11.1//:riscv\", # riscv32imac-unknown-none-elf\n \"@crates_no_std__riscv-rt-0.12.2//:riscv_rt\", # riscv32imac-unknown-none-elf\n ],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [\n \"@crates_no_std__cortex-m-0.7.9//:cortex_m\", # thumbv8m.main-none-eabihf\n \"@crates_no_std__cortex-m-rt-0.7.6//:cortex_m_rt\", # thumbv8m.main-none-eabihf\n ],\n \"//conditions:default\": [],\n }),\n proc_macro_deps = [\n \"@crates_no_std__paste-1.0.15//:paste\",\n \"@crates_no_std__rp235x-hal-macros-0.1.0//:rp235x_hal_macros\",\n ],\n aliases = {\n \"@crates_no_std__embedded-hal-0.2.7//:embedded_hal\": \"embedded_hal_0_2\",\n },\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"binary-info\",\n \"rt\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=rp235x-hal\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.4.0\",\n)\n" } }, "crates_no_std__rp235x-hal-macros-0.1.0": { @@ -6937,7 +6687,7 @@ "https://static.crates.io/crates/rp235x-hal-macros/0.1.0/download" ], "strip_prefix": "rp235x-hal-macros-0.1.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"rp235x_hal_macros\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.106//:proc_macro2\",\n \"@crates_no_std__quote-1.0.45//:quote\",\n \"@crates_no_std__syn-2.0.117//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=rp235x-hal-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.1.0\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"rp235x_hal_macros\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_no_std__quote-1.0.47//:quote\",\n \"@crates_no_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=rp235x-hal-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.1.0\",\n)\n" } }, "crates_no_std__rp235x-pac-0.2.0": { @@ -6953,7 +6703,7 @@ "https://static.crates.io/crates/rp235x-pac/0.2.0/download" ], "strip_prefix": "rp235x-pac-0.2.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"rp235x_pac\",\n deps = [\n \"@crates_no_std__critical-section-1.2.0//:critical_section\",\n \"@crates_no_std__rp235x-pac-0.2.0//:build_script_build\",\n \"@crates_no_std__vcell-0.1.3//:vcell\",\n ] + select({\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [\n \"@crates_no_std__cortex-m-0.7.7//:cortex_m\", # thumbv8m.main-none-eabihf\n \"@crates_no_std__cortex-m-rt-0.7.5//:cortex_m_rt\", # thumbv8m.main-none-eabihf\n ],\n \"//conditions:default\": [],\n }),\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"cortex-m-rt\",\n \"critical-section\",\n \"rt\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=rp235x-pac\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.0\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"cortex-m-rt\",\n \"critical-section\",\n \"rt\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n link_deps = select({\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [\n \"@crates_no_std__cortex-m-0.7.7//:cortex_m\", # thumbv8m.main-none-eabihf\n \"@crates_no_std__cortex-m-rt-0.7.5//:cortex_m_rt\", # thumbv8m.main-none-eabihf\n ],\n \"//conditions:default\": [],\n }),\n edition = \"2021\",\n pkg_name = \"rp235x-pac\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=rp235x-pac\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.2.0\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"rp235x_pac\",\n deps = [\n \"@crates_no_std__critical-section-1.2.0//:critical_section\",\n \"@crates_no_std__rp235x-pac-0.2.0//:build_script_build\",\n \"@crates_no_std__vcell-0.1.3//:vcell\",\n ] + select({\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [\n \"@crates_no_std__cortex-m-0.7.9//:cortex_m\", # thumbv8m.main-none-eabihf\n \"@crates_no_std__cortex-m-rt-0.7.6//:cortex_m_rt\", # thumbv8m.main-none-eabihf\n ],\n \"//conditions:default\": [],\n }),\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"cortex-m-rt\",\n \"critical-section\",\n \"rt\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=rp235x-pac\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.0\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"cortex-m-rt\",\n \"critical-section\",\n \"rt\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n link_deps = select({\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [\n \"@crates_no_std__cortex-m-0.7.9//:cortex_m\", # thumbv8m.main-none-eabihf\n \"@crates_no_std__cortex-m-rt-0.7.6//:cortex_m_rt\", # thumbv8m.main-none-eabihf\n ],\n \"//conditions:default\": [],\n }),\n edition = \"2021\",\n pkg_name = \"rp235x-pac\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=rp235x-pac\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.2.0\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, "crates_no_std__rustc_version-0.2.3": { @@ -7148,20 +6898,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"string_cache\",\n deps = [\n \"@crates_no_std__new_debug_unreachable-1.0.6//:debug_unreachable\",\n \"@crates_no_std__parking_lot-0.12.5//:parking_lot\",\n \"@crates_no_std__phf_shared-0.11.3//:phf_shared\",\n \"@crates_no_std__precomputed-hash-0.1.1//:precomputed_hash\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=string_cache\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.8.9\",\n)\n" } }, - "crates_no_std__syn-2.0.117": { + "crates_no_std__syn-2.0.119": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99", + "sha256": "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/syn/2.0.117/download" + "https://static.crates.io/crates/syn/2.0.119/download" ], - "strip_prefix": "syn-2.0.117", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"syn\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.106//:proc_macro2\",\n \"@crates_no_std__quote-1.0.45//:quote\",\n \"@crates_no_std__unicode-ident-1.0.24//:unicode_ident\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"clone-impls\",\n \"default\",\n \"derive\",\n \"extra-traits\",\n \"full\",\n \"parsing\",\n \"printing\",\n \"proc-macro\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=syn\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.0.117\",\n)\n" + "strip_prefix": "syn-2.0.119", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"syn\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_no_std__quote-1.0.47//:quote\",\n \"@crates_no_std__unicode-ident-1.0.24//:unicode_ident\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"clone-impls\",\n \"default\",\n \"derive\",\n \"extra-traits\",\n \"full\",\n \"parsing\",\n \"printing\",\n \"proc-macro\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=syn\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.0.119\",\n)\n" } }, "crates_no_std__term-1.2.1": { @@ -7273,7 +7023,7 @@ "https://static.crates.io/crates/usb-device/0.3.2/download" ], "strip_prefix": "usb-device-0.3.2", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"usb_device\",\n deps = [\n \"@crates_no_std__heapless-0.8.0//:heapless\",\n \"@crates_no_std__portable-atomic-1.13.1//:portable_atomic\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=usb-device\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.2\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"usb_device\",\n deps = [\n \"@crates_no_std__heapless-0.8.0//:heapless\",\n \"@crates_no_std__portable-atomic-1.15.0//:portable_atomic\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=usb-device\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.2\",\n)\n" } }, "crates_no_std__vcell-0.1.3": { @@ -7404,45 +7154,45 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"windows_sys\",\n deps = [\n \"@crates_no_std__windows-link-0.2.1//:windows_link\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows-sys\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.61.2\",\n)\n" } }, - "crates_no_std__zerocopy-0.8.48": { + "crates_no_std__zerocopy-0.8.56": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9", + "sha256": "556764e583adb45a9f8d413c2a147fa7e8d821e48e12b14fd560b607998b75eb", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/zerocopy/0.8.48/download" + "https://static.crates.io/crates/zerocopy/0.8.56/download" ], - "strip_prefix": "zerocopy-0.8.48", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"zerocopy\",\n deps = [\n \"@crates_no_std__zerocopy-0.8.48//:build_script_build\",\n ],\n proc_macro_deps = [\n \"@crates_no_std__zerocopy-derive-0.8.48//:zerocopy_derive\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"derive\",\n \"zerocopy-derive\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=zerocopy\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.8.48\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"derive\",\n \"zerocopy-derive\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"zerocopy\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=zerocopy\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.8.48\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "strip_prefix": "zerocopy-0.8.56", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"zerocopy\",\n deps = [\n \"@crates_no_std__zerocopy-0.8.56//:build_script_build\",\n ],\n proc_macro_deps = [\n \"@crates_no_std__zerocopy-derive-0.8.56//:zerocopy_derive\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"derive\",\n \"zerocopy-derive\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=zerocopy\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.8.56\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"derive\",\n \"zerocopy-derive\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"zerocopy\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=zerocopy\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.8.56\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, - "crates_no_std__zerocopy-derive-0.8.48": { + "crates_no_std__zerocopy-derive-0.8.56": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4", + "sha256": "f2ab42fc20575779bd240faa45f94a74256f755c0fa9e89f0ede20d91d0cdfc1", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/zerocopy-derive/0.8.48/download" + "https://static.crates.io/crates/zerocopy-derive/0.8.56/download" ], - "strip_prefix": "zerocopy-derive-0.8.48", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"zerocopy_derive\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.106//:proc_macro2\",\n \"@crates_no_std__quote-1.0.45//:quote\",\n \"@crates_no_std__syn-2.0.117//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=zerocopy-derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.8.48\",\n)\n" + "strip_prefix": "zerocopy-derive-0.8.56", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"zerocopy_derive\",\n deps = [\n \"@crates_no_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_no_std__quote-1.0.47//:quote\",\n \"@crates_no_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=zerocopy-derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-none\": [],\n \"@rules_rust//rust/platform:riscv32imac-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:riscv32imc-unknown-none-elf\": [],\n \"@rules_rust//rust/platform:thumbv6m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv7m-none-eabi\": [],\n \"@rules_rust//rust/platform:thumbv8m.main-none-eabihf\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.8.56\",\n)\n" } }, "crates_std": { "repoRuleId": "@@rules_rust+//crate_universe:extensions.bzl%_generate_repo", "attributes": { "contents": { - "BUILD.bazel": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files(\n [\n \"cargo-bazel.json\",\n \"crates.bzl\",\n \"defs.bzl\",\n ] + glob(\n allow_empty = True,\n include = [\"*.bazel\"],\n ),\n)\n\nfilegroup(\n name = \"srcs\",\n srcs = glob(\n allow_empty = True,\n include = [\n \"*.bazel\",\n \"*.bzl\",\n ],\n ),\n)\n\n# Workspace Member Dependencies\nalias(\n name = \"anyhow-1.0.104\",\n actual = \"@crates_std__anyhow-1.0.104//:anyhow\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"anyhow\",\n actual = \"@crates_std__anyhow-1.0.104//:anyhow\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitfield-struct-0.12.1\",\n actual = \"@crates_std__bitfield-struct-0.12.1//:bitfield_struct\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitfield-struct\",\n actual = \"@crates_std__bitfield-struct-0.12.1//:bitfield_struct\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitflags-2.13.1\",\n actual = \"@crates_std__bitflags-2.13.1//:bitflags\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitflags\",\n actual = \"@crates_std__bitflags-2.13.1//:bitflags\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"byteorder-1.5.0\",\n actual = \"@crates_std__byteorder-1.5.0//:byteorder\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"byteorder\",\n actual = \"@crates_std__byteorder-1.5.0//:byteorder\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"clap-4.6.4\",\n actual = \"@crates_std__clap-4.6.4//:clap\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"clap\",\n actual = \"@crates_std__clap-4.6.4//:clap\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cliclack-0.3.8\",\n actual = \"@crates_std__cliclack-0.3.8//:cliclack\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cliclack\",\n actual = \"@crates_std__cliclack-0.3.8//:cliclack\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"futures-0.3.33\",\n actual = \"@crates_std__futures-0.3.33//:futures\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"futures\",\n actual = \"@crates_std__futures-0.3.33//:futures\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"hashlink-0.10.0\",\n actual = \"@crates_std__hashlink-0.10.0//:hashlink\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"hashlink\",\n actual = \"@crates_std__hashlink-0.10.0//:hashlink\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"hex-0.4.3\",\n actual = \"@crates_std__hex-0.4.3//:hex\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"hex\",\n actual = \"@crates_std__hex-0.4.3//:hex\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"libc-0.2.189\",\n actual = \"@crates_std__libc-0.2.189//:libc\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"libc\",\n actual = \"@crates_std__libc-0.2.189//:libc\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"minijinja-2.21.0\",\n actual = \"@crates_std__minijinja-2.21.0//:minijinja\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"minijinja\",\n actual = \"@crates_std__minijinja-2.21.0//:minijinja\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"nix-0.29.0\",\n actual = \"@crates_std__nix-0.29.0//:nix\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"nix\",\n actual = \"@crates_std__nix-0.29.0//:nix\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"nom-7.1.3\",\n actual = \"@crates_std__nom-7.1.3//:nom\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"nom\",\n actual = \"@crates_std__nom-7.1.3//:nom\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"object-0.36.7\",\n actual = \"@crates_std__object-0.36.7//:object\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"object\",\n actual = \"@crates_std__object-0.36.7//:object\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"paste-1.0.15\",\n actual = \"@crates_std__paste-1.0.15//:paste\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"paste\",\n actual = \"@crates_std__paste-1.0.15//:paste\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"proc-macro2-1.0.107\",\n actual = \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"proc-macro2\",\n actual = \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"prost-0.14.4\",\n actual = \"@crates_std__prost-0.14.4//:prost\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"prost\",\n actual = \"@crates_std__prost-0.14.4//:prost\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"prost-reflect-0.16.5\",\n actual = \"@crates_std__prost-reflect-0.16.5//:prost_reflect\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"prost-reflect\",\n actual = \"@crates_std__prost-reflect-0.16.5//:prost_reflect\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"prost-types-0.14.4\",\n actual = \"@crates_std__prost-types-0.14.4//:prost_types\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"prost-types\",\n actual = \"@crates_std__prost-types-0.14.4//:prost_types\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"protoc-gen-prost-0.5.0\",\n actual = \"@crates_std__protoc-gen-prost-0.5.0//:protoc_gen_prost\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"protoc-gen-prost\",\n actual = \"@crates_std__protoc-gen-prost-0.5.0//:protoc_gen_prost\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"psm-0.1.31\",\n actual = \"@crates_std__psm-0.1.31//:psm\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"psm\",\n actual = \"@crates_std__psm-0.1.31//:psm\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"quote-1.0.47\",\n actual = \"@crates_std__quote-1.0.47//:quote\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"quote\",\n actual = \"@crates_std__quote-1.0.47//:quote\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"rustc-demangle-0.1.28\",\n actual = \"@crates_std__rustc-demangle-0.1.28//:rustc_demangle\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"rustc-demangle\",\n actual = \"@crates_std__rustc-demangle-0.1.28//:rustc_demangle\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde-1.0.229\",\n actual = \"@crates_std__serde-1.0.229//:serde\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde\",\n actual = \"@crates_std__serde-1.0.229//:serde\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde_json-1.0.151\",\n actual = \"@crates_std__serde_json-1.0.151//:serde_json\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde_json\",\n actual = \"@crates_std__serde_json-1.0.151//:serde_json\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde_json5-0.2.1\",\n actual = \"@crates_std__serde_json5-0.2.1//:serde_json5\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde_json5\",\n actual = \"@crates_std__serde_json5-0.2.1//:serde_json5\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"syn-2.0.119\",\n actual = \"@crates_std__syn-2.0.119//:syn\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"syn\",\n actual = \"@crates_std__syn-2.0.119//:syn\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"thiserror-2.0.19\",\n actual = \"@crates_std__thiserror-2.0.19//:thiserror\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"thiserror\",\n actual = \"@crates_std__thiserror-2.0.19//:thiserror\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tokio-1.53.1\",\n actual = \"@crates_std__tokio-1.53.1//:tokio\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tokio\",\n actual = \"@crates_std__tokio-1.53.1//:tokio\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tokio-util-0.7.19\",\n actual = \"@crates_std__tokio-util-0.7.19//:tokio_util\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tokio-util\",\n actual = \"@crates_std__tokio-util-0.7.19//:tokio_util\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"toml-0.8.23\",\n actual = \"@crates_std__toml-0.8.23//:toml\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"toml\",\n actual = \"@crates_std__toml-0.8.23//:toml\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zerocopy-0.8.55\",\n actual = \"@crates_std__zerocopy-0.8.55//:zerocopy\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zerocopy\",\n actual = \"@crates_std__zerocopy-0.8.55//:zerocopy\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zngur-0.10.0\",\n actual = \"@crates_std__zngur-0.10.0//:zngur\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zngur\",\n actual = \"@crates_std__zngur-0.10.0//:zngur\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zngur-lib-0.10.0\",\n actual = \"@crates_std__zngur-lib-0.10.0//:zngur_lib\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zngur-lib\",\n actual = \"@crates_std__zngur-lib-0.10.0//:zngur_lib\",\n tags = [\"manual\"],\n)\n\n# Binaries\nalias(\n name = \"protoc-gen-prost__protoc-gen-prost\",\n actual = \"@crates_std__protoc-gen-prost-0.5.0//:protoc-gen-prost__bin\",\n tags = [\"manual\"],\n)\n", + "BUILD.bazel": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files(\n [\n \"cargo-bazel.json\",\n \"crates.bzl\",\n \"defs.bzl\",\n ] + glob(\n allow_empty = True,\n include = [\"*.bazel\"],\n ),\n)\n\nfilegroup(\n name = \"srcs\",\n srcs = glob(\n allow_empty = True,\n include = [\n \"*.bazel\",\n \"*.bzl\",\n ],\n ),\n)\n\n# Workspace Member Dependencies\nalias(\n name = \"anyhow-1.0.104\",\n actual = \"@crates_std__anyhow-1.0.104//:anyhow\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"anyhow\",\n actual = \"@crates_std__anyhow-1.0.104//:anyhow\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitfield-struct-0.13.0\",\n actual = \"@crates_std__bitfield-struct-0.13.0//:bitfield_struct\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitfield-struct\",\n actual = \"@crates_std__bitfield-struct-0.13.0//:bitfield_struct\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitflags-2.13.1\",\n actual = \"@crates_std__bitflags-2.13.1//:bitflags\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"bitflags\",\n actual = \"@crates_std__bitflags-2.13.1//:bitflags\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"byteorder-1.5.0\",\n actual = \"@crates_std__byteorder-1.5.0//:byteorder\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"byteorder\",\n actual = \"@crates_std__byteorder-1.5.0//:byteorder\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"clap-4.6.6\",\n actual = \"@crates_std__clap-4.6.6//:clap\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"clap\",\n actual = \"@crates_std__clap-4.6.6//:clap\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cliclack-0.5.6\",\n actual = \"@crates_std__cliclack-0.5.6//:cliclack\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"cliclack\",\n actual = \"@crates_std__cliclack-0.5.6//:cliclack\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"futures-0.3.34\",\n actual = \"@crates_std__futures-0.3.34//:futures\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"futures\",\n actual = \"@crates_std__futures-0.3.34//:futures\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"hex-0.4.3\",\n actual = \"@crates_std__hex-0.4.3//:hex\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"hex\",\n actual = \"@crates_std__hex-0.4.3//:hex\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"libc-0.2.189\",\n actual = \"@crates_std__libc-0.2.189//:libc\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"libc\",\n actual = \"@crates_std__libc-0.2.189//:libc\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"minijinja-2.24.0\",\n actual = \"@crates_std__minijinja-2.24.0//:minijinja\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"minijinja\",\n actual = \"@crates_std__minijinja-2.24.0//:minijinja\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"nix-0.31.3\",\n actual = \"@crates_std__nix-0.31.3//:nix\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"nix\",\n actual = \"@crates_std__nix-0.31.3//:nix\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"nom-8.0.0\",\n actual = \"@crates_std__nom-8.0.0//:nom\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"nom\",\n actual = \"@crates_std__nom-8.0.0//:nom\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"object-0.40.0\",\n actual = \"@crates_std__object-0.40.0//:object\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"object\",\n actual = \"@crates_std__object-0.40.0//:object\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"paste-1.0.15\",\n actual = \"@crates_std__paste-1.0.15//:paste\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"paste\",\n actual = \"@crates_std__paste-1.0.15//:paste\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"proc-macro2-1.0.107\",\n actual = \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"proc-macro2\",\n actual = \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"prost-0.14.4\",\n actual = \"@crates_std__prost-0.14.4//:prost\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"prost\",\n actual = \"@crates_std__prost-0.14.4//:prost\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"prost-reflect-0.16.5\",\n actual = \"@crates_std__prost-reflect-0.16.5//:prost_reflect\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"prost-reflect\",\n actual = \"@crates_std__prost-reflect-0.16.5//:prost_reflect\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"prost-types-0.14.4\",\n actual = \"@crates_std__prost-types-0.14.4//:prost_types\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"prost-types\",\n actual = \"@crates_std__prost-types-0.14.4//:prost_types\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"protoc-gen-prost-0.5.0\",\n actual = \"@crates_std__protoc-gen-prost-0.5.0//:protoc_gen_prost\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"protoc-gen-prost\",\n actual = \"@crates_std__protoc-gen-prost-0.5.0//:protoc_gen_prost\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"quote-1.0.47\",\n actual = \"@crates_std__quote-1.0.47//:quote\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"quote\",\n actual = \"@crates_std__quote-1.0.47//:quote\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"rustc-demangle-0.1.28\",\n actual = \"@crates_std__rustc-demangle-0.1.28//:rustc_demangle\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"rustc-demangle\",\n actual = \"@crates_std__rustc-demangle-0.1.28//:rustc_demangle\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde-1.0.229\",\n actual = \"@crates_std__serde-1.0.229//:serde\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde\",\n actual = \"@crates_std__serde-1.0.229//:serde\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde_json-1.0.151\",\n actual = \"@crates_std__serde_json-1.0.151//:serde_json\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde_json\",\n actual = \"@crates_std__serde_json-1.0.151//:serde_json\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde_json5-0.2.1\",\n actual = \"@crates_std__serde_json5-0.2.1//:serde_json5\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"serde_json5\",\n actual = \"@crates_std__serde_json5-0.2.1//:serde_json5\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"syn-3.0.4\",\n actual = \"@crates_std__syn-3.0.4//:syn\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"syn\",\n actual = \"@crates_std__syn-3.0.4//:syn\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"thiserror-2.0.20\",\n actual = \"@crates_std__thiserror-2.0.20//:thiserror\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"thiserror\",\n actual = \"@crates_std__thiserror-2.0.20//:thiserror\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tokio-1.53.1\",\n actual = \"@crates_std__tokio-1.53.1//:tokio\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tokio\",\n actual = \"@crates_std__tokio-1.53.1//:tokio\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tokio-util-0.7.19\",\n actual = \"@crates_std__tokio-util-0.7.19//:tokio_util\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"tokio-util\",\n actual = \"@crates_std__tokio-util-0.7.19//:tokio_util\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"toml-1.1.4+spec-1.1.0\",\n actual = \"@crates_std__toml-1.1.4-spec-1.1.0//:toml\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"toml\",\n actual = \"@crates_std__toml-1.1.4-spec-1.1.0//:toml\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zerocopy-0.8.56\",\n actual = \"@crates_std__zerocopy-0.8.56//:zerocopy\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zerocopy\",\n actual = \"@crates_std__zerocopy-0.8.56//:zerocopy\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zngur-0.10.0\",\n actual = \"@crates_std__zngur-0.10.0//:zngur\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zngur\",\n actual = \"@crates_std__zngur-0.10.0//:zngur\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zngur-lib-0.10.0\",\n actual = \"@crates_std__zngur-lib-0.10.0//:zngur_lib\",\n tags = [\"manual\"],\n)\n\nalias(\n name = \"zngur-lib\",\n actual = \"@crates_std__zngur-lib-0.10.0//:zngur_lib\",\n tags = [\"manual\"],\n)\n\n# Binaries\nalias(\n name = \"protoc-gen-prost__protoc-gen-prost\",\n actual = \"@crates_std__protoc-gen-prost-0.5.0//:protoc-gen-prost__bin\",\n tags = [\"manual\"],\n)\n", "alias_rules.bzl": "\"\"\"Alias that transitions its target to `compilation_mode=opt`. Use `transition_alias=\"opt\"` to enable.\"\"\"\n\nload(\"@rules_cc//cc:defs.bzl\", \"CcInfo\")\nload(\"@rules_rust//rust:rust_common.bzl\", \"COMMON_PROVIDERS\")\n\ndef _transition_alias_impl(ctx):\n # `ctx.attr.actual` is a list of 1 item due to the transition\n providers = [ctx.attr.actual[0][provider] for provider in COMMON_PROVIDERS]\n if CcInfo in ctx.attr.actual[0]:\n providers.append(ctx.attr.actual[0][CcInfo])\n return providers\n\ndef _change_compilation_mode(compilation_mode):\n def _change_compilation_mode_impl(_settings, _attr):\n return {\n \"//command_line_option:compilation_mode\": compilation_mode,\n }\n\n return transition(\n implementation = _change_compilation_mode_impl,\n inputs = [],\n outputs = [\n \"//command_line_option:compilation_mode\",\n ],\n )\n\ndef _transition_alias_rule(compilation_mode):\n return rule(\n implementation = _transition_alias_impl,\n provides = COMMON_PROVIDERS,\n attrs = {\n \"actual\": attr.label(\n mandatory = True,\n doc = \"`rust_library()` target to transition to `compilation_mode=opt`.\",\n providers = COMMON_PROVIDERS,\n cfg = _change_compilation_mode(compilation_mode),\n ),\n \"_allowlist_function_transition\": attr.label(\n default = \"@bazel_tools//tools/allowlists/function_transition_allowlist\",\n ),\n },\n doc = \"Transitions a Rust library crate to the `compilation_mode=opt`.\",\n )\n\ntransition_alias_dbg = _transition_alias_rule(\"dbg\")\ntransition_alias_fastbuild = _transition_alias_rule(\"fastbuild\")\ntransition_alias_opt = _transition_alias_rule(\"opt\")\n", - "defs.bzl": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\"\"\"\n# `crates_repository` API\n\n- [aliases](#aliases)\n- [crate_deps](#crate_deps)\n- [all_crate_deps](#all_crate_deps)\n- [crate_repositories](#crate_repositories)\n\n\"\"\"\n\nload(\"@bazel_tools//tools/build_defs/repo:git.bzl\", \"git_repository\")\nload(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\")\nload(\"@bazel_tools//tools/build_defs/repo:utils.bzl\", \"maybe\")\nload(\"@bazel_skylib//lib:selects.bzl\", \"selects\")\nload(\"@rules_rust//crate_universe/private:local_crate_mirror.bzl\", \"local_crate_mirror\")\n\n###############################################################################\n# MACROS API\n###############################################################################\n\n# An identifier that represent common dependencies (unconditional).\n_COMMON_CONDITION = \"\"\n\ndef _flatten_dependency_maps(all_dependency_maps):\n \"\"\"Flatten a list of dependency maps into one dictionary.\n\n Dependency maps have the following structure:\n\n ```python\n DEPENDENCIES_MAP = {\n # The first key in the map is a Bazel package\n # name of the workspace this file is defined in.\n \"workspace_member_package\": {\n\n # Not all dependencies are supported for all platforms.\n # the condition key is the condition required to be true\n # on the host platform.\n \"condition\": {\n\n # An alias to a crate target. # The label of the crate target the\n # Aliases are only crate names. # package name refers to.\n \"package_name\": \"@full//:label\",\n }\n }\n }\n ```\n\n Args:\n all_dependency_maps (list): A list of dicts as described above\n\n Returns:\n dict: A dictionary as described above\n \"\"\"\n dependencies = {}\n\n for workspace_deps_map in all_dependency_maps:\n for pkg_name, conditional_deps_map in workspace_deps_map.items():\n if pkg_name not in dependencies:\n non_frozen_map = dict()\n for key, values in conditional_deps_map.items():\n non_frozen_map.update({key: dict(values.items())})\n dependencies.setdefault(pkg_name, non_frozen_map)\n continue\n\n for condition, deps_map in conditional_deps_map.items():\n # If the condition has not been recorded, do so and continue\n if condition not in dependencies[pkg_name]:\n dependencies[pkg_name].setdefault(condition, dict(deps_map.items()))\n continue\n\n # Alert on any miss-matched dependencies\n inconsistent_entries = []\n for crate_name, crate_label in deps_map.items():\n existing = dependencies[pkg_name][condition].get(crate_name)\n if existing and existing != crate_label:\n inconsistent_entries.append((crate_name, existing, crate_label))\n dependencies[pkg_name][condition].update({crate_name: crate_label})\n\n return dependencies\n\ndef crate_deps(deps, package_name = None):\n \"\"\"Finds the fully qualified label of the requested crates for the package where this macro is called.\n\n Args:\n deps (list): The desired list of crate targets.\n package_name (str, optional): The package name of the set of dependencies to look up.\n Defaults to `native.package_name()`.\n\n Returns:\n list: A list of labels to generated rust targets (str)\n \"\"\"\n\n if not deps:\n return []\n\n if package_name == None:\n package_name = native.package_name()\n\n # Join both sets of dependencies\n dependencies = _flatten_dependency_maps([\n _NORMAL_DEPENDENCIES,\n _NORMAL_DEV_DEPENDENCIES,\n _PROC_MACRO_DEPENDENCIES,\n _PROC_MACRO_DEV_DEPENDENCIES,\n _BUILD_DEPENDENCIES,\n _BUILD_PROC_MACRO_DEPENDENCIES,\n ]).pop(package_name, {})\n\n # Combine all conditional packages so we can easily index over a flat list\n # TODO: Perhaps this should actually return select statements and maintain\n # the conditionals of the dependencies\n flat_deps = {}\n for deps_set in dependencies.values():\n for crate_name, crate_label in deps_set.items():\n flat_deps.update({crate_name: crate_label})\n\n missing_crates = []\n crate_targets = []\n for crate_target in deps:\n if crate_target not in flat_deps:\n missing_crates.append(crate_target)\n else:\n crate_targets.append(flat_deps[crate_target])\n\n if missing_crates:\n fail(\"Could not find crates `{}` among dependencies of `{}`. Available dependencies were `{}`\".format(\n missing_crates,\n package_name,\n dependencies,\n ))\n\n return crate_targets\n\ndef all_crate_deps(\n normal = False, \n normal_dev = False, \n proc_macro = False, \n proc_macro_dev = False,\n build = False,\n build_proc_macro = False,\n package_name = None):\n \"\"\"Finds the fully qualified label of all requested direct crate dependencies \\\n for the package where this macro is called.\n\n If no parameters are set, all normal dependencies are returned. Setting any one flag will\n otherwise impact the contents of the returned list.\n\n Args:\n normal (bool, optional): If True, normal dependencies are included in the\n output list.\n normal_dev (bool, optional): If True, normal dev dependencies will be\n included in the output list.\n proc_macro (bool, optional): If True, proc_macro dependencies are included\n in the output list.\n proc_macro_dev (bool, optional): If True, dev proc_macro dependencies are\n included in the output list.\n build (bool, optional): If True, build dependencies are included\n in the output list.\n build_proc_macro (bool, optional): If True, build proc_macro dependencies are\n included in the output list.\n package_name (str, optional): The package name of the set of dependencies to look up.\n Defaults to `native.package_name()` when unset.\n\n Returns:\n list: A list of labels to generated rust targets (str)\n \"\"\"\n\n if package_name == None:\n package_name = native.package_name()\n\n # Determine the relevant maps to use\n all_dependency_maps = []\n if normal:\n all_dependency_maps.append(_NORMAL_DEPENDENCIES)\n if normal_dev:\n all_dependency_maps.append(_NORMAL_DEV_DEPENDENCIES)\n if proc_macro:\n all_dependency_maps.append(_PROC_MACRO_DEPENDENCIES)\n if proc_macro_dev:\n all_dependency_maps.append(_PROC_MACRO_DEV_DEPENDENCIES)\n if build:\n all_dependency_maps.append(_BUILD_DEPENDENCIES)\n if build_proc_macro:\n all_dependency_maps.append(_BUILD_PROC_MACRO_DEPENDENCIES)\n\n # Default to always using normal dependencies\n if not all_dependency_maps:\n all_dependency_maps.append(_NORMAL_DEPENDENCIES)\n\n dependencies = _flatten_dependency_maps(all_dependency_maps).pop(package_name, None)\n\n if not dependencies:\n if dependencies == None:\n fail(\"Tried to get all_crate_deps for package \" + package_name + \" but that package had no Cargo.toml file\")\n else:\n return []\n\n crate_deps = list(dependencies.pop(_COMMON_CONDITION, {}).values())\n for condition, deps in dependencies.items():\n crate_deps += selects.with_or({\n tuple(_CONDITIONS[condition]): deps.values(),\n \"//conditions:default\": [],\n })\n\n return crate_deps\n\ndef aliases(\n normal = False,\n normal_dev = False,\n proc_macro = False,\n proc_macro_dev = False,\n build = False,\n build_proc_macro = False,\n package_name = None):\n \"\"\"Produces a map of Crate alias names to their original label\n\n If no dependency kinds are specified, `normal` and `proc_macro` are used by default.\n Setting any one flag will otherwise determine the contents of the returned dict.\n\n Args:\n normal (bool, optional): If True, normal dependencies are included in the\n output list.\n normal_dev (bool, optional): If True, normal dev dependencies will be\n included in the output list..\n proc_macro (bool, optional): If True, proc_macro dependencies are included\n in the output list.\n proc_macro_dev (bool, optional): If True, dev proc_macro dependencies are\n included in the output list.\n build (bool, optional): If True, build dependencies are included\n in the output list.\n build_proc_macro (bool, optional): If True, build proc_macro dependencies are\n included in the output list.\n package_name (str, optional): The package name of the set of dependencies to look up.\n Defaults to `native.package_name()` when unset.\n\n Returns:\n dict: The aliases of all associated packages\n \"\"\"\n if package_name == None:\n package_name = native.package_name()\n\n # Determine the relevant maps to use\n all_aliases_maps = []\n if normal:\n all_aliases_maps.append(_NORMAL_ALIASES)\n if normal_dev:\n all_aliases_maps.append(_NORMAL_DEV_ALIASES)\n if proc_macro:\n all_aliases_maps.append(_PROC_MACRO_ALIASES)\n if proc_macro_dev:\n all_aliases_maps.append(_PROC_MACRO_DEV_ALIASES)\n if build:\n all_aliases_maps.append(_BUILD_ALIASES)\n if build_proc_macro:\n all_aliases_maps.append(_BUILD_PROC_MACRO_ALIASES)\n\n # Default to always using normal aliases\n if not all_aliases_maps:\n all_aliases_maps.append(_NORMAL_ALIASES)\n all_aliases_maps.append(_PROC_MACRO_ALIASES)\n\n aliases = _flatten_dependency_maps(all_aliases_maps).pop(package_name, None)\n\n if not aliases:\n return dict()\n\n common_items = aliases.pop(_COMMON_CONDITION, {}).items()\n\n # If there are only common items in the dictionary, immediately return them\n if not len(aliases.keys()) == 1:\n return dict(common_items)\n\n # Build a single select statement where each conditional has accounted for the\n # common set of aliases.\n crate_aliases = {\"//conditions:default\": dict(common_items)}\n for condition, deps in aliases.items():\n condition_triples = _CONDITIONS[condition]\n for triple in condition_triples:\n if triple in crate_aliases:\n crate_aliases[triple].update(deps)\n else:\n crate_aliases.update({triple: dict(deps.items() + common_items)})\n\n return select(crate_aliases)\n\n###############################################################################\n# WORKSPACE MEMBER DEPS AND ALIASES\n###############################################################################\n\n_NORMAL_DEPENDENCIES = {\n \"third_party/crates_io/crates_std\": {\n _COMMON_CONDITION: {\n \"anyhow\": Label(\"@crates_std//:anyhow-1.0.104\"),\n \"bitflags\": Label(\"@crates_std//:bitflags-2.13.1\"),\n \"byteorder\": Label(\"@crates_std//:byteorder-1.5.0\"),\n \"clap\": Label(\"@crates_std//:clap-4.6.4\"),\n \"cliclack\": Label(\"@crates_std//:cliclack-0.3.8\"),\n \"futures\": Label(\"@crates_std//:futures-0.3.33\"),\n \"hashlink\": Label(\"@crates_std//:hashlink-0.10.0\"),\n \"hex\": Label(\"@crates_std//:hex-0.4.3\"),\n \"libc\": Label(\"@crates_std//:libc-0.2.189\"),\n \"minijinja\": Label(\"@crates_std//:minijinja-2.21.0\"),\n \"nix\": Label(\"@crates_std//:nix-0.29.0\"),\n \"nom\": Label(\"@crates_std//:nom-7.1.3\"),\n \"object\": Label(\"@crates_std//:object-0.36.7\"),\n \"proc-macro2\": Label(\"@crates_std//:proc-macro2-1.0.107\"),\n \"prost\": Label(\"@crates_std//:prost-0.14.4\"),\n \"prost-reflect\": Label(\"@crates_std//:prost-reflect-0.16.5\"),\n \"prost-types\": Label(\"@crates_std//:prost-types-0.14.4\"),\n \"protoc-gen-prost\": Label(\"@crates_std//:protoc-gen-prost-0.5.0\"),\n \"psm\": Label(\"@crates_std//:psm-0.1.31\"),\n \"quote\": Label(\"@crates_std//:quote-1.0.47\"),\n \"rustc-demangle\": Label(\"@crates_std//:rustc-demangle-0.1.28\"),\n \"serde\": Label(\"@crates_std//:serde-1.0.229\"),\n \"serde_json\": Label(\"@crates_std//:serde_json-1.0.151\"),\n \"serde_json5\": Label(\"@crates_std//:serde_json5-0.2.1\"),\n \"syn\": Label(\"@crates_std//:syn-2.0.119\"),\n \"thiserror\": Label(\"@crates_std//:thiserror-2.0.19\"),\n \"tokio\": Label(\"@crates_std//:tokio-1.53.1\"),\n \"tokio-util\": Label(\"@crates_std//:tokio-util-0.7.19\"),\n \"toml\": Label(\"@crates_std//:toml-0.8.23\"),\n \"zerocopy\": Label(\"@crates_std//:zerocopy-0.8.55\"),\n \"zngur\": Label(\"@crates_std//:zngur-0.10.0\"),\n \"zngur-lib\": Label(\"@crates_std//:zngur-lib-0.10.0\"),\n },\n },\n}\n\n\n_NORMAL_ALIASES = {\n \"third_party/crates_io/crates_std\": {\n _COMMON_CONDITION: {\n },\n },\n}\n\n\n_NORMAL_DEV_DEPENDENCIES = {\n \"third_party/crates_io/crates_std\": {\n },\n}\n\n\n_NORMAL_DEV_ALIASES = {\n \"third_party/crates_io/crates_std\": {\n },\n}\n\n\n_PROC_MACRO_DEPENDENCIES = {\n \"third_party/crates_io/crates_std\": {\n _COMMON_CONDITION: {\n \"bitfield-struct\": Label(\"@crates_std//:bitfield-struct-0.12.1\"),\n \"paste\": Label(\"@crates_std//:paste-1.0.15\"),\n },\n },\n}\n\n\n_PROC_MACRO_ALIASES = {\n \"third_party/crates_io/crates_std\": {\n },\n}\n\n\n_PROC_MACRO_DEV_DEPENDENCIES = {\n \"third_party/crates_io/crates_std\": {\n },\n}\n\n\n_PROC_MACRO_DEV_ALIASES = {\n \"third_party/crates_io/crates_std\": {\n },\n}\n\n\n_BUILD_DEPENDENCIES = {\n \"third_party/crates_io/crates_std\": {\n },\n}\n\n\n_BUILD_ALIASES = {\n \"third_party/crates_io/crates_std\": {\n },\n}\n\n\n_BUILD_PROC_MACRO_DEPENDENCIES = {\n \"third_party/crates_io/crates_std\": {\n },\n}\n\n\n_BUILD_PROC_MACRO_ALIASES = {\n \"third_party/crates_io/crates_std\": {\n },\n}\n\n\n_CONDITIONS = {\n \"aarch64-apple-darwin\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\"],\n \"aarch64-linux-android\": [],\n \"aarch64-pc-windows-gnullvm\": [],\n \"aarch64-unknown-linux-gnu\": [\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\"],\n \"arm64ec-pc-windows-msvc\": [],\n \"cfg(all(any(target_arch = \\\"x86_64\\\", target_arch = \\\"arm64ec\\\"), target_env = \\\"msvc\\\", not(windows_raw_dylib)))\": [],\n \"cfg(all(any(target_os = \\\"linux\\\", target_os = \\\"android\\\"), any(rustix_use_libc, miri, not(all(target_os = \\\"linux\\\", any(target_endian = \\\"little\\\", any(target_arch = \\\"s390x\\\", target_arch = \\\"powerpc\\\")), any(target_arch = \\\"arm\\\", all(target_arch = \\\"aarch64\\\", target_pointer_width = \\\"64\\\"), target_arch = \\\"riscv64\\\", all(rustix_use_experimental_asm, target_arch = \\\"powerpc\\\"), all(rustix_use_experimental_asm, target_arch = \\\"powerpc64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"s390x\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips32r6\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64r6\\\"), target_arch = \\\"x86\\\", all(target_arch = \\\"x86_64\\\", target_pointer_width = \\\"64\\\")))))))\": [],\n \"cfg(all(not(rustix_use_libc), not(miri), target_os = \\\"linux\\\", any(target_endian = \\\"little\\\", any(target_arch = \\\"s390x\\\", target_arch = \\\"powerpc\\\")), any(target_arch = \\\"arm\\\", all(target_arch = \\\"aarch64\\\", target_pointer_width = \\\"64\\\"), target_arch = \\\"riscv64\\\", all(rustix_use_experimental_asm, target_arch = \\\"powerpc\\\"), all(rustix_use_experimental_asm, target_arch = \\\"powerpc64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"s390x\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips32r6\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64r6\\\"), target_arch = \\\"x86\\\", all(target_arch = \\\"x86_64\\\", target_pointer_width = \\\"64\\\"))))\": [\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \\\"linux\\\", any(target_endian = \\\"little\\\", any(target_arch = \\\"s390x\\\", target_arch = \\\"powerpc\\\")), any(target_arch = \\\"arm\\\", all(target_arch = \\\"aarch64\\\", target_pointer_width = \\\"64\\\"), target_arch = \\\"riscv64\\\", all(rustix_use_experimental_asm, target_arch = \\\"powerpc\\\"), all(rustix_use_experimental_asm, target_arch = \\\"powerpc64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"s390x\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips32r6\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64r6\\\"), target_arch = \\\"x86\\\", all(target_arch = \\\"x86_64\\\", target_pointer_width = \\\"64\\\")))))))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-apple-darwin\"],\n \"cfg(all(target_arch = \\\"aarch64\\\", target_env = \\\"msvc\\\", not(windows_raw_dylib)))\": [],\n \"cfg(all(target_arch = \\\"aarch64\\\", target_os = \\\"linux\\\"))\": [\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\"],\n \"cfg(all(target_arch = \\\"aarch64\\\", target_vendor = \\\"apple\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\"],\n \"cfg(all(target_arch = \\\"loongarch64\\\", target_os = \\\"linux\\\"))\": [],\n \"cfg(all(target_arch = \\\"x86\\\", target_env = \\\"gnu\\\", not(target_abi = \\\"llvm\\\"), not(windows_raw_dylib)))\": [],\n \"cfg(all(target_arch = \\\"x86\\\", target_env = \\\"msvc\\\", not(windows_raw_dylib)))\": [],\n \"cfg(all(target_arch = \\\"x86_64\\\", target_env = \\\"gnu\\\", not(target_abi = \\\"llvm\\\"), not(windows_raw_dylib)))\": [\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(all(target_family = \\\"wasm\\\", target_os = \\\"unknown\\\"))\": [],\n \"cfg(all(windows, not(target_arch = \\\"arm64ec\\\")))\": [],\n \"cfg(any())\": [],\n \"cfg(any(target_arch = \\\"aarch64\\\", target_arch = \\\"x86_64\\\", target_arch = \\\"x86\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(any(unix, target_os = \\\"hermit\\\", target_os = \\\"wasi\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(any(unix, target_os = \\\"wasi\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(target_os = \\\"hermit\\\")\": [],\n \"cfg(target_os = \\\"redox\\\")\": [],\n \"cfg(target_os = \\\"wasi\\\")\": [],\n \"cfg(unix)\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(windows)\": [],\n \"i686-pc-windows-gnullvm\": [],\n \"x86_64-apple-darwin\": [\"@rules_rust//rust/platform:x86_64-apple-darwin\"],\n \"x86_64-pc-windows-gnullvm\": [],\n \"x86_64-unknown-linux-gnu\": [\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n}\n\n###############################################################################\n\ndef crate_repositories():\n \"\"\"A macro for defining repositories for all generated crates.\n\n Returns:\n A list of repos visible to the module through the module extension.\n \"\"\"\n maybe(\n http_archive,\n name = \"crates_std__adler2-2.0.1\",\n sha256 = \"320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/adler2/2.0.1/download\"],\n strip_prefix = \"adler2-2.0.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.adler2-2.0.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__aho-corasick-1.1.4\",\n sha256 = \"ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/aho-corasick/1.1.4/download\"],\n strip_prefix = \"aho-corasick-1.1.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.aho-corasick-1.1.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__allocator-api2-0.2.21\",\n sha256 = \"683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/allocator-api2/0.2.21/download\"],\n strip_prefix = \"allocator-api2-0.2.21\",\n build_file = Label(\"@crates_std//crates_std:BUILD.allocator-api2-0.2.21.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__anstream-1.0.0\",\n sha256 = \"824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstream/1.0.0/download\"],\n strip_prefix = \"anstream-1.0.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.anstream-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__anstyle-1.0.14\",\n sha256 = \"940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstyle/1.0.14/download\"],\n strip_prefix = \"anstyle-1.0.14\",\n build_file = Label(\"@crates_std//crates_std:BUILD.anstyle-1.0.14.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__anstyle-parse-1.0.0\",\n sha256 = \"52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstyle-parse/1.0.0/download\"],\n strip_prefix = \"anstyle-parse-1.0.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.anstyle-parse-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__anstyle-query-1.1.5\",\n sha256 = \"40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstyle-query/1.1.5/download\"],\n strip_prefix = \"anstyle-query-1.1.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.anstyle-query-1.1.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__anstyle-wincon-3.0.11\",\n sha256 = \"291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstyle-wincon/3.0.11/download\"],\n strip_prefix = \"anstyle-wincon-3.0.11\",\n build_file = Label(\"@crates_std//crates_std:BUILD.anstyle-wincon-3.0.11.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__anyhow-1.0.104\",\n sha256 = \"330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anyhow/1.0.104/download\"],\n strip_prefix = \"anyhow-1.0.104\",\n build_file = Label(\"@crates_std//crates_std:BUILD.anyhow-1.0.104.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__ar_archive_writer-0.5.2\",\n sha256 = \"4087686b4b0a3427190bae57a1d9a478dbb2d40c5dc1bd6e2b6d797913bdd348\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ar_archive_writer/0.5.2/download\"],\n strip_prefix = \"ar_archive_writer-0.5.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.ar_archive_writer-0.5.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__ariadne-0.3.0\",\n sha256 = \"72fe02fc62033df9ba41cba57ee19acf5e742511a140c7dbc3a873e19a19a1bd\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ariadne/0.3.0/download\"],\n strip_prefix = \"ariadne-0.3.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.ariadne-0.3.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__askama-0.12.1\",\n sha256 = \"b79091df18a97caea757e28cd2d5fda49c6cd4bd01ddffd7ff01ace0c0ad2c28\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/askama/0.12.1/download\"],\n strip_prefix = \"askama-0.12.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.askama-0.12.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__askama_derive-0.12.5\",\n sha256 = \"19fe8d6cb13c4714962c072ea496f3392015f0989b1a2847bb4b2d9effd71d83\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/askama_derive/0.12.5/download\"],\n strip_prefix = \"askama_derive-0.12.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.askama_derive-0.12.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__askama_escape-0.10.3\",\n sha256 = \"619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/askama_escape/0.10.3/download\"],\n strip_prefix = \"askama_escape-0.10.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.askama_escape-0.10.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__askama_parser-0.2.1\",\n sha256 = \"acb1161c6b64d1c3d83108213c2a2533a342ac225aabd0bda218278c2ddb00c0\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/askama_parser/0.2.1/download\"],\n strip_prefix = \"askama_parser-0.2.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.askama_parser-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__autocfg-1.5.1\",\n sha256 = \"f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/autocfg/1.5.1/download\"],\n strip_prefix = \"autocfg-1.5.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.autocfg-1.5.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__basic-toml-0.1.10\",\n sha256 = \"ba62675e8242a4c4e806d12f11d136e626e6c8361d6b829310732241652a178a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/basic-toml/0.1.10/download\"],\n strip_prefix = \"basic-toml-0.1.10\",\n build_file = Label(\"@crates_std//crates_std:BUILD.basic-toml-0.1.10.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__bitfield-struct-0.12.1\",\n sha256 = \"8769c4854c5ada2852ddf6fd09d15cf43d4c2aaeccb4de6432f5402f08a6003b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bitfield-struct/0.12.1/download\"],\n strip_prefix = \"bitfield-struct-0.12.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.bitfield-struct-0.12.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__bitflags-2.13.1\",\n sha256 = \"b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bitflags/2.13.1/download\"],\n strip_prefix = \"bitflags-2.13.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.bitflags-2.13.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__block-buffer-0.10.4\",\n sha256 = \"3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/block-buffer/0.10.4/download\"],\n strip_prefix = \"block-buffer-0.10.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.block-buffer-0.10.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__bumpalo-3.20.3\",\n sha256 = \"72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bumpalo/3.20.3/download\"],\n strip_prefix = \"bumpalo-3.20.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.bumpalo-3.20.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__byteorder-1.5.0\",\n sha256 = \"1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/byteorder/1.5.0/download\"],\n strip_prefix = \"byteorder-1.5.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.byteorder-1.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__bytes-1.12.1\",\n sha256 = \"fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bytes/1.12.1/download\"],\n strip_prefix = \"bytes-1.12.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.bytes-1.12.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__cc-1.4.0\",\n sha256 = \"5add81bb678e6cb321aff7fa0dc7689ad82b112dbc032cea19f91d6b8e3582b9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cc/1.4.0/download\"],\n strip_prefix = \"cc-1.4.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.cc-1.4.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__cfg-if-1.0.4\",\n sha256 = \"9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cfg-if/1.0.4/download\"],\n strip_prefix = \"cfg-if-1.0.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.cfg-if-1.0.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__cfg_aliases-0.2.2\",\n sha256 = \"f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cfg_aliases/0.2.2/download\"],\n strip_prefix = \"cfg_aliases-0.2.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.cfg_aliases-0.2.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__chumsky-1.0.0-alpha.8\",\n sha256 = \"0e82d74e6c83060ec269fe9e0d408d6de4a1645d525f9a0bbbb841ba4efd91ac\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/chumsky/1.0.0-alpha.8/download\"],\n strip_prefix = \"chumsky-1.0.0-alpha.8\",\n build_file = Label(\"@crates_std//crates_std:BUILD.chumsky-1.0.0-alpha.8.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__clap-4.6.4\",\n sha256 = \"d91e0c145792ef73a6ad36d27c75ac09f1832222a3c209689d90f534685ee5b7\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/clap/4.6.4/download\"],\n strip_prefix = \"clap-4.6.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.clap-4.6.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__clap_builder-4.6.2\",\n sha256 = \"f09628afdcc538b57f3c6341e9c8e9970f18e4a481690a64974d7023bd33548b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/clap_builder/4.6.2/download\"],\n strip_prefix = \"clap_builder-4.6.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.clap_builder-4.6.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__clap_derive-4.6.4\",\n sha256 = \"d012d2b9d65aca7f18f4d9878a045bc17899bba951561ba5ec3c2ba1eed9a061\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/clap_derive/4.6.4/download\"],\n strip_prefix = \"clap_derive-4.6.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.clap_derive-4.6.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__clap_lex-1.1.0\",\n sha256 = \"c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/clap_lex/1.1.0/download\"],\n strip_prefix = \"clap_lex-1.1.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.clap_lex-1.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__cliclack-0.3.8\",\n sha256 = \"aa510b739c618c679375ea9c5af44ce9f591289546e874ad5910e7ce7df79844\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cliclack/0.3.8/download\"],\n strip_prefix = \"cliclack-0.3.8\",\n build_file = Label(\"@crates_std//crates_std:BUILD.cliclack-0.3.8.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__colorchoice-1.0.5\",\n sha256 = \"1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/colorchoice/1.0.5/download\"],\n strip_prefix = \"colorchoice-1.0.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.colorchoice-1.0.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__console-0.15.11\",\n sha256 = \"054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/console/0.15.11/download\"],\n strip_prefix = \"console-0.15.11\",\n build_file = Label(\"@crates_std//crates_std:BUILD.console-0.15.11.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__console-0.16.4\",\n sha256 = \"4fe5f465a4f6fee88fad41b85d990f84c835335e85b5d9e6e63e0d06d28cba7c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/console/0.16.4/download\"],\n strip_prefix = \"console-0.16.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.console-0.16.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__cpufeatures-0.2.17\",\n sha256 = \"59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cpufeatures/0.2.17/download\"],\n strip_prefix = \"cpufeatures-0.2.17\",\n build_file = Label(\"@crates_std//crates_std:BUILD.cpufeatures-0.2.17.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__crc32fast-1.5.0\",\n sha256 = \"9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/crc32fast/1.5.0/download\"],\n strip_prefix = \"crc32fast-1.5.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.crc32fast-1.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__crypto-common-0.1.7\",\n sha256 = \"78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/crypto-common/0.1.7/download\"],\n strip_prefix = \"crypto-common-0.1.7\",\n build_file = Label(\"@crates_std//crates_std:BUILD.crypto-common-0.1.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__digest-0.10.7\",\n sha256 = \"9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/digest/0.10.7/download\"],\n strip_prefix = \"digest-0.10.7\",\n build_file = Label(\"@crates_std//crates_std:BUILD.digest-0.10.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__either-1.17.0\",\n sha256 = \"9e5e8f6c15a24b9a3ee5efec809ccd006d3b30e8b3bb63c39af737c7f87daa1d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/either/1.17.0/download\"],\n strip_prefix = \"either-1.17.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.either-1.17.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__encode_unicode-1.0.0\",\n sha256 = \"34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/encode_unicode/1.0.0/download\"],\n strip_prefix = \"encode_unicode-1.0.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.encode_unicode-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__equivalent-1.0.2\",\n sha256 = \"877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/equivalent/1.0.2/download\"],\n strip_prefix = \"equivalent-1.0.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.equivalent-1.0.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__errno-0.3.14\",\n sha256 = \"39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/errno/0.3.14/download\"],\n strip_prefix = \"errno-0.3.14\",\n build_file = Label(\"@crates_std//crates_std:BUILD.errno-0.3.14.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__fastrand-2.5.0\",\n sha256 = \"da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/fastrand/2.5.0/download\"],\n strip_prefix = \"fastrand-2.5.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.fastrand-2.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__find-msvc-tools-0.1.9\",\n sha256 = \"5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/find-msvc-tools/0.1.9/download\"],\n strip_prefix = \"find-msvc-tools-0.1.9\",\n build_file = Label(\"@crates_std//crates_std:BUILD.find-msvc-tools-0.1.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__fixedbitset-0.5.7\",\n sha256 = \"1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/fixedbitset/0.5.7/download\"],\n strip_prefix = \"fixedbitset-0.5.7\",\n build_file = Label(\"@crates_std//crates_std:BUILD.fixedbitset-0.5.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__flate2-1.1.9\",\n sha256 = \"843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/flate2/1.1.9/download\"],\n strip_prefix = \"flate2-1.1.9\",\n build_file = Label(\"@crates_std//crates_std:BUILD.flate2-1.1.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__fnv-1.0.7\",\n sha256 = \"3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/fnv/1.0.7/download\"],\n strip_prefix = \"fnv-1.0.7\",\n build_file = Label(\"@crates_std//crates_std:BUILD.fnv-1.0.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__foldhash-0.1.5\",\n sha256 = \"d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/foldhash/0.1.5/download\"],\n strip_prefix = \"foldhash-0.1.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.foldhash-0.1.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__futures-0.3.33\",\n sha256 = \"a88cf1f829d945f548cf8fec32c61b1f202b6d93b45848602fc02af4b12ad218\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures/0.3.33/download\"],\n strip_prefix = \"futures-0.3.33\",\n build_file = Label(\"@crates_std//crates_std:BUILD.futures-0.3.33.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__futures-channel-0.3.33\",\n sha256 = \"262590f4fe6afeb0bc83be1daa64e52657fe185690a958af7f3ad0e92085c5ae\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-channel/0.3.33/download\"],\n strip_prefix = \"futures-channel-0.3.33\",\n build_file = Label(\"@crates_std//crates_std:BUILD.futures-channel-0.3.33.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__futures-core-0.3.33\",\n sha256 = \"2cd50c473c80f6d7c3670a752354b8e569b1a7cbfdc0419ec88e5edad85e0dc7\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-core/0.3.33/download\"],\n strip_prefix = \"futures-core-0.3.33\",\n build_file = Label(\"@crates_std//crates_std:BUILD.futures-core-0.3.33.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__futures-executor-0.3.33\",\n sha256 = \"6754879cc9f2c66f88c6e5c35344bb0bdb0708b0352b1201815667c7eabc7458\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-executor/0.3.33/download\"],\n strip_prefix = \"futures-executor-0.3.33\",\n build_file = Label(\"@crates_std//crates_std:BUILD.futures-executor-0.3.33.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__futures-io-0.3.33\",\n sha256 = \"4577ecaa3c4f96589d473f679a71b596316f6641bc350038b962a5daf0085d7a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-io/0.3.33/download\"],\n strip_prefix = \"futures-io-0.3.33\",\n build_file = Label(\"@crates_std//crates_std:BUILD.futures-io-0.3.33.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__futures-macro-0.3.33\",\n sha256 = \"2d6d3cde68c518367be28956066ddfef33813991b77a55005a69dae04bf3b10b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-macro/0.3.33/download\"],\n strip_prefix = \"futures-macro-0.3.33\",\n build_file = Label(\"@crates_std//crates_std:BUILD.futures-macro-0.3.33.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__futures-sink-0.3.33\",\n sha256 = \"e34418ac499d6305c2fb5ad0ed2f6ac998c5f8ca209b4510f7f94242c647e307\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-sink/0.3.33/download\"],\n strip_prefix = \"futures-sink-0.3.33\",\n build_file = Label(\"@crates_std//crates_std:BUILD.futures-sink-0.3.33.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__futures-task-0.3.33\",\n sha256 = \"b231ed28831efb4a61a08580c4bc233ec56bc009f4cd8f52da2c3cb97df0c109\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-task/0.3.33/download\"],\n strip_prefix = \"futures-task-0.3.33\",\n build_file = Label(\"@crates_std//crates_std:BUILD.futures-task-0.3.33.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__futures-util-0.3.33\",\n sha256 = \"a77a90a256fce34da66415271e30f94ee91c57b04b8a2c042d9cf3220179deaa\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-util/0.3.33/download\"],\n strip_prefix = \"futures-util-0.3.33\",\n build_file = Label(\"@crates_std//crates_std:BUILD.futures-util-0.3.33.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__generic-array-0.14.7\",\n sha256 = \"85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/generic-array/0.14.7/download\"],\n strip_prefix = \"generic-array-0.14.7\",\n build_file = Label(\"@crates_std//crates_std:BUILD.generic-array-0.14.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__hashbrown-0.15.5\",\n sha256 = \"9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hashbrown/0.15.5/download\"],\n strip_prefix = \"hashbrown-0.15.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.hashbrown-0.15.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__hashbrown-0.17.1\",\n sha256 = \"ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hashbrown/0.17.1/download\"],\n strip_prefix = \"hashbrown-0.17.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.hashbrown-0.17.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__hashlink-0.10.0\",\n sha256 = \"7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hashlink/0.10.0/download\"],\n strip_prefix = \"hashlink-0.10.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.hashlink-0.10.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__heck-0.5.0\",\n sha256 = \"2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/heck/0.5.0/download\"],\n strip_prefix = \"heck-0.5.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.heck-0.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__hex-0.4.3\",\n sha256 = \"7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hex/0.4.3/download\"],\n strip_prefix = \"hex-0.4.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.hex-0.4.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__humansize-2.1.3\",\n sha256 = \"6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/humansize/2.1.3/download\"],\n strip_prefix = \"humansize-2.1.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.humansize-2.1.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__indexmap-2.14.0\",\n sha256 = \"d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/indexmap/2.14.0/download\"],\n strip_prefix = \"indexmap-2.14.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.indexmap-2.14.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__indicatif-0.18.6\",\n sha256 = \"9433806cd6b4ec1aba79c021c7e4c58fb4c3b9977c085062e611ac929998fb0c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/indicatif/0.18.6/download\"],\n strip_prefix = \"indicatif-0.18.6\",\n build_file = Label(\"@crates_std//crates_std:BUILD.indicatif-0.18.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__is_terminal_polyfill-1.70.2\",\n sha256 = \"a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/is_terminal_polyfill/1.70.2/download\"],\n strip_prefix = \"is_terminal_polyfill-1.70.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.is_terminal_polyfill-1.70.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__itertools-0.11.0\",\n sha256 = \"b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/itertools/0.11.0/download\"],\n strip_prefix = \"itertools-0.11.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.itertools-0.11.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__itertools-0.14.0\",\n sha256 = \"2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/itertools/0.14.0/download\"],\n strip_prefix = \"itertools-0.14.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.itertools-0.14.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__itoa-1.0.18\",\n sha256 = \"8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/itoa/1.0.18/download\"],\n strip_prefix = \"itoa-1.0.18\",\n build_file = Label(\"@crates_std//crates_std:BUILD.itoa-1.0.18.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__js-sys-0.3.103\",\n sha256 = \"53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/js-sys/0.3.103/download\"],\n strip_prefix = \"js-sys-0.3.103\",\n build_file = Label(\"@crates_std//crates_std:BUILD.js-sys-0.3.103.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__libc-0.2.189\",\n sha256 = \"3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/libc/0.2.189/download\"],\n strip_prefix = \"libc-0.2.189\",\n build_file = Label(\"@crates_std//crates_std:BUILD.libc-0.2.189.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__libm-0.2.16\",\n sha256 = \"b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/libm/0.2.16/download\"],\n strip_prefix = \"libm-0.2.16\",\n build_file = Label(\"@crates_std//crates_std:BUILD.libm-0.2.16.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__linux-raw-sys-0.12.1\",\n sha256 = \"32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/linux-raw-sys/0.12.1/download\"],\n strip_prefix = \"linux-raw-sys-0.12.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.linux-raw-sys-0.12.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__lock_api-0.4.14\",\n sha256 = \"224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/lock_api/0.4.14/download\"],\n strip_prefix = \"lock_api-0.4.14\",\n build_file = Label(\"@crates_std//crates_std:BUILD.lock_api-0.4.14.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__log-0.4.33\",\n sha256 = \"0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/log/0.4.33/download\"],\n strip_prefix = \"log-0.4.33\",\n build_file = Label(\"@crates_std//crates_std:BUILD.log-0.4.33.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__logos-0.16.1\",\n sha256 = \"eb2c55a318a87600ea870ff8c2012148b44bf18b74fad48d0f835c38c7d07c5f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/logos/0.16.1/download\"],\n strip_prefix = \"logos-0.16.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.logos-0.16.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__logos-codegen-0.16.1\",\n sha256 = \"58b3ffaa284e1350d017a57d04ada118c4583cf260c8fb01e0fe28a2e9cf8970\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/logos-codegen/0.16.1/download\"],\n strip_prefix = \"logos-codegen-0.16.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.logos-codegen-0.16.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__logos-derive-0.16.1\",\n sha256 = \"52d3a9855747c17eaf4383823f135220716ab49bea5fbea7dd42cc9a92f8aa31\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/logos-derive/0.16.1/download\"],\n strip_prefix = \"logos-derive-0.16.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.logos-derive-0.16.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__memchr-2.8.3\",\n sha256 = \"cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/memchr/2.8.3/download\"],\n strip_prefix = \"memchr-2.8.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.memchr-2.8.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__memo-map-0.3.3\",\n sha256 = \"38d1115007560874e373613744c6fba374c17688327a71c1476d1a5954cc857b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/memo-map/0.3.3/download\"],\n strip_prefix = \"memo-map-0.3.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.memo-map-0.3.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__mime-0.3.17\",\n sha256 = \"6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/mime/0.3.17/download\"],\n strip_prefix = \"mime-0.3.17\",\n build_file = Label(\"@crates_std//crates_std:BUILD.mime-0.3.17.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__mime_guess-2.0.5\",\n sha256 = \"f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/mime_guess/2.0.5/download\"],\n strip_prefix = \"mime_guess-2.0.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.mime_guess-2.0.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__minijinja-2.21.0\",\n sha256 = \"cb3d648e68cea56d9858d535ee28f9538404e2dd8cb08ed0bd05dca379477f39\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/minijinja/2.21.0/download\"],\n strip_prefix = \"minijinja-2.21.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.minijinja-2.21.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__minimal-lexical-0.2.1\",\n sha256 = \"68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/minimal-lexical/0.2.1/download\"],\n strip_prefix = \"minimal-lexical-0.2.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.minimal-lexical-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__miniz_oxide-0.8.9\",\n sha256 = \"1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/miniz_oxide/0.8.9/download\"],\n strip_prefix = \"miniz_oxide-0.8.9\",\n build_file = Label(\"@crates_std//crates_std:BUILD.miniz_oxide-0.8.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__mio-1.2.2\",\n sha256 = \"30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/mio/1.2.2/download\"],\n strip_prefix = \"mio-1.2.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.mio-1.2.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__multimap-0.10.1\",\n sha256 = \"1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/multimap/0.10.1/download\"],\n strip_prefix = \"multimap-0.10.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.multimap-0.10.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__nix-0.29.0\",\n sha256 = \"71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/nix/0.29.0/download\"],\n strip_prefix = \"nix-0.29.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.nix-0.29.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__nom-7.1.3\",\n sha256 = \"d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/nom/7.1.3/download\"],\n strip_prefix = \"nom-7.1.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.nom-7.1.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__num-traits-0.2.19\",\n sha256 = \"071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/num-traits/0.2.19/download\"],\n strip_prefix = \"num-traits-0.2.19\",\n build_file = Label(\"@crates_std//crates_std:BUILD.num-traits-0.2.19.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__object-0.36.7\",\n sha256 = \"62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/object/0.36.7/download\"],\n strip_prefix = \"object-0.36.7\",\n build_file = Label(\"@crates_std//crates_std:BUILD.object-0.36.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__object-0.37.3\",\n sha256 = \"ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/object/0.37.3/download\"],\n strip_prefix = \"object-0.37.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.object-0.37.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__once_cell-1.21.4\",\n sha256 = \"9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/once_cell/1.21.4/download\"],\n strip_prefix = \"once_cell-1.21.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.once_cell-1.21.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__once_cell_polyfill-1.70.2\",\n sha256 = \"384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/once_cell_polyfill/1.70.2/download\"],\n strip_prefix = \"once_cell_polyfill-1.70.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.once_cell_polyfill-1.70.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__parking_lot-0.12.5\",\n sha256 = \"93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/parking_lot/0.12.5/download\"],\n strip_prefix = \"parking_lot-0.12.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.parking_lot-0.12.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__parking_lot_core-0.9.12\",\n sha256 = \"2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/parking_lot_core/0.9.12/download\"],\n strip_prefix = \"parking_lot_core-0.9.12\",\n build_file = Label(\"@crates_std//crates_std:BUILD.parking_lot_core-0.9.12.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__paste-1.0.15\",\n sha256 = \"57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/paste/1.0.15/download\"],\n strip_prefix = \"paste-1.0.15\",\n build_file = Label(\"@crates_std//crates_std:BUILD.paste-1.0.15.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__percent-encoding-2.3.2\",\n sha256 = \"9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/percent-encoding/2.3.2/download\"],\n strip_prefix = \"percent-encoding-2.3.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.percent-encoding-2.3.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__pest-2.8.8\",\n sha256 = \"7df728be843c7070fab6ab7c328c4e9e9d78e23bf749c0669c86ee7ebfa050a2\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pest/2.8.8/download\"],\n strip_prefix = \"pest-2.8.8\",\n build_file = Label(\"@crates_std//crates_std:BUILD.pest-2.8.8.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__pest_derive-2.8.8\",\n sha256 = \"9e2dd6fc3b26b3462ee188aac870f5a41d398f1cd5e2408d16531bd71c9591fd\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pest_derive/2.8.8/download\"],\n strip_prefix = \"pest_derive-2.8.8\",\n build_file = Label(\"@crates_std//crates_std:BUILD.pest_derive-2.8.8.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__pest_generator-2.8.8\",\n sha256 = \"6a7a9205cfb6f596a9e8b689c0a15f9ceb7a1aafae7aaf788150ac65b29975b6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pest_generator/2.8.8/download\"],\n strip_prefix = \"pest_generator-2.8.8\",\n build_file = Label(\"@crates_std//crates_std:BUILD.pest_generator-2.8.8.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__pest_meta-2.8.8\",\n sha256 = \"85abd351c0de1e8384fc791a0737111a350394937e92b956b743dac12429f57c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pest_meta/2.8.8/download\"],\n strip_prefix = \"pest_meta-2.8.8\",\n build_file = Label(\"@crates_std//crates_std:BUILD.pest_meta-2.8.8.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__petgraph-0.8.3\",\n sha256 = \"8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/petgraph/0.8.3/download\"],\n strip_prefix = \"petgraph-0.8.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.petgraph-0.8.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__pin-project-lite-0.2.17\",\n sha256 = \"a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pin-project-lite/0.2.17/download\"],\n strip_prefix = \"pin-project-lite-0.2.17\",\n build_file = Label(\"@crates_std//crates_std:BUILD.pin-project-lite-0.2.17.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__portable-atomic-1.14.0\",\n sha256 = \"3d20d5497ef88037a52ff98267d066e7f11fcc5e99bbfbd58a42336193aacec3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/portable-atomic/1.14.0/download\"],\n strip_prefix = \"portable-atomic-1.14.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.portable-atomic-1.14.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__proc-macro2-1.0.107\",\n sha256 = \"985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/proc-macro2/1.0.107/download\"],\n strip_prefix = \"proc-macro2-1.0.107\",\n build_file = Label(\"@crates_std//crates_std:BUILD.proc-macro2-1.0.107.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__prost-0.14.4\",\n sha256 = \"528ac67416ff8646872a3c02cad9cc4ee5dc9f9540c9b10771855c95cb2e5ae1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/prost/0.14.4/download\"],\n strip_prefix = \"prost-0.14.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.prost-0.14.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__prost-build-0.14.4\",\n sha256 = \"03da047801ff44bb6a4d407d4860c05fd70bb81714e6b2f3812603d5b145b042\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/prost-build/0.14.4/download\"],\n strip_prefix = \"prost-build-0.14.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.prost-build-0.14.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__prost-derive-0.14.4\",\n sha256 = \"b570b25f7617e43d59005d0990ccb79e950a423952cea19671b7a876da390adf\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/prost-derive/0.14.4/download\"],\n strip_prefix = \"prost-derive-0.14.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.prost-derive-0.14.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__prost-reflect-0.16.5\",\n sha256 = \"01b80ea363c31af2de2b92e3c07ed1156628f7838c4afb4df75ee78a37fedbd1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/prost-reflect/0.16.5/download\"],\n strip_prefix = \"prost-reflect-0.16.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.prost-reflect-0.16.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__prost-types-0.14.4\",\n sha256 = \"f94967dc7688f3054c7fac87473ffae4cc4c3904800e2d9f5b857246d8963b0a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/prost-types/0.14.4/download\"],\n strip_prefix = \"prost-types-0.14.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.prost-types-0.14.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__protoc-gen-prost-0.5.0\",\n sha256 = \"4018e7b5e3a213d241d79a0ef43a442a17dc23dcdd5b81b0c42b2549197897fd\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/protoc-gen-prost/0.5.0/download\"],\n strip_prefix = \"protoc-gen-prost-0.5.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.protoc-gen-prost-0.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__psm-0.1.31\",\n sha256 = \"645dbe486e346d9b5de3ef16ede18c26e6c70ad97418f4874b8b1889d6e761ea\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/psm/0.1.31/download\"],\n strip_prefix = \"psm-0.1.31\",\n build_file = Label(\"@crates_std//crates_std:BUILD.psm-0.1.31.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__quote-1.0.47\",\n sha256 = \"1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/quote/1.0.47/download\"],\n strip_prefix = \"quote-1.0.47\",\n build_file = Label(\"@crates_std//crates_std:BUILD.quote-1.0.47.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__redox_syscall-0.5.18\",\n sha256 = \"ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/redox_syscall/0.5.18/download\"],\n strip_prefix = \"redox_syscall-0.5.18\",\n build_file = Label(\"@crates_std//crates_std:BUILD.redox_syscall-0.5.18.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__regex-1.13.1\",\n sha256 = \"f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/regex/1.13.1/download\"],\n strip_prefix = \"regex-1.13.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.regex-1.13.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__regex-automata-0.3.9\",\n sha256 = \"59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/regex-automata/0.3.9/download\"],\n strip_prefix = \"regex-automata-0.3.9\",\n build_file = Label(\"@crates_std//crates_std:BUILD.regex-automata-0.3.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__regex-automata-0.4.16\",\n sha256 = \"8fcfdb36bda0c880c5931cdc7a2bcdc8ba4556847b9d912bca70bc94708711ad\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/regex-automata/0.4.16/download\"],\n strip_prefix = \"regex-automata-0.4.16\",\n build_file = Label(\"@crates_std//crates_std:BUILD.regex-automata-0.4.16.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__regex-syntax-0.7.5\",\n sha256 = \"dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/regex-syntax/0.7.5/download\"],\n strip_prefix = \"regex-syntax-0.7.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.regex-syntax-0.7.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__regex-syntax-0.8.11\",\n sha256 = \"d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/regex-syntax/0.8.11/download\"],\n strip_prefix = \"regex-syntax-0.8.11\",\n build_file = Label(\"@crates_std//crates_std:BUILD.regex-syntax-0.8.11.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__rustc-demangle-0.1.28\",\n sha256 = \"b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rustc-demangle/0.1.28/download\"],\n strip_prefix = \"rustc-demangle-0.1.28\",\n build_file = Label(\"@crates_std//crates_std:BUILD.rustc-demangle-0.1.28.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__rustix-1.1.4\",\n sha256 = \"b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rustix/1.1.4/download\"],\n strip_prefix = \"rustix-1.1.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.rustix-1.1.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__rustversion-1.0.23\",\n sha256 = \"cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rustversion/1.0.23/download\"],\n strip_prefix = \"rustversion-1.0.23\",\n build_file = Label(\"@crates_std//crates_std:BUILD.rustversion-1.0.23.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__ruzstd-0.7.3\",\n sha256 = \"fad02996bfc73da3e301efe90b1837be9ed8f4a462b6ed410aa35d00381de89f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ruzstd/0.7.3/download\"],\n strip_prefix = \"ruzstd-0.7.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.ruzstd-0.7.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__scopeguard-1.2.0\",\n sha256 = \"94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/scopeguard/1.2.0/download\"],\n strip_prefix = \"scopeguard-1.2.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.scopeguard-1.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__serde-1.0.229\",\n sha256 = \"4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde/1.0.229/download\"],\n strip_prefix = \"serde-1.0.229\",\n build_file = Label(\"@crates_std//crates_std:BUILD.serde-1.0.229.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__serde_core-1.0.229\",\n sha256 = \"67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde_core/1.0.229/download\"],\n strip_prefix = \"serde_core-1.0.229\",\n build_file = Label(\"@crates_std//crates_std:BUILD.serde_core-1.0.229.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__serde_derive-1.0.229\",\n sha256 = \"e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde_derive/1.0.229/download\"],\n strip_prefix = \"serde_derive-1.0.229\",\n build_file = Label(\"@crates_std//crates_std:BUILD.serde_derive-1.0.229.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__serde_json-1.0.151\",\n sha256 = \"c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde_json/1.0.151/download\"],\n strip_prefix = \"serde_json-1.0.151\",\n build_file = Label(\"@crates_std//crates_std:BUILD.serde_json-1.0.151.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__serde_json5-0.2.1\",\n sha256 = \"5d34d03f54462862f2a42918391c9526337f53171eaa4d8894562be7f252edd3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde_json5/0.2.1/download\"],\n strip_prefix = \"serde_json5-0.2.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.serde_json5-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__serde_spanned-0.6.9\",\n sha256 = \"bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde_spanned/0.6.9/download\"],\n strip_prefix = \"serde_spanned-0.6.9\",\n build_file = Label(\"@crates_std//crates_std:BUILD.serde_spanned-0.6.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__sha2-0.10.9\",\n sha256 = \"a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/sha2/0.10.9/download\"],\n strip_prefix = \"sha2-0.10.9\",\n build_file = Label(\"@crates_std//crates_std:BUILD.sha2-0.10.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__shlex-2.0.1\",\n sha256 = \"f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/shlex/2.0.1/download\"],\n strip_prefix = \"shlex-2.0.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.shlex-2.0.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__signal-hook-registry-1.4.8\",\n sha256 = \"c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/signal-hook-registry/1.4.8/download\"],\n strip_prefix = \"signal-hook-registry-1.4.8\",\n build_file = Label(\"@crates_std//crates_std:BUILD.signal-hook-registry-1.4.8.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__simd-adler32-0.3.10\",\n sha256 = \"3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/simd-adler32/0.3.10/download\"],\n strip_prefix = \"simd-adler32-0.3.10\",\n build_file = Label(\"@crates_std//crates_std:BUILD.simd-adler32-0.3.10.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__slab-0.4.12\",\n sha256 = \"0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/slab/0.4.12/download\"],\n strip_prefix = \"slab-0.4.12\",\n build_file = Label(\"@crates_std//crates_std:BUILD.slab-0.4.12.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__smallvec-1.15.2\",\n sha256 = \"8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/smallvec/1.15.2/download\"],\n strip_prefix = \"smallvec-1.15.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.smallvec-1.15.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__smawk-0.3.3\",\n sha256 = \"e8e2fb0f499abb4d162f2bedad68f5ef91a1682b5a03596ddb67efd37768d100\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/smawk/0.3.3/download\"],\n strip_prefix = \"smawk-0.3.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.smawk-0.3.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__socket2-0.6.5\",\n sha256 = \"c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/socket2/0.6.5/download\"],\n strip_prefix = \"socket2-0.6.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.socket2-0.6.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__stacker-0.1.24\",\n sha256 = \"640c8cdd92b6b12f5bcb1803ca3bbf5ab96e5e6b6b96b9ab77dabe9e880b3190\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/stacker/0.1.24/download\"],\n strip_prefix = \"stacker-0.1.24\",\n build_file = Label(\"@crates_std//crates_std:BUILD.stacker-0.1.24.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__static_assertions-1.1.0\",\n sha256 = \"a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/static_assertions/1.1.0/download\"],\n strip_prefix = \"static_assertions-1.1.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.static_assertions-1.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__strsim-0.11.1\",\n sha256 = \"7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/strsim/0.11.1/download\"],\n strip_prefix = \"strsim-0.11.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.strsim-0.11.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__syn-2.0.119\",\n sha256 = \"872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/syn/2.0.119/download\"],\n strip_prefix = \"syn-2.0.119\",\n build_file = Label(\"@crates_std//crates_std:BUILD.syn-2.0.119.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__syn-3.0.3\",\n sha256 = \"53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/syn/3.0.3/download\"],\n strip_prefix = \"syn-3.0.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.syn-3.0.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__tempfile-3.27.0\",\n sha256 = \"32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/tempfile/3.27.0/download\"],\n strip_prefix = \"tempfile-3.27.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.tempfile-3.27.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__textwrap-0.16.2\",\n sha256 = \"c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/textwrap/0.16.2/download\"],\n strip_prefix = \"textwrap-0.16.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.textwrap-0.16.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__thiserror-2.0.19\",\n sha256 = \"09a43598840e33d5b0331f38c5e30d13bb11c11210a4b58f0d9b18a5a5eefcd9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/thiserror/2.0.19/download\"],\n strip_prefix = \"thiserror-2.0.19\",\n build_file = Label(\"@crates_std//crates_std:BUILD.thiserror-2.0.19.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__thiserror-impl-2.0.19\",\n sha256 = \"43cbfe0cf76104d42a574802844187e84a305e531ed54455f11fbde0f10541cd\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/thiserror-impl/2.0.19/download\"],\n strip_prefix = \"thiserror-impl-2.0.19\",\n build_file = Label(\"@crates_std//crates_std:BUILD.thiserror-impl-2.0.19.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__tokio-1.53.1\",\n sha256 = \"202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/tokio/1.53.1/download\"],\n strip_prefix = \"tokio-1.53.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.tokio-1.53.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__tokio-macros-2.7.2\",\n sha256 = \"78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/tokio-macros/2.7.2/download\"],\n strip_prefix = \"tokio-macros-2.7.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.tokio-macros-2.7.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__tokio-util-0.7.19\",\n sha256 = \"494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/tokio-util/0.7.19/download\"],\n strip_prefix = \"tokio-util-0.7.19\",\n build_file = Label(\"@crates_std//crates_std:BUILD.tokio-util-0.7.19.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__toml-0.8.23\",\n sha256 = \"dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/toml/0.8.23/download\"],\n strip_prefix = \"toml-0.8.23\",\n build_file = Label(\"@crates_std//crates_std:BUILD.toml-0.8.23.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__toml_datetime-0.6.11\",\n sha256 = \"22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/toml_datetime/0.6.11/download\"],\n strip_prefix = \"toml_datetime-0.6.11\",\n build_file = Label(\"@crates_std//crates_std:BUILD.toml_datetime-0.6.11.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__toml_edit-0.22.27\",\n sha256 = \"41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/toml_edit/0.22.27/download\"],\n strip_prefix = \"toml_edit-0.22.27\",\n build_file = Label(\"@crates_std//crates_std:BUILD.toml_edit-0.22.27.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__toml_write-0.1.2\",\n sha256 = \"5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/toml_write/0.1.2/download\"],\n strip_prefix = \"toml_write-0.1.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.toml_write-0.1.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__twox-hash-1.6.3\",\n sha256 = \"97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/twox-hash/1.6.3/download\"],\n strip_prefix = \"twox-hash-1.6.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.twox-hash-1.6.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__typenum-1.20.1\",\n sha256 = \"b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/typenum/1.20.1/download\"],\n strip_prefix = \"typenum-1.20.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.typenum-1.20.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__ucd-trie-0.1.7\",\n sha256 = \"2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ucd-trie/0.1.7/download\"],\n strip_prefix = \"ucd-trie-0.1.7\",\n build_file = Label(\"@crates_std//crates_std:BUILD.ucd-trie-0.1.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__unicase-2.9.0\",\n sha256 = \"dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicase/2.9.0/download\"],\n strip_prefix = \"unicase-2.9.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.unicase-2.9.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__unicode-ident-1.0.24\",\n sha256 = \"e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicode-ident/1.0.24/download\"],\n strip_prefix = \"unicode-ident-1.0.24\",\n build_file = Label(\"@crates_std//crates_std:BUILD.unicode-ident-1.0.24.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__unicode-linebreak-0.1.5\",\n sha256 = \"3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicode-linebreak/0.1.5/download\"],\n strip_prefix = \"unicode-linebreak-0.1.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.unicode-linebreak-0.1.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__unicode-segmentation-1.13.3\",\n sha256 = \"c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicode-segmentation/1.13.3/download\"],\n strip_prefix = \"unicode-segmentation-1.13.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.unicode-segmentation-1.13.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__unicode-width-0.1.14\",\n sha256 = \"7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicode-width/0.1.14/download\"],\n strip_prefix = \"unicode-width-0.1.14\",\n build_file = Label(\"@crates_std//crates_std:BUILD.unicode-width-0.1.14.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__unicode-width-0.2.2\",\n sha256 = \"b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicode-width/0.2.2/download\"],\n strip_prefix = \"unicode-width-0.2.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.unicode-width-0.2.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__unit-prefix-0.5.2\",\n sha256 = \"81e544489bf3d8ef66c953931f56617f423cd4b5494be343d9b9d3dda037b9a3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unit-prefix/0.5.2/download\"],\n strip_prefix = \"unit-prefix-0.5.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.unit-prefix-0.5.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__utf8parse-0.2.2\",\n sha256 = \"06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/utf8parse/0.2.2/download\"],\n strip_prefix = \"utf8parse-0.2.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.utf8parse-0.2.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__version_check-0.9.5\",\n sha256 = \"0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/version_check/0.9.5/download\"],\n strip_prefix = \"version_check-0.9.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.version_check-0.9.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__wasi-0.11.1-wasi-snapshot-preview1\",\n sha256 = \"ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/wasi/0.11.1+wasi-snapshot-preview1/download\"],\n strip_prefix = \"wasi-0.11.1+wasi-snapshot-preview1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.wasi-0.11.1+wasi-snapshot-preview1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__wasm-bindgen-0.2.126\",\n sha256 = \"4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/wasm-bindgen/0.2.126/download\"],\n strip_prefix = \"wasm-bindgen-0.2.126\",\n build_file = Label(\"@crates_std//crates_std:BUILD.wasm-bindgen-0.2.126.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__wasm-bindgen-macro-0.2.126\",\n sha256 = \"167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/wasm-bindgen-macro/0.2.126/download\"],\n strip_prefix = \"wasm-bindgen-macro-0.2.126\",\n build_file = Label(\"@crates_std//crates_std:BUILD.wasm-bindgen-macro-0.2.126.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__wasm-bindgen-macro-support-0.2.126\",\n sha256 = \"f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/wasm-bindgen-macro-support/0.2.126/download\"],\n strip_prefix = \"wasm-bindgen-macro-support-0.2.126\",\n build_file = Label(\"@crates_std//crates_std:BUILD.wasm-bindgen-macro-support-0.2.126.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__wasm-bindgen-shared-0.2.126\",\n sha256 = \"dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/wasm-bindgen-shared/0.2.126/download\"],\n strip_prefix = \"wasm-bindgen-shared-0.2.126\",\n build_file = Label(\"@crates_std//crates_std:BUILD.wasm-bindgen-shared-0.2.126.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__web-time-1.1.0\",\n sha256 = \"5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/web-time/1.1.0/download\"],\n strip_prefix = \"web-time-1.1.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.web-time-1.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__windows-link-0.2.1\",\n sha256 = \"f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows-link/0.2.1/download\"],\n strip_prefix = \"windows-link-0.2.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.windows-link-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__windows-sys-0.59.0\",\n sha256 = \"1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows-sys/0.59.0/download\"],\n strip_prefix = \"windows-sys-0.59.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.windows-sys-0.59.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__windows-sys-0.61.2\",\n sha256 = \"ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows-sys/0.61.2/download\"],\n strip_prefix = \"windows-sys-0.61.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.windows-sys-0.61.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__windows-targets-0.52.6\",\n sha256 = \"9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows-targets/0.52.6/download\"],\n strip_prefix = \"windows-targets-0.52.6\",\n build_file = Label(\"@crates_std//crates_std:BUILD.windows-targets-0.52.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__windows_aarch64_gnullvm-0.52.6\",\n sha256 = \"32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows_aarch64_gnullvm/0.52.6/download\"],\n strip_prefix = \"windows_aarch64_gnullvm-0.52.6\",\n build_file = Label(\"@crates_std//crates_std:BUILD.windows_aarch64_gnullvm-0.52.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__windows_aarch64_msvc-0.52.6\",\n sha256 = \"09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows_aarch64_msvc/0.52.6/download\"],\n strip_prefix = \"windows_aarch64_msvc-0.52.6\",\n build_file = Label(\"@crates_std//crates_std:BUILD.windows_aarch64_msvc-0.52.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__windows_i686_gnu-0.52.6\",\n sha256 = \"8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows_i686_gnu/0.52.6/download\"],\n strip_prefix = \"windows_i686_gnu-0.52.6\",\n build_file = Label(\"@crates_std//crates_std:BUILD.windows_i686_gnu-0.52.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__windows_i686_gnullvm-0.52.6\",\n sha256 = \"0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows_i686_gnullvm/0.52.6/download\"],\n strip_prefix = \"windows_i686_gnullvm-0.52.6\",\n build_file = Label(\"@crates_std//crates_std:BUILD.windows_i686_gnullvm-0.52.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__windows_i686_msvc-0.52.6\",\n sha256 = \"240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows_i686_msvc/0.52.6/download\"],\n strip_prefix = \"windows_i686_msvc-0.52.6\",\n build_file = Label(\"@crates_std//crates_std:BUILD.windows_i686_msvc-0.52.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__windows_x86_64_gnu-0.52.6\",\n sha256 = \"147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows_x86_64_gnu/0.52.6/download\"],\n strip_prefix = \"windows_x86_64_gnu-0.52.6\",\n build_file = Label(\"@crates_std//crates_std:BUILD.windows_x86_64_gnu-0.52.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__windows_x86_64_gnullvm-0.52.6\",\n sha256 = \"24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows_x86_64_gnullvm/0.52.6/download\"],\n strip_prefix = \"windows_x86_64_gnullvm-0.52.6\",\n build_file = Label(\"@crates_std//crates_std:BUILD.windows_x86_64_gnullvm-0.52.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__windows_x86_64_msvc-0.52.6\",\n sha256 = \"589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows_x86_64_msvc/0.52.6/download\"],\n strip_prefix = \"windows_x86_64_msvc-0.52.6\",\n build_file = Label(\"@crates_std//crates_std:BUILD.windows_x86_64_msvc-0.52.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__winnow-0.7.15\",\n sha256 = \"df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/winnow/0.7.15/download\"],\n strip_prefix = \"winnow-0.7.15\",\n build_file = Label(\"@crates_std//crates_std:BUILD.winnow-0.7.15.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__yansi-0.5.1\",\n sha256 = \"09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/yansi/0.5.1/download\"],\n strip_prefix = \"yansi-0.5.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.yansi-0.5.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zerocopy-0.8.55\",\n sha256 = \"b5a105cd7b140f6eeec8acff2ea38135d3cab283ada58540f629fe51e46696eb\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zerocopy/0.8.55/download\"],\n strip_prefix = \"zerocopy-0.8.55\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zerocopy-0.8.55.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zerocopy-derive-0.8.55\",\n sha256 = \"0fe976fb70c78cd64cccfe3a6fc142244e8a77b70959b30faf9d0ac37ee228eb\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zerocopy-derive/0.8.55/download\"],\n strip_prefix = \"zerocopy-derive-0.8.55\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zerocopy-derive-0.8.55.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zeroize-1.9.0\",\n sha256 = \"e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zeroize/1.9.0/download\"],\n strip_prefix = \"zeroize-1.9.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zeroize-1.9.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zeroize_derive-1.5.0\",\n sha256 = \"3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zeroize_derive/1.5.0/download\"],\n strip_prefix = \"zeroize_derive-1.5.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zeroize_derive-1.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zmij-1.0.23\",\n sha256 = \"29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zmij/1.0.23/download\"],\n strip_prefix = \"zmij-1.0.23\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zmij-1.0.23.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zngur-0.10.0\",\n sha256 = \"7fc912d12934b4d04aabc52c14db6fc88ae8aa5a47902f27e8759c2de254723f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zngur/0.10.0/download\"],\n strip_prefix = \"zngur-0.10.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zngur-0.10.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zngur-def-0.10.0\",\n sha256 = \"8f27e49a62db537cea43a6c122ded7eda99c4ac0ca1d7cfd74f2bf6a6c88712d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zngur-def/0.10.0/download\"],\n strip_prefix = \"zngur-def-0.10.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zngur-def-0.10.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zngur-generator-0.10.0\",\n sha256 = \"5ffad8c6994c477023aba7613bdf17c470003bbd191846d3096e84ffecf86d4c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zngur-generator/0.10.0/download\"],\n strip_prefix = \"zngur-generator-0.10.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zngur-generator-0.10.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zngur-lib-0.10.0\",\n sha256 = \"274b03b81aaacc390756142ab5ffceb29a1c54817af1dfb265666a31b4cfb116\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zngur-lib/0.10.0/download\"],\n strip_prefix = \"zngur-lib-0.10.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zngur-lib-0.10.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zngur-parser-0.10.0\",\n sha256 = \"8d66c1b85ca6eab9576df5de31758cb1f9046b4ce47b25f45dabcb0fc7ef8789\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zngur-parser/0.10.0/download\"],\n strip_prefix = \"zngur-parser-0.10.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zngur-parser-0.10.0.bazel\"),\n )\n\n return [\n struct(repo=\"crates_std__anyhow-1.0.104\", is_dev_dep = False),\n struct(repo=\"crates_std__bitfield-struct-0.12.1\", is_dev_dep = False),\n struct(repo=\"crates_std__bitflags-2.13.1\", is_dev_dep = False),\n struct(repo=\"crates_std__byteorder-1.5.0\", is_dev_dep = False),\n struct(repo=\"crates_std__clap-4.6.4\", is_dev_dep = False),\n struct(repo=\"crates_std__cliclack-0.3.8\", is_dev_dep = False),\n struct(repo=\"crates_std__futures-0.3.33\", is_dev_dep = False),\n struct(repo=\"crates_std__hashlink-0.10.0\", is_dev_dep = False),\n struct(repo=\"crates_std__hex-0.4.3\", is_dev_dep = False),\n struct(repo=\"crates_std__libc-0.2.189\", is_dev_dep = False),\n struct(repo=\"crates_std__minijinja-2.21.0\", is_dev_dep = False),\n struct(repo=\"crates_std__nix-0.29.0\", is_dev_dep = False),\n struct(repo=\"crates_std__nom-7.1.3\", is_dev_dep = False),\n struct(repo=\"crates_std__object-0.36.7\", is_dev_dep = False),\n struct(repo=\"crates_std__paste-1.0.15\", is_dev_dep = False),\n struct(repo=\"crates_std__proc-macro2-1.0.107\", is_dev_dep = False),\n struct(repo=\"crates_std__prost-0.14.4\", is_dev_dep = False),\n struct(repo=\"crates_std__prost-reflect-0.16.5\", is_dev_dep = False),\n struct(repo=\"crates_std__prost-types-0.14.4\", is_dev_dep = False),\n struct(repo=\"crates_std__protoc-gen-prost-0.5.0\", is_dev_dep = False),\n struct(repo=\"crates_std__psm-0.1.31\", is_dev_dep = False),\n struct(repo=\"crates_std__quote-1.0.47\", is_dev_dep = False),\n struct(repo=\"crates_std__rustc-demangle-0.1.28\", is_dev_dep = False),\n struct(repo=\"crates_std__serde-1.0.229\", is_dev_dep = False),\n struct(repo=\"crates_std__serde_json-1.0.151\", is_dev_dep = False),\n struct(repo=\"crates_std__serde_json5-0.2.1\", is_dev_dep = False),\n struct(repo=\"crates_std__syn-2.0.119\", is_dev_dep = False),\n struct(repo=\"crates_std__thiserror-2.0.19\", is_dev_dep = False),\n struct(repo=\"crates_std__tokio-1.53.1\", is_dev_dep = False),\n struct(repo=\"crates_std__tokio-util-0.7.19\", is_dev_dep = False),\n struct(repo=\"crates_std__toml-0.8.23\", is_dev_dep = False),\n struct(repo=\"crates_std__zerocopy-0.8.55\", is_dev_dep = False),\n struct(repo=\"crates_std__zngur-0.10.0\", is_dev_dep = False),\n struct(repo=\"crates_std__zngur-lib-0.10.0\", is_dev_dep = False),\n ]\n" + "defs.bzl": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\"\"\"\n# `crates_repository` API\n\n- [aliases](#aliases)\n- [crate_deps](#crate_deps)\n- [all_crate_deps](#all_crate_deps)\n- [crate_repositories](#crate_repositories)\n\n\"\"\"\n\nload(\"@bazel_tools//tools/build_defs/repo:git.bzl\", \"git_repository\")\nload(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\")\nload(\"@bazel_tools//tools/build_defs/repo:utils.bzl\", \"maybe\")\nload(\"@bazel_skylib//lib:selects.bzl\", \"selects\")\nload(\"@rules_rust//crate_universe/private:local_crate_mirror.bzl\", \"local_crate_mirror\")\n\n###############################################################################\n# MACROS API\n###############################################################################\n\n# An identifier that represent common dependencies (unconditional).\n_COMMON_CONDITION = \"\"\n\ndef _flatten_dependency_maps(all_dependency_maps):\n \"\"\"Flatten a list of dependency maps into one dictionary.\n\n Dependency maps have the following structure:\n\n ```python\n DEPENDENCIES_MAP = {\n # The first key in the map is a Bazel package\n # name of the workspace this file is defined in.\n \"workspace_member_package\": {\n\n # Not all dependencies are supported for all platforms.\n # the condition key is the condition required to be true\n # on the host platform.\n \"condition\": {\n\n # An alias to a crate target. # The label of the crate target the\n # Aliases are only crate names. # package name refers to.\n \"package_name\": \"@full//:label\",\n }\n }\n }\n ```\n\n Args:\n all_dependency_maps (list): A list of dicts as described above\n\n Returns:\n dict: A dictionary as described above\n \"\"\"\n dependencies = {}\n\n for workspace_deps_map in all_dependency_maps:\n for pkg_name, conditional_deps_map in workspace_deps_map.items():\n if pkg_name not in dependencies:\n non_frozen_map = dict()\n for key, values in conditional_deps_map.items():\n non_frozen_map.update({key: dict(values.items())})\n dependencies.setdefault(pkg_name, non_frozen_map)\n continue\n\n for condition, deps_map in conditional_deps_map.items():\n # If the condition has not been recorded, do so and continue\n if condition not in dependencies[pkg_name]:\n dependencies[pkg_name].setdefault(condition, dict(deps_map.items()))\n continue\n\n # Alert on any miss-matched dependencies\n inconsistent_entries = []\n for crate_name, crate_label in deps_map.items():\n existing = dependencies[pkg_name][condition].get(crate_name)\n if existing and existing != crate_label:\n inconsistent_entries.append((crate_name, existing, crate_label))\n dependencies[pkg_name][condition].update({crate_name: crate_label})\n\n return dependencies\n\ndef crate_deps(deps, package_name = None):\n \"\"\"Finds the fully qualified label of the requested crates for the package where this macro is called.\n\n Args:\n deps (list): The desired list of crate targets.\n package_name (str, optional): The package name of the set of dependencies to look up.\n Defaults to `native.package_name()`.\n\n Returns:\n list: A list of labels to generated rust targets (str)\n \"\"\"\n\n if not deps:\n return []\n\n if package_name == None:\n package_name = native.package_name()\n\n # Join both sets of dependencies\n dependencies = _flatten_dependency_maps([\n _NORMAL_DEPENDENCIES,\n _NORMAL_DEV_DEPENDENCIES,\n _PROC_MACRO_DEPENDENCIES,\n _PROC_MACRO_DEV_DEPENDENCIES,\n _BUILD_DEPENDENCIES,\n _BUILD_PROC_MACRO_DEPENDENCIES,\n ]).pop(package_name, {})\n\n # Combine all conditional packages so we can easily index over a flat list\n # TODO: Perhaps this should actually return select statements and maintain\n # the conditionals of the dependencies\n flat_deps = {}\n for deps_set in dependencies.values():\n for crate_name, crate_label in deps_set.items():\n flat_deps.update({crate_name: crate_label})\n\n missing_crates = []\n crate_targets = []\n for crate_target in deps:\n if crate_target not in flat_deps:\n missing_crates.append(crate_target)\n else:\n crate_targets.append(flat_deps[crate_target])\n\n if missing_crates:\n fail(\"Could not find crates `{}` among dependencies of `{}`. Available dependencies were `{}`\".format(\n missing_crates,\n package_name,\n dependencies,\n ))\n\n return crate_targets\n\ndef all_crate_deps(\n normal = False, \n normal_dev = False, \n proc_macro = False, \n proc_macro_dev = False,\n build = False,\n build_proc_macro = False,\n package_name = None):\n \"\"\"Finds the fully qualified label of all requested direct crate dependencies \\\n for the package where this macro is called.\n\n If no parameters are set, all normal dependencies are returned. Setting any one flag will\n otherwise impact the contents of the returned list.\n\n Args:\n normal (bool, optional): If True, normal dependencies are included in the\n output list.\n normal_dev (bool, optional): If True, normal dev dependencies will be\n included in the output list.\n proc_macro (bool, optional): If True, proc_macro dependencies are included\n in the output list.\n proc_macro_dev (bool, optional): If True, dev proc_macro dependencies are\n included in the output list.\n build (bool, optional): If True, build dependencies are included\n in the output list.\n build_proc_macro (bool, optional): If True, build proc_macro dependencies are\n included in the output list.\n package_name (str, optional): The package name of the set of dependencies to look up.\n Defaults to `native.package_name()` when unset.\n\n Returns:\n list: A list of labels to generated rust targets (str)\n \"\"\"\n\n if package_name == None:\n package_name = native.package_name()\n\n # Determine the relevant maps to use\n all_dependency_maps = []\n if normal:\n all_dependency_maps.append(_NORMAL_DEPENDENCIES)\n if normal_dev:\n all_dependency_maps.append(_NORMAL_DEV_DEPENDENCIES)\n if proc_macro:\n all_dependency_maps.append(_PROC_MACRO_DEPENDENCIES)\n if proc_macro_dev:\n all_dependency_maps.append(_PROC_MACRO_DEV_DEPENDENCIES)\n if build:\n all_dependency_maps.append(_BUILD_DEPENDENCIES)\n if build_proc_macro:\n all_dependency_maps.append(_BUILD_PROC_MACRO_DEPENDENCIES)\n\n # Default to always using normal dependencies\n if not all_dependency_maps:\n all_dependency_maps.append(_NORMAL_DEPENDENCIES)\n\n dependencies = _flatten_dependency_maps(all_dependency_maps).pop(package_name, None)\n\n if not dependencies:\n if dependencies == None:\n fail(\"Tried to get all_crate_deps for package \" + package_name + \" but that package had no Cargo.toml file\")\n else:\n return []\n\n crate_deps = list(dependencies.pop(_COMMON_CONDITION, {}).values())\n for condition, deps in dependencies.items():\n crate_deps += selects.with_or({\n tuple(_CONDITIONS[condition]): deps.values(),\n \"//conditions:default\": [],\n })\n\n return crate_deps\n\ndef aliases(\n normal = False,\n normal_dev = False,\n proc_macro = False,\n proc_macro_dev = False,\n build = False,\n build_proc_macro = False,\n package_name = None):\n \"\"\"Produces a map of Crate alias names to their original label\n\n If no dependency kinds are specified, `normal` and `proc_macro` are used by default.\n Setting any one flag will otherwise determine the contents of the returned dict.\n\n Args:\n normal (bool, optional): If True, normal dependencies are included in the\n output list.\n normal_dev (bool, optional): If True, normal dev dependencies will be\n included in the output list..\n proc_macro (bool, optional): If True, proc_macro dependencies are included\n in the output list.\n proc_macro_dev (bool, optional): If True, dev proc_macro dependencies are\n included in the output list.\n build (bool, optional): If True, build dependencies are included\n in the output list.\n build_proc_macro (bool, optional): If True, build proc_macro dependencies are\n included in the output list.\n package_name (str, optional): The package name of the set of dependencies to look up.\n Defaults to `native.package_name()` when unset.\n\n Returns:\n dict: The aliases of all associated packages\n \"\"\"\n if package_name == None:\n package_name = native.package_name()\n\n # Determine the relevant maps to use\n all_aliases_maps = []\n if normal:\n all_aliases_maps.append(_NORMAL_ALIASES)\n if normal_dev:\n all_aliases_maps.append(_NORMAL_DEV_ALIASES)\n if proc_macro:\n all_aliases_maps.append(_PROC_MACRO_ALIASES)\n if proc_macro_dev:\n all_aliases_maps.append(_PROC_MACRO_DEV_ALIASES)\n if build:\n all_aliases_maps.append(_BUILD_ALIASES)\n if build_proc_macro:\n all_aliases_maps.append(_BUILD_PROC_MACRO_ALIASES)\n\n # Default to always using normal aliases\n if not all_aliases_maps:\n all_aliases_maps.append(_NORMAL_ALIASES)\n all_aliases_maps.append(_PROC_MACRO_ALIASES)\n\n aliases = _flatten_dependency_maps(all_aliases_maps).pop(package_name, None)\n\n if not aliases:\n return dict()\n\n common_items = aliases.pop(_COMMON_CONDITION, {}).items()\n\n # If there are only common items in the dictionary, immediately return them\n if not len(aliases.keys()) == 1:\n return dict(common_items)\n\n # Build a single select statement where each conditional has accounted for the\n # common set of aliases.\n crate_aliases = {\"//conditions:default\": dict(common_items)}\n for condition, deps in aliases.items():\n condition_triples = _CONDITIONS[condition]\n for triple in condition_triples:\n if triple in crate_aliases:\n crate_aliases[triple].update(deps)\n else:\n crate_aliases.update({triple: dict(deps.items() + common_items)})\n\n return select(crate_aliases)\n\n###############################################################################\n# WORKSPACE MEMBER DEPS AND ALIASES\n###############################################################################\n\n_NORMAL_DEPENDENCIES = {\n \"third_party/crates_io/crates_std\": {\n _COMMON_CONDITION: {\n \"anyhow\": Label(\"@crates_std//:anyhow-1.0.104\"),\n \"bitflags\": Label(\"@crates_std//:bitflags-2.13.1\"),\n \"byteorder\": Label(\"@crates_std//:byteorder-1.5.0\"),\n \"clap\": Label(\"@crates_std//:clap-4.6.6\"),\n \"cliclack\": Label(\"@crates_std//:cliclack-0.5.6\"),\n \"futures\": Label(\"@crates_std//:futures-0.3.34\"),\n \"hex\": Label(\"@crates_std//:hex-0.4.3\"),\n \"libc\": Label(\"@crates_std//:libc-0.2.189\"),\n \"minijinja\": Label(\"@crates_std//:minijinja-2.24.0\"),\n \"nix\": Label(\"@crates_std//:nix-0.31.3\"),\n \"nom\": Label(\"@crates_std//:nom-8.0.0\"),\n \"object\": Label(\"@crates_std//:object-0.40.0\"),\n \"proc-macro2\": Label(\"@crates_std//:proc-macro2-1.0.107\"),\n \"prost\": Label(\"@crates_std//:prost-0.14.4\"),\n \"prost-reflect\": Label(\"@crates_std//:prost-reflect-0.16.5\"),\n \"prost-types\": Label(\"@crates_std//:prost-types-0.14.4\"),\n \"protoc-gen-prost\": Label(\"@crates_std//:protoc-gen-prost-0.5.0\"),\n \"quote\": Label(\"@crates_std//:quote-1.0.47\"),\n \"rustc-demangle\": Label(\"@crates_std//:rustc-demangle-0.1.28\"),\n \"serde\": Label(\"@crates_std//:serde-1.0.229\"),\n \"serde_json\": Label(\"@crates_std//:serde_json-1.0.151\"),\n \"serde_json5\": Label(\"@crates_std//:serde_json5-0.2.1\"),\n \"syn\": Label(\"@crates_std//:syn-3.0.4\"),\n \"thiserror\": Label(\"@crates_std//:thiserror-2.0.20\"),\n \"tokio\": Label(\"@crates_std//:tokio-1.53.1\"),\n \"tokio-util\": Label(\"@crates_std//:tokio-util-0.7.19\"),\n \"toml\": Label(\"@crates_std//:toml-1.1.4+spec-1.1.0\"),\n \"zerocopy\": Label(\"@crates_std//:zerocopy-0.8.56\"),\n \"zngur\": Label(\"@crates_std//:zngur-0.10.0\"),\n \"zngur-lib\": Label(\"@crates_std//:zngur-lib-0.10.0\"),\n },\n },\n}\n\n\n_NORMAL_ALIASES = {\n \"third_party/crates_io/crates_std\": {\n _COMMON_CONDITION: {\n },\n },\n}\n\n\n_NORMAL_DEV_DEPENDENCIES = {\n \"third_party/crates_io/crates_std\": {\n },\n}\n\n\n_NORMAL_DEV_ALIASES = {\n \"third_party/crates_io/crates_std\": {\n },\n}\n\n\n_PROC_MACRO_DEPENDENCIES = {\n \"third_party/crates_io/crates_std\": {\n _COMMON_CONDITION: {\n \"bitfield-struct\": Label(\"@crates_std//:bitfield-struct-0.13.0\"),\n \"paste\": Label(\"@crates_std//:paste-1.0.15\"),\n },\n },\n}\n\n\n_PROC_MACRO_ALIASES = {\n \"third_party/crates_io/crates_std\": {\n },\n}\n\n\n_PROC_MACRO_DEV_DEPENDENCIES = {\n \"third_party/crates_io/crates_std\": {\n },\n}\n\n\n_PROC_MACRO_DEV_ALIASES = {\n \"third_party/crates_io/crates_std\": {\n },\n}\n\n\n_BUILD_DEPENDENCIES = {\n \"third_party/crates_io/crates_std\": {\n },\n}\n\n\n_BUILD_ALIASES = {\n \"third_party/crates_io/crates_std\": {\n },\n}\n\n\n_BUILD_PROC_MACRO_DEPENDENCIES = {\n \"third_party/crates_io/crates_std\": {\n },\n}\n\n\n_BUILD_PROC_MACRO_ALIASES = {\n \"third_party/crates_io/crates_std\": {\n },\n}\n\n\n_CONDITIONS = {\n \"aarch64-apple-darwin\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\"],\n \"aarch64-linux-android\": [],\n \"aarch64-unknown-linux-gnu\": [\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\"],\n \"arm64ec-pc-windows-msvc\": [],\n \"cfg(all(any(target_os = \\\"linux\\\", target_os = \\\"android\\\"), any(rustix_use_libc, miri, not(all(target_os = \\\"linux\\\", any(target_endian = \\\"little\\\", any(target_arch = \\\"s390x\\\", target_arch = \\\"powerpc\\\")), any(target_arch = \\\"arm\\\", all(target_arch = \\\"aarch64\\\", target_pointer_width = \\\"64\\\"), target_arch = \\\"riscv64\\\", all(rustix_use_experimental_asm, target_arch = \\\"powerpc\\\"), all(rustix_use_experimental_asm, target_arch = \\\"powerpc64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"s390x\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips32r6\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64r6\\\"), target_arch = \\\"x86\\\", all(target_arch = \\\"x86_64\\\", target_pointer_width = \\\"64\\\")))))))\": [],\n \"cfg(all(not(rustix_use_libc), not(miri), target_os = \\\"linux\\\", any(target_endian = \\\"little\\\", any(target_arch = \\\"s390x\\\", target_arch = \\\"powerpc\\\")), any(target_arch = \\\"arm\\\", all(target_arch = \\\"aarch64\\\", target_pointer_width = \\\"64\\\"), target_arch = \\\"riscv64\\\", all(rustix_use_experimental_asm, target_arch = \\\"powerpc\\\"), all(rustix_use_experimental_asm, target_arch = \\\"powerpc64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"s390x\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips32r6\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64r6\\\"), target_arch = \\\"x86\\\", all(target_arch = \\\"x86_64\\\", target_pointer_width = \\\"64\\\"))))\": [\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \\\"linux\\\", any(target_endian = \\\"little\\\", any(target_arch = \\\"s390x\\\", target_arch = \\\"powerpc\\\")), any(target_arch = \\\"arm\\\", all(target_arch = \\\"aarch64\\\", target_pointer_width = \\\"64\\\"), target_arch = \\\"riscv64\\\", all(rustix_use_experimental_asm, target_arch = \\\"powerpc\\\"), all(rustix_use_experimental_asm, target_arch = \\\"powerpc64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"s390x\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips32r6\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64\\\"), all(rustix_use_experimental_asm, target_arch = \\\"mips64r6\\\"), target_arch = \\\"x86\\\", all(target_arch = \\\"x86_64\\\", target_pointer_width = \\\"64\\\")))))))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-apple-darwin\"],\n \"cfg(all(target_arch = \\\"aarch64\\\", target_os = \\\"linux\\\"))\": [\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\"],\n \"cfg(all(target_arch = \\\"aarch64\\\", target_vendor = \\\"apple\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\"],\n \"cfg(all(target_arch = \\\"loongarch64\\\", target_os = \\\"linux\\\"))\": [],\n \"cfg(all(target_family = \\\"wasm\\\", target_os = \\\"unknown\\\"))\": [],\n \"cfg(all(windows, not(target_arch = \\\"arm64ec\\\")))\": [],\n \"cfg(any())\": [],\n \"cfg(any(target_arch = \\\"aarch64\\\", target_arch = \\\"x86_64\\\", target_arch = \\\"x86\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(any(unix, target_os = \\\"hermit\\\", target_os = \\\"wasi\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(any(unix, target_os = \\\"wasi\\\"))\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(target_os = \\\"hermit\\\")\": [],\n \"cfg(target_os = \\\"redox\\\")\": [],\n \"cfg(target_os = \\\"wasi\\\")\": [],\n \"cfg(unix)\": [\"@rules_rust//rust/platform:aarch64-apple-darwin\",\"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\",\"@rules_rust//rust/platform:x86_64-apple-darwin\",\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n \"cfg(windows)\": [],\n \"x86_64-apple-darwin\": [\"@rules_rust//rust/platform:x86_64-apple-darwin\"],\n \"x86_64-unknown-linux-gnu\": [\"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\"],\n}\n\n###############################################################################\n\ndef crate_repositories():\n \"\"\"A macro for defining repositories for all generated crates.\n\n Returns:\n A list of repos visible to the module through the module extension.\n \"\"\"\n maybe(\n http_archive,\n name = \"crates_std__adler2-2.0.1\",\n sha256 = \"320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/adler2/2.0.1/download\"],\n strip_prefix = \"adler2-2.0.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.adler2-2.0.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__aho-corasick-1.1.5\",\n sha256 = \"c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/aho-corasick/1.1.5/download\"],\n strip_prefix = \"aho-corasick-1.1.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.aho-corasick-1.1.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__allocator-api2-0.2.21\",\n sha256 = \"683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/allocator-api2/0.2.21/download\"],\n strip_prefix = \"allocator-api2-0.2.21\",\n build_file = Label(\"@crates_std//crates_std:BUILD.allocator-api2-0.2.21.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__anstream-1.0.0\",\n sha256 = \"824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstream/1.0.0/download\"],\n strip_prefix = \"anstream-1.0.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.anstream-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__anstyle-1.0.14\",\n sha256 = \"940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstyle/1.0.14/download\"],\n strip_prefix = \"anstyle-1.0.14\",\n build_file = Label(\"@crates_std//crates_std:BUILD.anstyle-1.0.14.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__anstyle-parse-1.0.0\",\n sha256 = \"52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstyle-parse/1.0.0/download\"],\n strip_prefix = \"anstyle-parse-1.0.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.anstyle-parse-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__anstyle-query-1.1.5\",\n sha256 = \"40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstyle-query/1.1.5/download\"],\n strip_prefix = \"anstyle-query-1.1.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.anstyle-query-1.1.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__anstyle-wincon-3.0.11\",\n sha256 = \"291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anstyle-wincon/3.0.11/download\"],\n strip_prefix = \"anstyle-wincon-3.0.11\",\n build_file = Label(\"@crates_std//crates_std:BUILD.anstyle-wincon-3.0.11.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__anyhow-1.0.104\",\n sha256 = \"330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/anyhow/1.0.104/download\"],\n strip_prefix = \"anyhow-1.0.104\",\n build_file = Label(\"@crates_std//crates_std:BUILD.anyhow-1.0.104.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__ar_archive_writer-0.5.3\",\n sha256 = \"73cd58deff2140a0a8eae87e417bd01db68a33e148aa93d1e8cd837e55e312b6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ar_archive_writer/0.5.3/download\"],\n strip_prefix = \"ar_archive_writer-0.5.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.ar_archive_writer-0.5.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__ariadne-0.3.0\",\n sha256 = \"72fe02fc62033df9ba41cba57ee19acf5e742511a140c7dbc3a873e19a19a1bd\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ariadne/0.3.0/download\"],\n strip_prefix = \"ariadne-0.3.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.ariadne-0.3.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__askama-0.12.1\",\n sha256 = \"b79091df18a97caea757e28cd2d5fda49c6cd4bd01ddffd7ff01ace0c0ad2c28\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/askama/0.12.1/download\"],\n strip_prefix = \"askama-0.12.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.askama-0.12.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__askama_derive-0.12.5\",\n sha256 = \"19fe8d6cb13c4714962c072ea496f3392015f0989b1a2847bb4b2d9effd71d83\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/askama_derive/0.12.5/download\"],\n strip_prefix = \"askama_derive-0.12.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.askama_derive-0.12.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__askama_escape-0.10.3\",\n sha256 = \"619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/askama_escape/0.10.3/download\"],\n strip_prefix = \"askama_escape-0.10.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.askama_escape-0.10.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__askama_parser-0.2.1\",\n sha256 = \"acb1161c6b64d1c3d83108213c2a2533a342ac225aabd0bda218278c2ddb00c0\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/askama_parser/0.2.1/download\"],\n strip_prefix = \"askama_parser-0.2.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.askama_parser-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__autocfg-1.5.1\",\n sha256 = \"f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/autocfg/1.5.1/download\"],\n strip_prefix = \"autocfg-1.5.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.autocfg-1.5.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__basic-toml-0.1.10\",\n sha256 = \"ba62675e8242a4c4e806d12f11d136e626e6c8361d6b829310732241652a178a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/basic-toml/0.1.10/download\"],\n strip_prefix = \"basic-toml-0.1.10\",\n build_file = Label(\"@crates_std//crates_std:BUILD.basic-toml-0.1.10.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__bitfield-struct-0.13.0\",\n sha256 = \"3ca6739863c590881f038d033a146c51ddae239186a4327014839fd864f44ed5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bitfield-struct/0.13.0/download\"],\n strip_prefix = \"bitfield-struct-0.13.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.bitfield-struct-0.13.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__bitflags-2.13.1\",\n sha256 = \"b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bitflags/2.13.1/download\"],\n strip_prefix = \"bitflags-2.13.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.bitflags-2.13.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__block-buffer-0.10.4\",\n sha256 = \"3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/block-buffer/0.10.4/download\"],\n strip_prefix = \"block-buffer-0.10.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.block-buffer-0.10.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__bumpalo-3.20.3\",\n sha256 = \"72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bumpalo/3.20.3/download\"],\n strip_prefix = \"bumpalo-3.20.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.bumpalo-3.20.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__byteorder-1.5.0\",\n sha256 = \"1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/byteorder/1.5.0/download\"],\n strip_prefix = \"byteorder-1.5.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.byteorder-1.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__bytes-1.12.1\",\n sha256 = \"fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/bytes/1.12.1/download\"],\n strip_prefix = \"bytes-1.12.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.bytes-1.12.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__cc-1.4.4\",\n sha256 = \"0ad534f4357a5264cce5019c989cf66a4f0dc4e0d1b1d15f8aacec0ff7360273\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cc/1.4.4/download\"],\n strip_prefix = \"cc-1.4.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.cc-1.4.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__cfg-if-1.0.4\",\n sha256 = \"9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cfg-if/1.0.4/download\"],\n strip_prefix = \"cfg-if-1.0.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.cfg-if-1.0.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__cfg_aliases-0.2.2\",\n sha256 = \"f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cfg_aliases/0.2.2/download\"],\n strip_prefix = \"cfg_aliases-0.2.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.cfg_aliases-0.2.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__chumsky-1.0.0-alpha.8\",\n sha256 = \"0e82d74e6c83060ec269fe9e0d408d6de4a1645d525f9a0bbbb841ba4efd91ac\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/chumsky/1.0.0-alpha.8/download\"],\n strip_prefix = \"chumsky-1.0.0-alpha.8\",\n build_file = Label(\"@crates_std//crates_std:BUILD.chumsky-1.0.0-alpha.8.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__clap-4.6.6\",\n sha256 = \"473c7e07f409a8d772161724aa8db6a765a2532a70f9667eeb7b49d3d02fbdca\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/clap/4.6.6/download\"],\n strip_prefix = \"clap-4.6.6\",\n build_file = Label(\"@crates_std//crates_std:BUILD.clap-4.6.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__clap_builder-4.6.6\",\n sha256 = \"7b48fea5a88e9ae728a2dcbedbfc0e730f7d60da42e1cb049a83c9fb8b789889\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/clap_builder/4.6.6/download\"],\n strip_prefix = \"clap_builder-4.6.6\",\n build_file = Label(\"@crates_std//crates_std:BUILD.clap_builder-4.6.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__clap_derive-4.6.4\",\n sha256 = \"d012d2b9d65aca7f18f4d9878a045bc17899bba951561ba5ec3c2ba1eed9a061\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/clap_derive/4.6.4/download\"],\n strip_prefix = \"clap_derive-4.6.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.clap_derive-4.6.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__clap_lex-1.1.0\",\n sha256 = \"c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/clap_lex/1.1.0/download\"],\n strip_prefix = \"clap_lex-1.1.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.clap_lex-1.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__cliclack-0.5.6\",\n sha256 = \"134778b6a125729ff495c23ba32f64e0c26d61edd52f1f6715a0d036785cf30b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cliclack/0.5.6/download\"],\n strip_prefix = \"cliclack-0.5.6\",\n build_file = Label(\"@crates_std//crates_std:BUILD.cliclack-0.5.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__colorchoice-1.0.5\",\n sha256 = \"1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/colorchoice/1.0.5/download\"],\n strip_prefix = \"colorchoice-1.0.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.colorchoice-1.0.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__console-0.16.4\",\n sha256 = \"4fe5f465a4f6fee88fad41b85d990f84c835335e85b5d9e6e63e0d06d28cba7c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/console/0.16.4/download\"],\n strip_prefix = \"console-0.16.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.console-0.16.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__cpufeatures-0.2.17\",\n sha256 = \"59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/cpufeatures/0.2.17/download\"],\n strip_prefix = \"cpufeatures-0.2.17\",\n build_file = Label(\"@crates_std//crates_std:BUILD.cpufeatures-0.2.17.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__crc32fast-1.5.1\",\n sha256 = \"8498c871161e1742aaa9d52551b2d6ebdd4c3d45a3be423e3728f33b955be550\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/crc32fast/1.5.1/download\"],\n strip_prefix = \"crc32fast-1.5.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.crc32fast-1.5.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__crypto-common-0.1.7\",\n sha256 = \"78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/crypto-common/0.1.7/download\"],\n strip_prefix = \"crypto-common-0.1.7\",\n build_file = Label(\"@crates_std//crates_std:BUILD.crypto-common-0.1.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__digest-0.10.7\",\n sha256 = \"9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/digest/0.10.7/download\"],\n strip_prefix = \"digest-0.10.7\",\n build_file = Label(\"@crates_std//crates_std:BUILD.digest-0.10.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__either-1.18.0\",\n sha256 = \"252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/either/1.18.0/download\"],\n strip_prefix = \"either-1.18.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.either-1.18.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__encode_unicode-1.0.0\",\n sha256 = \"34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/encode_unicode/1.0.0/download\"],\n strip_prefix = \"encode_unicode-1.0.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.encode_unicode-1.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__equivalent-1.0.2\",\n sha256 = \"877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/equivalent/1.0.2/download\"],\n strip_prefix = \"equivalent-1.0.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.equivalent-1.0.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__errno-0.3.14\",\n sha256 = \"39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/errno/0.3.14/download\"],\n strip_prefix = \"errno-0.3.14\",\n build_file = Label(\"@crates_std//crates_std:BUILD.errno-0.3.14.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__fastrand-2.5.0\",\n sha256 = \"da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/fastrand/2.5.0/download\"],\n strip_prefix = \"fastrand-2.5.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.fastrand-2.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__find-msvc-tools-0.1.11\",\n sha256 = \"d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/find-msvc-tools/0.1.11/download\"],\n strip_prefix = \"find-msvc-tools-0.1.11\",\n build_file = Label(\"@crates_std//crates_std:BUILD.find-msvc-tools-0.1.11.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__fixedbitset-0.5.7\",\n sha256 = \"1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/fixedbitset/0.5.7/download\"],\n strip_prefix = \"fixedbitset-0.5.7\",\n build_file = Label(\"@crates_std//crates_std:BUILD.fixedbitset-0.5.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__flate2-1.1.9\",\n sha256 = \"843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/flate2/1.1.9/download\"],\n strip_prefix = \"flate2-1.1.9\",\n build_file = Label(\"@crates_std//crates_std:BUILD.flate2-1.1.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__fnv-1.0.7\",\n sha256 = \"3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/fnv/1.0.7/download\"],\n strip_prefix = \"fnv-1.0.7\",\n build_file = Label(\"@crates_std//crates_std:BUILD.fnv-1.0.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__foldhash-0.1.5\",\n sha256 = \"d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/foldhash/0.1.5/download\"],\n strip_prefix = \"foldhash-0.1.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.foldhash-0.1.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__foldhash-0.2.0\",\n sha256 = \"77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/foldhash/0.2.0/download\"],\n strip_prefix = \"foldhash-0.2.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.foldhash-0.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__futures-0.3.34\",\n sha256 = \"9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures/0.3.34/download\"],\n strip_prefix = \"futures-0.3.34\",\n build_file = Label(\"@crates_std//crates_std:BUILD.futures-0.3.34.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__futures-channel-0.3.34\",\n sha256 = \"b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-channel/0.3.34/download\"],\n strip_prefix = \"futures-channel-0.3.34\",\n build_file = Label(\"@crates_std//crates_std:BUILD.futures-channel-0.3.34.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__futures-core-0.3.34\",\n sha256 = \"92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-core/0.3.34/download\"],\n strip_prefix = \"futures-core-0.3.34\",\n build_file = Label(\"@crates_std//crates_std:BUILD.futures-core-0.3.34.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__futures-executor-0.3.34\",\n sha256 = \"031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-executor/0.3.34/download\"],\n strip_prefix = \"futures-executor-0.3.34\",\n build_file = Label(\"@crates_std//crates_std:BUILD.futures-executor-0.3.34.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__futures-io-0.3.34\",\n sha256 = \"53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-io/0.3.34/download\"],\n strip_prefix = \"futures-io-0.3.34\",\n build_file = Label(\"@crates_std//crates_std:BUILD.futures-io-0.3.34.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__futures-macro-0.3.34\",\n sha256 = \"9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-macro/0.3.34/download\"],\n strip_prefix = \"futures-macro-0.3.34\",\n build_file = Label(\"@crates_std//crates_std:BUILD.futures-macro-0.3.34.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__futures-sink-0.3.34\",\n sha256 = \"1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-sink/0.3.34/download\"],\n strip_prefix = \"futures-sink-0.3.34\",\n build_file = Label(\"@crates_std//crates_std:BUILD.futures-sink-0.3.34.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__futures-task-0.3.34\",\n sha256 = \"cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-task/0.3.34/download\"],\n strip_prefix = \"futures-task-0.3.34\",\n build_file = Label(\"@crates_std//crates_std:BUILD.futures-task-0.3.34.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__futures-util-0.3.34\",\n sha256 = \"0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/futures-util/0.3.34/download\"],\n strip_prefix = \"futures-util-0.3.34\",\n build_file = Label(\"@crates_std//crates_std:BUILD.futures-util-0.3.34.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__generic-array-0.14.7\",\n sha256 = \"85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/generic-array/0.14.7/download\"],\n strip_prefix = \"generic-array-0.14.7\",\n build_file = Label(\"@crates_std//crates_std:BUILD.generic-array-0.14.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__hashbrown-0.15.5\",\n sha256 = \"9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hashbrown/0.15.5/download\"],\n strip_prefix = \"hashbrown-0.15.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.hashbrown-0.15.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__hashbrown-0.17.1\",\n sha256 = \"ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hashbrown/0.17.1/download\"],\n strip_prefix = \"hashbrown-0.17.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.hashbrown-0.17.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__heck-0.5.0\",\n sha256 = \"2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/heck/0.5.0/download\"],\n strip_prefix = \"heck-0.5.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.heck-0.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__hex-0.4.3\",\n sha256 = \"7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/hex/0.4.3/download\"],\n strip_prefix = \"hex-0.4.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.hex-0.4.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__humansize-2.1.3\",\n sha256 = \"6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/humansize/2.1.3/download\"],\n strip_prefix = \"humansize-2.1.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.humansize-2.1.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__indexmap-2.14.0\",\n sha256 = \"d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/indexmap/2.14.0/download\"],\n strip_prefix = \"indexmap-2.14.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.indexmap-2.14.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__indicatif-0.18.6\",\n sha256 = \"9433806cd6b4ec1aba79c021c7e4c58fb4c3b9977c085062e611ac929998fb0c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/indicatif/0.18.6/download\"],\n strip_prefix = \"indicatif-0.18.6\",\n build_file = Label(\"@crates_std//crates_std:BUILD.indicatif-0.18.6.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__is_terminal_polyfill-1.70.2\",\n sha256 = \"a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/is_terminal_polyfill/1.70.2/download\"],\n strip_prefix = \"is_terminal_polyfill-1.70.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.is_terminal_polyfill-1.70.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__itertools-0.11.0\",\n sha256 = \"b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/itertools/0.11.0/download\"],\n strip_prefix = \"itertools-0.11.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.itertools-0.11.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__itertools-0.14.0\",\n sha256 = \"2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/itertools/0.14.0/download\"],\n strip_prefix = \"itertools-0.14.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.itertools-0.14.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__itoa-1.0.18\",\n sha256 = \"8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/itoa/1.0.18/download\"],\n strip_prefix = \"itoa-1.0.18\",\n build_file = Label(\"@crates_std//crates_std:BUILD.itoa-1.0.18.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__js-sys-0.3.104\",\n sha256 = \"0e0c1080212aad755ea003d18543e8768dd432c48819efd73a7bf1e39b7a5a3a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/js-sys/0.3.104/download\"],\n strip_prefix = \"js-sys-0.3.104\",\n build_file = Label(\"@crates_std//crates_std:BUILD.js-sys-0.3.104.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__libc-0.2.189\",\n sha256 = \"3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/libc/0.2.189/download\"],\n strip_prefix = \"libc-0.2.189\",\n build_file = Label(\"@crates_std//crates_std:BUILD.libc-0.2.189.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__libm-0.2.16\",\n sha256 = \"b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/libm/0.2.16/download\"],\n strip_prefix = \"libm-0.2.16\",\n build_file = Label(\"@crates_std//crates_std:BUILD.libm-0.2.16.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__linux-raw-sys-0.12.1\",\n sha256 = \"32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/linux-raw-sys/0.12.1/download\"],\n strip_prefix = \"linux-raw-sys-0.12.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.linux-raw-sys-0.12.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__lock_api-0.4.14\",\n sha256 = \"224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/lock_api/0.4.14/download\"],\n strip_prefix = \"lock_api-0.4.14\",\n build_file = Label(\"@crates_std//crates_std:BUILD.lock_api-0.4.14.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__log-0.4.34\",\n sha256 = \"f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/log/0.4.34/download\"],\n strip_prefix = \"log-0.4.34\",\n build_file = Label(\"@crates_std//crates_std:BUILD.log-0.4.34.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__logos-0.16.1\",\n sha256 = \"eb2c55a318a87600ea870ff8c2012148b44bf18b74fad48d0f835c38c7d07c5f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/logos/0.16.1/download\"],\n strip_prefix = \"logos-0.16.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.logos-0.16.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__logos-codegen-0.16.1\",\n sha256 = \"58b3ffaa284e1350d017a57d04ada118c4583cf260c8fb01e0fe28a2e9cf8970\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/logos-codegen/0.16.1/download\"],\n strip_prefix = \"logos-codegen-0.16.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.logos-codegen-0.16.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__logos-derive-0.16.1\",\n sha256 = \"52d3a9855747c17eaf4383823f135220716ab49bea5fbea7dd42cc9a92f8aa31\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/logos-derive/0.16.1/download\"],\n strip_prefix = \"logos-derive-0.16.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.logos-derive-0.16.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__memchr-2.8.3\",\n sha256 = \"cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/memchr/2.8.3/download\"],\n strip_prefix = \"memchr-2.8.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.memchr-2.8.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__memo-map-0.3.3\",\n sha256 = \"38d1115007560874e373613744c6fba374c17688327a71c1476d1a5954cc857b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/memo-map/0.3.3/download\"],\n strip_prefix = \"memo-map-0.3.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.memo-map-0.3.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__mime-0.3.17\",\n sha256 = \"6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/mime/0.3.17/download\"],\n strip_prefix = \"mime-0.3.17\",\n build_file = Label(\"@crates_std//crates_std:BUILD.mime-0.3.17.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__mime_guess-2.0.5\",\n sha256 = \"f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/mime_guess/2.0.5/download\"],\n strip_prefix = \"mime_guess-2.0.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.mime_guess-2.0.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__minijinja-2.24.0\",\n sha256 = \"86886cf6dbf4e614b19c9a1eec9775f021869d7eadde0fc73921a81b90c9b4c9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/minijinja/2.24.0/download\"],\n strip_prefix = \"minijinja-2.24.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.minijinja-2.24.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__minimal-lexical-0.2.1\",\n sha256 = \"68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/minimal-lexical/0.2.1/download\"],\n strip_prefix = \"minimal-lexical-0.2.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.minimal-lexical-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__miniz_oxide-0.8.9\",\n sha256 = \"1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/miniz_oxide/0.8.9/download\"],\n strip_prefix = \"miniz_oxide-0.8.9\",\n build_file = Label(\"@crates_std//crates_std:BUILD.miniz_oxide-0.8.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__mio-1.2.2\",\n sha256 = \"30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/mio/1.2.2/download\"],\n strip_prefix = \"mio-1.2.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.mio-1.2.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__multimap-0.10.1\",\n sha256 = \"1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/multimap/0.10.1/download\"],\n strip_prefix = \"multimap-0.10.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.multimap-0.10.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__nix-0.31.3\",\n sha256 = \"cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/nix/0.31.3/download\"],\n strip_prefix = \"nix-0.31.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.nix-0.31.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__nom-7.1.3\",\n sha256 = \"d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/nom/7.1.3/download\"],\n strip_prefix = \"nom-7.1.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.nom-7.1.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__nom-8.0.0\",\n sha256 = \"df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/nom/8.0.0/download\"],\n strip_prefix = \"nom-8.0.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.nom-8.0.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__num-traits-0.2.19\",\n sha256 = \"071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/num-traits/0.2.19/download\"],\n strip_prefix = \"num-traits-0.2.19\",\n build_file = Label(\"@crates_std//crates_std:BUILD.num-traits-0.2.19.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__object-0.39.1\",\n sha256 = \"2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/object/0.39.1/download\"],\n strip_prefix = \"object-0.39.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.object-0.39.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__object-0.40.0\",\n sha256 = \"dd229a0361b9d0d4396176e02d65897f487eebeab7caa6d443855ee152ca0b9c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/object/0.40.0/download\"],\n strip_prefix = \"object-0.40.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.object-0.40.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__once_cell-1.21.4\",\n sha256 = \"9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/once_cell/1.21.4/download\"],\n strip_prefix = \"once_cell-1.21.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.once_cell-1.21.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__once_cell_polyfill-1.70.2\",\n sha256 = \"384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/once_cell_polyfill/1.70.2/download\"],\n strip_prefix = \"once_cell_polyfill-1.70.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.once_cell_polyfill-1.70.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__parking_lot-0.12.5\",\n sha256 = \"93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/parking_lot/0.12.5/download\"],\n strip_prefix = \"parking_lot-0.12.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.parking_lot-0.12.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__parking_lot_core-0.9.12\",\n sha256 = \"2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/parking_lot_core/0.9.12/download\"],\n strip_prefix = \"parking_lot_core-0.9.12\",\n build_file = Label(\"@crates_std//crates_std:BUILD.parking_lot_core-0.9.12.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__paste-1.0.15\",\n sha256 = \"57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/paste/1.0.15/download\"],\n strip_prefix = \"paste-1.0.15\",\n build_file = Label(\"@crates_std//crates_std:BUILD.paste-1.0.15.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__percent-encoding-2.3.2\",\n sha256 = \"9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/percent-encoding/2.3.2/download\"],\n strip_prefix = \"percent-encoding-2.3.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.percent-encoding-2.3.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__pest-2.9.0\",\n sha256 = \"5a07a60cc7a4d00c91f95c685609d1d2f79050e6804b70ebedd7650f0b839bcf\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pest/2.9.0/download\"],\n strip_prefix = \"pest-2.9.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.pest-2.9.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__pest_derive-2.9.0\",\n sha256 = \"b3a83744a5c8455b8b3e0dc5031362780a347c878bdd11584d1a8984228cc88d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pest_derive/2.9.0/download\"],\n strip_prefix = \"pest_derive-2.9.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.pest_derive-2.9.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__pest_generator-2.9.0\",\n sha256 = \"e0cd3451aa3de60d4b9a1e736885e4dea6b31617598026f12256ad566d63304a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pest_generator/2.9.0/download\"],\n strip_prefix = \"pest_generator-2.9.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.pest_generator-2.9.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__pest_meta-2.9.0\",\n sha256 = \"e04d3a0849e241d7dfce834c83b1c5edc8622009e8dd51a12ba1927c32f05496\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pest_meta/2.9.0/download\"],\n strip_prefix = \"pest_meta-2.9.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.pest_meta-2.9.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__petgraph-0.8.3\",\n sha256 = \"8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/petgraph/0.8.3/download\"],\n strip_prefix = \"petgraph-0.8.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.petgraph-0.8.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__pin-project-lite-0.2.17\",\n sha256 = \"a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/pin-project-lite/0.2.17/download\"],\n strip_prefix = \"pin-project-lite-0.2.17\",\n build_file = Label(\"@crates_std//crates_std:BUILD.pin-project-lite-0.2.17.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__portable-atomic-1.15.0\",\n sha256 = \"05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/portable-atomic/1.15.0/download\"],\n strip_prefix = \"portable-atomic-1.15.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.portable-atomic-1.15.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__proc-macro2-1.0.107\",\n sha256 = \"985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/proc-macro2/1.0.107/download\"],\n strip_prefix = \"proc-macro2-1.0.107\",\n build_file = Label(\"@crates_std//crates_std:BUILD.proc-macro2-1.0.107.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__prost-0.14.4\",\n sha256 = \"528ac67416ff8646872a3c02cad9cc4ee5dc9f9540c9b10771855c95cb2e5ae1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/prost/0.14.4/download\"],\n strip_prefix = \"prost-0.14.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.prost-0.14.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__prost-build-0.14.4\",\n sha256 = \"03da047801ff44bb6a4d407d4860c05fd70bb81714e6b2f3812603d5b145b042\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/prost-build/0.14.4/download\"],\n strip_prefix = \"prost-build-0.14.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.prost-build-0.14.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__prost-derive-0.14.4\",\n sha256 = \"b570b25f7617e43d59005d0990ccb79e950a423952cea19671b7a876da390adf\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/prost-derive/0.14.4/download\"],\n strip_prefix = \"prost-derive-0.14.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.prost-derive-0.14.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__prost-reflect-0.16.5\",\n sha256 = \"01b80ea363c31af2de2b92e3c07ed1156628f7838c4afb4df75ee78a37fedbd1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/prost-reflect/0.16.5/download\"],\n strip_prefix = \"prost-reflect-0.16.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.prost-reflect-0.16.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__prost-types-0.14.4\",\n sha256 = \"f94967dc7688f3054c7fac87473ffae4cc4c3904800e2d9f5b857246d8963b0a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/prost-types/0.14.4/download\"],\n strip_prefix = \"prost-types-0.14.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.prost-types-0.14.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__protoc-gen-prost-0.5.0\",\n sha256 = \"4018e7b5e3a213d241d79a0ef43a442a17dc23dcdd5b81b0c42b2549197897fd\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/protoc-gen-prost/0.5.0/download\"],\n strip_prefix = \"protoc-gen-prost-0.5.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.protoc-gen-prost-0.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__psm-0.1.32\",\n sha256 = \"4dcd034599e63b970727f70d79e02d62390a4a84f7c6b827c27c46d5ac3fa622\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/psm/0.1.32/download\"],\n strip_prefix = \"psm-0.1.32\",\n build_file = Label(\"@crates_std//crates_std:BUILD.psm-0.1.32.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__quote-1.0.47\",\n sha256 = \"1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/quote/1.0.47/download\"],\n strip_prefix = \"quote-1.0.47\",\n build_file = Label(\"@crates_std//crates_std:BUILD.quote-1.0.47.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__redox_syscall-0.5.18\",\n sha256 = \"ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/redox_syscall/0.5.18/download\"],\n strip_prefix = \"redox_syscall-0.5.18\",\n build_file = Label(\"@crates_std//crates_std:BUILD.redox_syscall-0.5.18.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__regex-1.13.1\",\n sha256 = \"f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/regex/1.13.1/download\"],\n strip_prefix = \"regex-1.13.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.regex-1.13.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__regex-automata-0.3.9\",\n sha256 = \"59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/regex-automata/0.3.9/download\"],\n strip_prefix = \"regex-automata-0.3.9\",\n build_file = Label(\"@crates_std//crates_std:BUILD.regex-automata-0.3.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__regex-automata-0.4.18\",\n sha256 = \"ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/regex-automata/0.4.18/download\"],\n strip_prefix = \"regex-automata-0.4.18\",\n build_file = Label(\"@crates_std//crates_std:BUILD.regex-automata-0.4.18.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__regex-syntax-0.7.5\",\n sha256 = \"dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/regex-syntax/0.7.5/download\"],\n strip_prefix = \"regex-syntax-0.7.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.regex-syntax-0.7.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__regex-syntax-0.8.11\",\n sha256 = \"d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/regex-syntax/0.8.11/download\"],\n strip_prefix = \"regex-syntax-0.8.11\",\n build_file = Label(\"@crates_std//crates_std:BUILD.regex-syntax-0.8.11.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__rustc-demangle-0.1.28\",\n sha256 = \"b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rustc-demangle/0.1.28/download\"],\n strip_prefix = \"rustc-demangle-0.1.28\",\n build_file = Label(\"@crates_std//crates_std:BUILD.rustc-demangle-0.1.28.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__rustix-1.1.4\",\n sha256 = \"b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rustix/1.1.4/download\"],\n strip_prefix = \"rustix-1.1.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.rustix-1.1.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__rustversion-1.0.23\",\n sha256 = \"cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/rustversion/1.0.23/download\"],\n strip_prefix = \"rustversion-1.0.23\",\n build_file = Label(\"@crates_std//crates_std:BUILD.rustversion-1.0.23.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__ruzstd-0.9.0\",\n sha256 = \"a252f5e20f038fe7b4ea53e073e65398d652c864cc162fc77c56c2f13717b888\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ruzstd/0.9.0/download\"],\n strip_prefix = \"ruzstd-0.9.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.ruzstd-0.9.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__scopeguard-1.2.0\",\n sha256 = \"94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/scopeguard/1.2.0/download\"],\n strip_prefix = \"scopeguard-1.2.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.scopeguard-1.2.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__serde-1.0.229\",\n sha256 = \"4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde/1.0.229/download\"],\n strip_prefix = \"serde-1.0.229\",\n build_file = Label(\"@crates_std//crates_std:BUILD.serde-1.0.229.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__serde_core-1.0.229\",\n sha256 = \"67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde_core/1.0.229/download\"],\n strip_prefix = \"serde_core-1.0.229\",\n build_file = Label(\"@crates_std//crates_std:BUILD.serde_core-1.0.229.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__serde_derive-1.0.229\",\n sha256 = \"e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde_derive/1.0.229/download\"],\n strip_prefix = \"serde_derive-1.0.229\",\n build_file = Label(\"@crates_std//crates_std:BUILD.serde_derive-1.0.229.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__serde_json-1.0.151\",\n sha256 = \"c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde_json/1.0.151/download\"],\n strip_prefix = \"serde_json-1.0.151\",\n build_file = Label(\"@crates_std//crates_std:BUILD.serde_json-1.0.151.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__serde_json5-0.2.1\",\n sha256 = \"5d34d03f54462862f2a42918391c9526337f53171eaa4d8894562be7f252edd3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde_json5/0.2.1/download\"],\n strip_prefix = \"serde_json5-0.2.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.serde_json5-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__serde_spanned-1.1.1\",\n sha256 = \"6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/serde_spanned/1.1.1/download\"],\n strip_prefix = \"serde_spanned-1.1.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.serde_spanned-1.1.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__sha2-0.10.9\",\n sha256 = \"a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/sha2/0.10.9/download\"],\n strip_prefix = \"sha2-0.10.9\",\n build_file = Label(\"@crates_std//crates_std:BUILD.sha2-0.10.9.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__shlex-2.0.1\",\n sha256 = \"f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/shlex/2.0.1/download\"],\n strip_prefix = \"shlex-2.0.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.shlex-2.0.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__signal-hook-registry-1.4.8\",\n sha256 = \"c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/signal-hook-registry/1.4.8/download\"],\n strip_prefix = \"signal-hook-registry-1.4.8\",\n build_file = Label(\"@crates_std//crates_std:BUILD.signal-hook-registry-1.4.8.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__simd-adler32-0.3.10\",\n sha256 = \"3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/simd-adler32/0.3.10/download\"],\n strip_prefix = \"simd-adler32-0.3.10\",\n build_file = Label(\"@crates_std//crates_std:BUILD.simd-adler32-0.3.10.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__slab-0.4.12\",\n sha256 = \"0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/slab/0.4.12/download\"],\n strip_prefix = \"slab-0.4.12\",\n build_file = Label(\"@crates_std//crates_std:BUILD.slab-0.4.12.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__smallvec-1.15.2\",\n sha256 = \"8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/smallvec/1.15.2/download\"],\n strip_prefix = \"smallvec-1.15.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.smallvec-1.15.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__smawk-0.3.3\",\n sha256 = \"e8e2fb0f499abb4d162f2bedad68f5ef91a1682b5a03596ddb67efd37768d100\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/smawk/0.3.3/download\"],\n strip_prefix = \"smawk-0.3.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.smawk-0.3.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__socket2-0.6.5\",\n sha256 = \"c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/socket2/0.6.5/download\"],\n strip_prefix = \"socket2-0.6.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.socket2-0.6.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__stacker-0.1.25\",\n sha256 = \"707f49d46706bacf8a2b00d51dace3f9de527c13eec3778f570c411f89e69967\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/stacker/0.1.25/download\"],\n strip_prefix = \"stacker-0.1.25\",\n build_file = Label(\"@crates_std//crates_std:BUILD.stacker-0.1.25.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__strsim-0.11.1\",\n sha256 = \"7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/strsim/0.11.1/download\"],\n strip_prefix = \"strsim-0.11.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.strsim-0.11.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__syn-2.0.119\",\n sha256 = \"872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/syn/2.0.119/download\"],\n strip_prefix = \"syn-2.0.119\",\n build_file = Label(\"@crates_std//crates_std:BUILD.syn-2.0.119.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__syn-3.0.4\",\n sha256 = \"e6275cddf4610d1775e6d1fe9469b2e77d0f39fd98fb7450901b821e0c53649f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/syn/3.0.4/download\"],\n strip_prefix = \"syn-3.0.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.syn-3.0.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__tempfile-3.27.0\",\n sha256 = \"32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/tempfile/3.27.0/download\"],\n strip_prefix = \"tempfile-3.27.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.tempfile-3.27.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__textwrap-0.16.2\",\n sha256 = \"c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/textwrap/0.16.2/download\"],\n strip_prefix = \"textwrap-0.16.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.textwrap-0.16.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__thiserror-2.0.20\",\n sha256 = \"ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/thiserror/2.0.20/download\"],\n strip_prefix = \"thiserror-2.0.20\",\n build_file = Label(\"@crates_std//crates_std:BUILD.thiserror-2.0.20.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__thiserror-impl-2.0.20\",\n sha256 = \"bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/thiserror-impl/2.0.20/download\"],\n strip_prefix = \"thiserror-impl-2.0.20\",\n build_file = Label(\"@crates_std//crates_std:BUILD.thiserror-impl-2.0.20.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__tokio-1.53.1\",\n sha256 = \"202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/tokio/1.53.1/download\"],\n strip_prefix = \"tokio-1.53.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.tokio-1.53.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__tokio-macros-2.7.2\",\n sha256 = \"78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/tokio-macros/2.7.2/download\"],\n strip_prefix = \"tokio-macros-2.7.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.tokio-macros-2.7.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__tokio-util-0.7.19\",\n sha256 = \"494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/tokio-util/0.7.19/download\"],\n strip_prefix = \"tokio-util-0.7.19\",\n build_file = Label(\"@crates_std//crates_std:BUILD.tokio-util-0.7.19.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__toml-1.1.4-spec-1.1.0\",\n sha256 = \"3aace63f4bbcdfc2c965b059de67119c89c4017a70d633be6c104910f67056f5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/toml/1.1.4+spec-1.1.0/download\"],\n strip_prefix = \"toml-1.1.4+spec-1.1.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.toml-1.1.4+spec-1.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__toml_datetime-1.1.1-spec-1.1.0\",\n sha256 = \"3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/toml_datetime/1.1.1+spec-1.1.0/download\"],\n strip_prefix = \"toml_datetime-1.1.1+spec-1.1.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.toml_datetime-1.1.1+spec-1.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__toml_parser-1.1.3-spec-1.1.0\",\n sha256 = \"1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/toml_parser/1.1.3+spec-1.1.0/download\"],\n strip_prefix = \"toml_parser-1.1.3+spec-1.1.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.toml_parser-1.1.3+spec-1.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__toml_writer-1.1.2-spec-1.1.0\",\n sha256 = \"7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/toml_writer/1.1.2+spec-1.1.0/download\"],\n strip_prefix = \"toml_writer-1.1.2+spec-1.1.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.toml_writer-1.1.2+spec-1.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__twox-hash-2.1.3\",\n sha256 = \"8464ec13c3691491391d9fce00f6416c9a48e46972f72d7865688be2080192c9\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/twox-hash/2.1.3/download\"],\n strip_prefix = \"twox-hash-2.1.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.twox-hash-2.1.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__typenum-1.20.1\",\n sha256 = \"b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/typenum/1.20.1/download\"],\n strip_prefix = \"typenum-1.20.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.typenum-1.20.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__ucd-trie-0.1.7\",\n sha256 = \"2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/ucd-trie/0.1.7/download\"],\n strip_prefix = \"ucd-trie-0.1.7\",\n build_file = Label(\"@crates_std//crates_std:BUILD.ucd-trie-0.1.7.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__unicase-2.9.0\",\n sha256 = \"dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicase/2.9.0/download\"],\n strip_prefix = \"unicase-2.9.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.unicase-2.9.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__unicode-ident-1.0.24\",\n sha256 = \"e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicode-ident/1.0.24/download\"],\n strip_prefix = \"unicode-ident-1.0.24\",\n build_file = Label(\"@crates_std//crates_std:BUILD.unicode-ident-1.0.24.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__unicode-linebreak-0.1.5\",\n sha256 = \"3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicode-linebreak/0.1.5/download\"],\n strip_prefix = \"unicode-linebreak-0.1.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.unicode-linebreak-0.1.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__unicode-segmentation-1.13.3\",\n sha256 = \"c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicode-segmentation/1.13.3/download\"],\n strip_prefix = \"unicode-segmentation-1.13.3\",\n build_file = Label(\"@crates_std//crates_std:BUILD.unicode-segmentation-1.13.3.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__unicode-width-0.1.14\",\n sha256 = \"7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicode-width/0.1.14/download\"],\n strip_prefix = \"unicode-width-0.1.14\",\n build_file = Label(\"@crates_std//crates_std:BUILD.unicode-width-0.1.14.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__unicode-width-0.2.2\",\n sha256 = \"b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unicode-width/0.2.2/download\"],\n strip_prefix = \"unicode-width-0.2.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.unicode-width-0.2.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__unit-prefix-0.5.2\",\n sha256 = \"81e544489bf3d8ef66c953931f56617f423cd4b5494be343d9b9d3dda037b9a3\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/unit-prefix/0.5.2/download\"],\n strip_prefix = \"unit-prefix-0.5.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.unit-prefix-0.5.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__utf8parse-0.2.2\",\n sha256 = \"06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/utf8parse/0.2.2/download\"],\n strip_prefix = \"utf8parse-0.2.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.utf8parse-0.2.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__version_check-0.9.5\",\n sha256 = \"0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/version_check/0.9.5/download\"],\n strip_prefix = \"version_check-0.9.5\",\n build_file = Label(\"@crates_std//crates_std:BUILD.version_check-0.9.5.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__wasi-0.11.1-wasi-snapshot-preview1\",\n sha256 = \"ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/wasi/0.11.1+wasi-snapshot-preview1/download\"],\n strip_prefix = \"wasi-0.11.1+wasi-snapshot-preview1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.wasi-0.11.1+wasi-snapshot-preview1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__wasm-bindgen-0.2.127\",\n sha256 = \"1b70935747edd64d89de3efa29d73789b806c15798f8e7dca4d8ac356b50ce70\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/wasm-bindgen/0.2.127/download\"],\n strip_prefix = \"wasm-bindgen-0.2.127\",\n build_file = Label(\"@crates_std//crates_std:BUILD.wasm-bindgen-0.2.127.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__wasm-bindgen-macro-0.2.127\",\n sha256 = \"77775f8f3f7217702089053b94958f8f54061a3f663417df76e19cbdcca29bc1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/wasm-bindgen-macro/0.2.127/download\"],\n strip_prefix = \"wasm-bindgen-macro-0.2.127\",\n build_file = Label(\"@crates_std//crates_std:BUILD.wasm-bindgen-macro-0.2.127.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__wasm-bindgen-macro-support-0.2.127\",\n sha256 = \"e11d33f857dc2fb11b8bc75aee111aa9cbeb12cd9f25efd3d4c2a3dd4e235284\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/wasm-bindgen-macro-support/0.2.127/download\"],\n strip_prefix = \"wasm-bindgen-macro-support-0.2.127\",\n build_file = Label(\"@crates_std//crates_std:BUILD.wasm-bindgen-macro-support-0.2.127.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__wasm-bindgen-shared-0.2.127\",\n sha256 = \"7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/wasm-bindgen-shared/0.2.127/download\"],\n strip_prefix = \"wasm-bindgen-shared-0.2.127\",\n build_file = Label(\"@crates_std//crates_std:BUILD.wasm-bindgen-shared-0.2.127.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__web-time-1.1.0\",\n sha256 = \"5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/web-time/1.1.0/download\"],\n strip_prefix = \"web-time-1.1.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.web-time-1.1.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__windows-link-0.2.1\",\n sha256 = \"f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows-link/0.2.1/download\"],\n strip_prefix = \"windows-link-0.2.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.windows-link-0.2.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__windows-sys-0.61.2\",\n sha256 = \"ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/windows-sys/0.61.2/download\"],\n strip_prefix = \"windows-sys-0.61.2\",\n build_file = Label(\"@crates_std//crates_std:BUILD.windows-sys-0.61.2.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__winnow-1.0.4\",\n sha256 = \"23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/winnow/1.0.4/download\"],\n strip_prefix = \"winnow-1.0.4\",\n build_file = Label(\"@crates_std//crates_std:BUILD.winnow-1.0.4.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__yansi-0.5.1\",\n sha256 = \"09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/yansi/0.5.1/download\"],\n strip_prefix = \"yansi-0.5.1\",\n build_file = Label(\"@crates_std//crates_std:BUILD.yansi-0.5.1.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zerocopy-0.8.56\",\n sha256 = \"556764e583adb45a9f8d413c2a147fa7e8d821e48e12b14fd560b607998b75eb\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zerocopy/0.8.56/download\"],\n strip_prefix = \"zerocopy-0.8.56\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zerocopy-0.8.56.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zerocopy-derive-0.8.56\",\n sha256 = \"f2ab42fc20575779bd240faa45f94a74256f755c0fa9e89f0ede20d91d0cdfc1\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zerocopy-derive/0.8.56/download\"],\n strip_prefix = \"zerocopy-derive-0.8.56\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zerocopy-derive-0.8.56.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zeroize-1.9.0\",\n sha256 = \"e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zeroize/1.9.0/download\"],\n strip_prefix = \"zeroize-1.9.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zeroize-1.9.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zeroize_derive-1.5.0\",\n sha256 = \"3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zeroize_derive/1.5.0/download\"],\n strip_prefix = \"zeroize_derive-1.5.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zeroize_derive-1.5.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zmij-1.0.23\",\n sha256 = \"29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zmij/1.0.23/download\"],\n strip_prefix = \"zmij-1.0.23\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zmij-1.0.23.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zngur-0.10.0\",\n sha256 = \"7fc912d12934b4d04aabc52c14db6fc88ae8aa5a47902f27e8759c2de254723f\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zngur/0.10.0/download\"],\n strip_prefix = \"zngur-0.10.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zngur-0.10.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zngur-def-0.10.0\",\n sha256 = \"8f27e49a62db537cea43a6c122ded7eda99c4ac0ca1d7cfd74f2bf6a6c88712d\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zngur-def/0.10.0/download\"],\n strip_prefix = \"zngur-def-0.10.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zngur-def-0.10.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zngur-generator-0.10.0\",\n sha256 = \"5ffad8c6994c477023aba7613bdf17c470003bbd191846d3096e84ffecf86d4c\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zngur-generator/0.10.0/download\"],\n strip_prefix = \"zngur-generator-0.10.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zngur-generator-0.10.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zngur-lib-0.10.0\",\n sha256 = \"274b03b81aaacc390756142ab5ffceb29a1c54817af1dfb265666a31b4cfb116\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zngur-lib/0.10.0/download\"],\n strip_prefix = \"zngur-lib-0.10.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zngur-lib-0.10.0.bazel\"),\n )\n\n maybe(\n http_archive,\n name = \"crates_std__zngur-parser-0.10.0\",\n sha256 = \"8d66c1b85ca6eab9576df5de31758cb1f9046b4ce47b25f45dabcb0fc7ef8789\",\n type = \"tar.gz\",\n urls = [\"https://static.crates.io/crates/zngur-parser/0.10.0/download\"],\n strip_prefix = \"zngur-parser-0.10.0\",\n build_file = Label(\"@crates_std//crates_std:BUILD.zngur-parser-0.10.0.bazel\"),\n )\n\n return [\n struct(repo=\"crates_std__anyhow-1.0.104\", is_dev_dep = False),\n struct(repo=\"crates_std__bitfield-struct-0.13.0\", is_dev_dep = False),\n struct(repo=\"crates_std__bitflags-2.13.1\", is_dev_dep = False),\n struct(repo=\"crates_std__byteorder-1.5.0\", is_dev_dep = False),\n struct(repo=\"crates_std__clap-4.6.6\", is_dev_dep = False),\n struct(repo=\"crates_std__cliclack-0.5.6\", is_dev_dep = False),\n struct(repo=\"crates_std__futures-0.3.34\", is_dev_dep = False),\n struct(repo=\"crates_std__hex-0.4.3\", is_dev_dep = False),\n struct(repo=\"crates_std__libc-0.2.189\", is_dev_dep = False),\n struct(repo=\"crates_std__minijinja-2.24.0\", is_dev_dep = False),\n struct(repo=\"crates_std__nix-0.31.3\", is_dev_dep = False),\n struct(repo=\"crates_std__nom-8.0.0\", is_dev_dep = False),\n struct(repo=\"crates_std__object-0.40.0\", is_dev_dep = False),\n struct(repo=\"crates_std__paste-1.0.15\", is_dev_dep = False),\n struct(repo=\"crates_std__proc-macro2-1.0.107\", is_dev_dep = False),\n struct(repo=\"crates_std__prost-0.14.4\", is_dev_dep = False),\n struct(repo=\"crates_std__prost-reflect-0.16.5\", is_dev_dep = False),\n struct(repo=\"crates_std__prost-types-0.14.4\", is_dev_dep = False),\n struct(repo=\"crates_std__protoc-gen-prost-0.5.0\", is_dev_dep = False),\n struct(repo=\"crates_std__quote-1.0.47\", is_dev_dep = False),\n struct(repo=\"crates_std__rustc-demangle-0.1.28\", is_dev_dep = False),\n struct(repo=\"crates_std__serde-1.0.229\", is_dev_dep = False),\n struct(repo=\"crates_std__serde_json-1.0.151\", is_dev_dep = False),\n struct(repo=\"crates_std__serde_json5-0.2.1\", is_dev_dep = False),\n struct(repo=\"crates_std__syn-3.0.4\", is_dev_dep = False),\n struct(repo=\"crates_std__thiserror-2.0.20\", is_dev_dep = False),\n struct(repo=\"crates_std__tokio-1.53.1\", is_dev_dep = False),\n struct(repo=\"crates_std__tokio-util-0.7.19\", is_dev_dep = False),\n struct(repo=\"crates_std__toml-1.1.4-spec-1.1.0\", is_dev_dep = False),\n struct(repo=\"crates_std__zerocopy-0.8.56\", is_dev_dep = False),\n struct(repo=\"crates_std__zngur-0.10.0\", is_dev_dep = False),\n struct(repo=\"crates_std__zngur-lib-0.10.0\", is_dev_dep = False),\n ]\n" } } }, @@ -7462,20 +7212,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"adler2\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=adler2\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.0.1\",\n)\n" } }, - "crates_std__aho-corasick-1.1.4": { + "crates_std__aho-corasick-1.1.5": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301", + "sha256": "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/aho-corasick/1.1.4/download" + "https://static.crates.io/crates/aho-corasick/1.1.5/download" ], - "strip_prefix": "aho-corasick-1.1.4", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"aho_corasick\",\n deps = [\n \"@crates_std__memchr-2.8.3//:memchr\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"perf-literal\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=aho-corasick\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.1.4\",\n)\n" + "strip_prefix": "aho-corasick-1.1.5", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"aho_corasick\",\n deps = [\n \"@crates_std__memchr-2.8.3//:memchr\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"perf-literal\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=aho-corasick\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.1.5\",\n)\n" } }, "crates_std__allocator-api2-0.2.21": { @@ -7590,20 +7340,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"anyhow\",\n deps = [\n \"@crates_std__anyhow-1.0.104//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=anyhow\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.0.104\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"std\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"anyhow\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=anyhow\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"1.0.104\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, - "crates_std__ar_archive_writer-0.5.2": { + "crates_std__ar_archive_writer-0.5.3": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "4087686b4b0a3427190bae57a1d9a478dbb2d40c5dc1bd6e2b6d797913bdd348", + "sha256": "73cd58deff2140a0a8eae87e417bd01db68a33e148aa93d1e8cd837e55e312b6", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/ar_archive_writer/0.5.2/download" + "https://static.crates.io/crates/ar_archive_writer/0.5.3/download" ], - "strip_prefix": "ar_archive_writer-0.5.2", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"ar_archive_writer\",\n deps = [\n \"@crates_std__object-0.37.3//:object\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=ar_archive_writer\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.5.2\",\n)\n" + "strip_prefix": "ar_archive_writer-0.5.3", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"ar_archive_writer\",\n deps = [\n \"@crates_std__object-0.39.1//:object\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=ar_archive_writer\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.5.3\",\n)\n" } }, "crates_std__ariadne-0.3.0": { @@ -7718,20 +7468,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"basic_toml\",\n deps = [\n \"@crates_std__serde-1.0.229//:serde\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=basic-toml\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.1.10\",\n)\n" } }, - "crates_std__bitfield-struct-0.12.1": { + "crates_std__bitfield-struct-0.13.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "8769c4854c5ada2852ddf6fd09d15cf43d4c2aaeccb4de6432f5402f08a6003b", + "sha256": "3ca6739863c590881f038d033a146c51ddae239186a4327014839fd864f44ed5", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/bitfield-struct/0.12.1/download" + "https://static.crates.io/crates/bitfield-struct/0.13.0/download" ], - "strip_prefix": "bitfield-struct-0.12.1", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"bitfield_struct\",\n deps = [\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=bitfield-struct\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.12.1\",\n)\n" + "strip_prefix": "bitfield-struct-0.13.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"bitfield_struct\",\n deps = [\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=bitfield-struct\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.13.0\",\n)\n" } }, "crates_std__bitflags-2.13.1": { @@ -7814,20 +7564,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"bytes\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=bytes\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.12.1\",\n)\n" } }, - "crates_std__cc-1.4.0": { + "crates_std__cc-1.4.4": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "5add81bb678e6cb321aff7fa0dc7689ad82b112dbc032cea19f91d6b8e3582b9", + "sha256": "0ad534f4357a5264cce5019c989cf66a4f0dc4e0d1b1d15f8aacec0ff7360273", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/cc/1.4.0/download" + "https://static.crates.io/crates/cc/1.4.4/download" ], - "strip_prefix": "cc-1.4.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"cc\",\n deps = [\n \"@crates_std__find-msvc-tools-0.1.9//:find_msvc_tools\",\n \"@crates_std__shlex-2.0.1//:shlex\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cc\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.4.0\",\n)\n" + "strip_prefix": "cc-1.4.4", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"cc\",\n deps = [\n \"@crates_std__find-msvc-tools-0.1.11//:find_msvc_tools\",\n \"@crates_std__shlex-2.0.1//:shlex\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cc\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.4.4\",\n)\n" } }, "crates_std__cfg-if-1.0.4": { @@ -7875,39 +7625,39 @@ "https://static.crates.io/crates/chumsky/1.0.0-alpha.8/download" ], "strip_prefix": "chumsky-1.0.0-alpha.8", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"chumsky\",\n deps = [\n \"@crates_std__chumsky-1.0.0-alpha.8//:build_script_build\",\n \"@crates_std__hashbrown-0.15.5//:hashbrown\",\n \"@crates_std__stacker-0.1.24//:stacker\",\n \"@crates_std__unicode-ident-1.0.24//:unicode_ident\",\n \"@crates_std__unicode-segmentation-1.13.3//:unicode_segmentation\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"stacker\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=chumsky\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.0.0-alpha.8\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"stacker\",\n \"std\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"chumsky\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=chumsky\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"1.0.0-alpha.8\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"chumsky\",\n deps = [\n \"@crates_std__chumsky-1.0.0-alpha.8//:build_script_build\",\n \"@crates_std__hashbrown-0.15.5//:hashbrown\",\n \"@crates_std__stacker-0.1.25//:stacker\",\n \"@crates_std__unicode-ident-1.0.24//:unicode_ident\",\n \"@crates_std__unicode-segmentation-1.13.3//:unicode_segmentation\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"stacker\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=chumsky\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.0.0-alpha.8\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"stacker\",\n \"std\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"chumsky\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=chumsky\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"1.0.0-alpha.8\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, - "crates_std__clap-4.6.4": { + "crates_std__clap-4.6.6": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "d91e0c145792ef73a6ad36d27c75ac09f1832222a3c209689d90f534685ee5b7", + "sha256": "473c7e07f409a8d772161724aa8db6a765a2532a70f9667eeb7b49d3d02fbdca", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/clap/4.6.4/download" + "https://static.crates.io/crates/clap/4.6.6/download" ], - "strip_prefix": "clap-4.6.4", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"clap\",\n deps = [\n \"@crates_std__clap_builder-4.6.2//:clap_builder\",\n ],\n proc_macro_deps = [\n \"@crates_std__clap_derive-4.6.4//:clap_derive\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"color\",\n \"default\",\n \"derive\",\n \"error-context\",\n \"help\",\n \"std\",\n \"suggestions\",\n \"usage\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=clap\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"4.6.4\",\n)\n" + "strip_prefix": "clap-4.6.6", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"clap\",\n deps = [\n \"@crates_std__clap_builder-4.6.6//:clap_builder\",\n ],\n proc_macro_deps = [\n \"@crates_std__clap_derive-4.6.4//:clap_derive\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"color\",\n \"default\",\n \"derive\",\n \"error-context\",\n \"help\",\n \"std\",\n \"suggestions\",\n \"usage\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=clap\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"4.6.6\",\n)\n" } }, - "crates_std__clap_builder-4.6.2": { + "crates_std__clap_builder-4.6.6": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "f09628afdcc538b57f3c6341e9c8e9970f18e4a481690a64974d7023bd33548b", + "sha256": "7b48fea5a88e9ae728a2dcbedbfc0e730f7d60da42e1cb049a83c9fb8b789889", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/clap_builder/4.6.2/download" + "https://static.crates.io/crates/clap_builder/4.6.6/download" ], - "strip_prefix": "clap_builder-4.6.2", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"clap_builder\",\n deps = [\n \"@crates_std__anstream-1.0.0//:anstream\",\n \"@crates_std__anstyle-1.0.14//:anstyle\",\n \"@crates_std__clap_lex-1.1.0//:clap_lex\",\n \"@crates_std__strsim-0.11.1//:strsim\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"color\",\n \"error-context\",\n \"help\",\n \"std\",\n \"suggestions\",\n \"usage\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=clap_builder\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"4.6.2\",\n)\n" + "strip_prefix": "clap_builder-4.6.6", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"clap_builder\",\n deps = [\n \"@crates_std__anstream-1.0.0//:anstream\",\n \"@crates_std__anstyle-1.0.14//:anstyle\",\n \"@crates_std__clap_lex-1.1.0//:clap_lex\",\n \"@crates_std__strsim-0.11.1//:strsim\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"color\",\n \"error-context\",\n \"help\",\n \"std\",\n \"suggestions\",\n \"usage\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=clap_builder\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"4.6.6\",\n)\n" } }, "crates_std__clap_derive-4.6.4": { @@ -7923,7 +7673,7 @@ "https://static.crates.io/crates/clap_derive/4.6.4/download" ], "strip_prefix": "clap_derive-4.6.4", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"clap_derive\",\n deps = [\n \"@crates_std__heck-0.5.0//:heck\",\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__syn-3.0.3//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=clap_derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"4.6.4\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"clap_derive\",\n deps = [\n \"@crates_std__heck-0.5.0//:heck\",\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__syn-3.0.4//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=clap_derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"4.6.4\",\n)\n" } }, "crates_std__clap_lex-1.1.0": { @@ -7942,20 +7692,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"clap_lex\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=clap_lex\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.1.0\",\n)\n" } }, - "crates_std__cliclack-0.3.8": { + "crates_std__cliclack-0.5.6": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "aa510b739c618c679375ea9c5af44ce9f591289546e874ad5910e7ce7df79844", + "sha256": "134778b6a125729ff495c23ba32f64e0c26d61edd52f1f6715a0d036785cf30b", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/cliclack/0.3.8/download" + "https://static.crates.io/crates/cliclack/0.5.6/download" ], - "strip_prefix": "cliclack-0.3.8", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"cliclack\",\n deps = [\n \"@crates_std__console-0.15.11//:console\",\n \"@crates_std__indicatif-0.18.6//:indicatif\",\n \"@crates_std__once_cell-1.21.4//:once_cell\",\n \"@crates_std__strsim-0.11.1//:strsim\",\n \"@crates_std__textwrap-0.16.2//:textwrap\",\n \"@crates_std__zeroize-1.9.0//:zeroize\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cliclack\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.8\",\n)\n" + "strip_prefix": "cliclack-0.5.6", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"cliclack\",\n deps = [\n \"@crates_std__console-0.16.4//:console\",\n \"@crates_std__indicatif-0.18.6//:indicatif\",\n \"@crates_std__once_cell-1.21.4//:once_cell\",\n \"@crates_std__strsim-0.11.1//:strsim\",\n \"@crates_std__textwrap-0.16.2//:textwrap\",\n \"@crates_std__zeroize-1.9.0//:zeroize\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cliclack\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.5.6\",\n)\n" } }, "crates_std__colorchoice-1.0.5": { @@ -7974,22 +7724,6 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"colorchoice\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=colorchoice\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.0.5\",\n)\n" } }, - "crates_std__console-0.15.11": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "patch_args": [], - "patch_tool": "", - "patches": [], - "remote_patch_strip": 1, - "sha256": "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8", - "type": "tar.gz", - "urls": [ - "https://static.crates.io/crates/console/0.15.11/download" - ], - "strip_prefix": "console-0.15.11", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"console\",\n deps = [\n \"@crates_std__libc-0.2.189//:libc\",\n \"@crates_std__once_cell-1.21.4//:once_cell\",\n \"@crates_std__unicode-width-0.2.2//:unicode_width\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"ansi-parsing\",\n \"default\",\n \"unicode-width\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=console\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.15.11\",\n)\n" - } - }, "crates_std__console-0.16.4": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { @@ -8003,7 +7737,7 @@ "https://static.crates.io/crates/console/0.16.4/download" ], "strip_prefix": "console-0.16.4", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"console\",\n deps = [\n \"@crates_std__libc-0.2.189//:libc\",\n \"@crates_std__unicode-width-0.2.2//:unicode_width\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"ansi-parsing\",\n \"std\",\n \"unicode-width\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=console\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.16.4\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"console\",\n deps = [\n \"@crates_std__libc-0.2.189//:libc\",\n \"@crates_std__unicode-width-0.2.2//:unicode_width\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"ansi-parsing\",\n \"default\",\n \"std\",\n \"unicode-width\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=console\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.16.4\",\n)\n" } }, "crates_std__cpufeatures-0.2.17": { @@ -8022,20 +7756,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"cpufeatures\",\n deps = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [\n \"@crates_std__libc-0.2.189//:libc\", # cfg(all(target_arch = \"aarch64\", target_vendor = \"apple\"))\n ],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [\n \"@crates_std__libc-0.2.189//:libc\", # cfg(all(target_arch = \"aarch64\", target_os = \"linux\"))\n ],\n \"//conditions:default\": [],\n }),\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=cpufeatures\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.17\",\n)\n" } }, - "crates_std__crc32fast-1.5.0": { + "crates_std__crc32fast-1.5.1": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511", + "sha256": "8498c871161e1742aaa9d52551b2d6ebdd4c3d45a3be423e3728f33b955be550", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/crc32fast/1.5.0/download" + "https://static.crates.io/crates/crc32fast/1.5.1/download" ], - "strip_prefix": "crc32fast-1.5.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"crc32fast\",\n deps = [\n \"@crates_std__cfg-if-1.0.4//:cfg_if\",\n \"@crates_std__crc32fast-1.5.0//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=crc32fast\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.5.0\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"std\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"crc32fast\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=crc32fast\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"1.5.0\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "strip_prefix": "crc32fast-1.5.1", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"crc32fast\",\n deps = [\n \"@crates_std__cfg-if-1.0.4//:cfg_if\",\n \"@crates_std__crc32fast-1.5.1//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=crc32fast\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.5.1\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"std\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"crc32fast\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=crc32fast\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"1.5.1\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, "crates_std__crypto-common-0.1.7": { @@ -8070,20 +7804,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"digest\",\n deps = [\n \"@crates_std__block-buffer-0.10.4//:block_buffer\",\n \"@crates_std__crypto-common-0.1.7//:crypto_common\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"block-buffer\",\n \"core-api\",\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=digest\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.10.7\",\n)\n" } }, - "crates_std__either-1.17.0": { + "crates_std__either-1.18.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "9e5e8f6c15a24b9a3ee5efec809ccd006d3b30e8b3bb63c39af737c7f87daa1d", + "sha256": "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/either/1.17.0/download" + "https://static.crates.io/crates/either/1.18.0/download" ], - "strip_prefix": "either-1.17.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"either\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"std\",\n \"use_std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=either\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.17.0\",\n)\n" + "strip_prefix": "either-1.18.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"either\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"std\",\n \"use_std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=either\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.18.0\",\n)\n" } }, "crates_std__encode_unicode-1.0.0": { @@ -8150,20 +7884,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"fastrand\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=fastrand\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.5.0\",\n)\n" } }, - "crates_std__find-msvc-tools-0.1.9": { + "crates_std__find-msvc-tools-0.1.11": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582", + "sha256": "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/find-msvc-tools/0.1.9/download" + "https://static.crates.io/crates/find-msvc-tools/0.1.11/download" ], - "strip_prefix": "find-msvc-tools-0.1.9", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"find_msvc_tools\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=find-msvc-tools\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.1.9\",\n)\n" + "strip_prefix": "find-msvc-tools-0.1.11", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"find_msvc_tools\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=find-msvc-tools\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.1.11\",\n)\n" } }, "crates_std__fixedbitset-0.5.7": { @@ -8195,7 +7929,7 @@ "https://static.crates.io/crates/flate2/1.1.9/download" ], "strip_prefix": "flate2-1.1.9", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"flate2\",\n deps = [\n \"@crates_std__crc32fast-1.5.0//:crc32fast\",\n \"@crates_std__miniz_oxide-0.8.9//:miniz_oxide\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"any_impl\",\n \"default\",\n \"miniz_oxide\",\n \"rust_backend\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=flate2\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.1.9\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"flate2\",\n deps = [\n \"@crates_std__crc32fast-1.5.1//:crc32fast\",\n \"@crates_std__miniz_oxide-0.8.9//:miniz_oxide\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"any_impl\",\n \"default\",\n \"miniz_oxide\",\n \"rust_backend\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=flate2\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.1.9\",\n)\n" } }, "crates_std__fnv-1.0.7": { @@ -8230,148 +7964,164 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"foldhash\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=foldhash\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.1.5\",\n)\n" } }, - "crates_std__futures-0.3.33": { + "crates_std__foldhash-0.2.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "a88cf1f829d945f548cf8fec32c61b1f202b6d93b45848602fc02af4b12ad218", + "sha256": "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/futures/0.3.33/download" + "https://static.crates.io/crates/foldhash/0.2.0/download" ], - "strip_prefix": "futures-0.3.33", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"futures\",\n deps = [\n \"@crates_std__futures-channel-0.3.33//:futures_channel\",\n \"@crates_std__futures-core-0.3.33//:futures_core\",\n \"@crates_std__futures-executor-0.3.33//:futures_executor\",\n \"@crates_std__futures-io-0.3.33//:futures_io\",\n \"@crates_std__futures-sink-0.3.33//:futures_sink\",\n \"@crates_std__futures-task-0.3.33//:futures_task\",\n \"@crates_std__futures-util-0.3.33//:futures_util\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"async-await\",\n \"default\",\n \"executor\",\n \"futures-executor\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.33\",\n)\n" + "strip_prefix": "foldhash-0.2.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"foldhash\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=foldhash\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.0\",\n)\n" } }, - "crates_std__futures-channel-0.3.33": { + "crates_std__futures-0.3.34": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "262590f4fe6afeb0bc83be1daa64e52657fe185690a958af7f3ad0e92085c5ae", + "sha256": "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/futures-channel/0.3.33/download" + "https://static.crates.io/crates/futures/0.3.34/download" ], - "strip_prefix": "futures-channel-0.3.33", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"futures_channel\",\n deps = [\n \"@crates_std__futures-core-0.3.33//:futures_core\",\n \"@crates_std__futures-sink-0.3.33//:futures_sink\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"futures-sink\",\n \"sink\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures-channel\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.33\",\n)\n" + "strip_prefix": "futures-0.3.34", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"futures\",\n deps = [\n \"@crates_std__futures-channel-0.3.34//:futures_channel\",\n \"@crates_std__futures-core-0.3.34//:futures_core\",\n \"@crates_std__futures-executor-0.3.34//:futures_executor\",\n \"@crates_std__futures-io-0.3.34//:futures_io\",\n \"@crates_std__futures-sink-0.3.34//:futures_sink\",\n \"@crates_std__futures-task-0.3.34//:futures_task\",\n \"@crates_std__futures-util-0.3.34//:futures_util\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"async-await\",\n \"default\",\n \"executor\",\n \"futures-executor\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.34\",\n)\n" } }, - "crates_std__futures-core-0.3.33": { + "crates_std__futures-channel-0.3.34": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "2cd50c473c80f6d7c3670a752354b8e569b1a7cbfdc0419ec88e5edad85e0dc7", + "sha256": "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/futures-core/0.3.33/download" + "https://static.crates.io/crates/futures-channel/0.3.34/download" ], - "strip_prefix": "futures-core-0.3.33", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"futures_core\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures-core\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.33\",\n)\n" + "strip_prefix": "futures-channel-0.3.34", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"futures_channel\",\n deps = [\n \"@crates_std__futures-core-0.3.34//:futures_core\",\n \"@crates_std__futures-sink-0.3.34//:futures_sink\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"futures-sink\",\n \"sink\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures-channel\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.34\",\n)\n" } }, - "crates_std__futures-executor-0.3.33": { + "crates_std__futures-core-0.3.34": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "6754879cc9f2c66f88c6e5c35344bb0bdb0708b0352b1201815667c7eabc7458", + "sha256": "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/futures-executor/0.3.33/download" + "https://static.crates.io/crates/futures-core/0.3.34/download" ], - "strip_prefix": "futures-executor-0.3.33", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"futures_executor\",\n deps = [\n \"@crates_std__futures-core-0.3.33//:futures_core\",\n \"@crates_std__futures-task-0.3.33//:futures_task\",\n \"@crates_std__futures-util-0.3.33//:futures_util\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures-executor\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.33\",\n)\n" + "strip_prefix": "futures-core-0.3.34", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"futures_core\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures-core\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.34\",\n)\n" } }, - "crates_std__futures-io-0.3.33": { + "crates_std__futures-executor-0.3.34": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "4577ecaa3c4f96589d473f679a71b596316f6641bc350038b962a5daf0085d7a", + "sha256": "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/futures-io/0.3.33/download" + "https://static.crates.io/crates/futures-executor/0.3.34/download" ], - "strip_prefix": "futures-io-0.3.33", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"futures_io\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures-io\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.33\",\n)\n" + "strip_prefix": "futures-executor-0.3.34", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"futures_executor\",\n deps = [\n \"@crates_std__futures-core-0.3.34//:futures_core\",\n \"@crates_std__futures-task-0.3.34//:futures_task\",\n \"@crates_std__futures-util-0.3.34//:futures_util\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures-executor\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.34\",\n)\n" } }, - "crates_std__futures-macro-0.3.33": { + "crates_std__futures-io-0.3.34": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "2d6d3cde68c518367be28956066ddfef33813991b77a55005a69dae04bf3b10b", + "sha256": "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/futures-macro/0.3.33/download" + "https://static.crates.io/crates/futures-io/0.3.34/download" ], - "strip_prefix": "futures-macro-0.3.33", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"futures_macro\",\n deps = [\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures-macro\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.33\",\n)\n" + "strip_prefix": "futures-io-0.3.34", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"futures_io\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures-io\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.34\",\n)\n" } }, - "crates_std__futures-sink-0.3.33": { + "crates_std__futures-macro-0.3.34": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "e34418ac499d6305c2fb5ad0ed2f6ac998c5f8ca209b4510f7f94242c647e307", + "sha256": "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/futures-sink/0.3.33/download" + "https://static.crates.io/crates/futures-macro/0.3.34/download" ], - "strip_prefix": "futures-sink-0.3.33", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"futures_sink\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures-sink\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.33\",\n)\n" + "strip_prefix": "futures-macro-0.3.34", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"futures_macro\",\n deps = [\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__syn-3.0.4//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures-macro\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.34\",\n)\n" } }, - "crates_std__futures-task-0.3.33": { + "crates_std__futures-sink-0.3.34": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "b231ed28831efb4a61a08580c4bc233ec56bc009f4cd8f52da2c3cb97df0c109", + "sha256": "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/futures-task/0.3.33/download" + "https://static.crates.io/crates/futures-sink/0.3.34/download" ], - "strip_prefix": "futures-task-0.3.33", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"futures_task\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures-task\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.33\",\n)\n" + "strip_prefix": "futures-sink-0.3.34", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"futures_sink\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures-sink\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.34\",\n)\n" } }, - "crates_std__futures-util-0.3.33": { + "crates_std__futures-task-0.3.34": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "a77a90a256fce34da66415271e30f94ee91c57b04b8a2c042d9cf3220179deaa", + "sha256": "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/futures-util/0.3.33/download" + "https://static.crates.io/crates/futures-task/0.3.34/download" ], - "strip_prefix": "futures-util-0.3.33", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"futures_util\",\n deps = [\n \"@crates_std__futures-channel-0.3.33//:futures_channel\",\n \"@crates_std__futures-core-0.3.33//:futures_core\",\n \"@crates_std__futures-io-0.3.33//:futures_io\",\n \"@crates_std__futures-sink-0.3.33//:futures_sink\",\n \"@crates_std__futures-task-0.3.33//:futures_task\",\n \"@crates_std__memchr-2.8.3//:memchr\",\n \"@crates_std__pin-project-lite-0.2.17//:pin_project_lite\",\n \"@crates_std__slab-0.4.12//:slab\",\n ],\n proc_macro_deps = [\n \"@crates_std__futures-macro-0.3.33//:futures_macro\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"async-await\",\n \"async-await-macro\",\n \"channel\",\n \"futures-channel\",\n \"futures-io\",\n \"futures-macro\",\n \"futures-sink\",\n \"io\",\n \"memchr\",\n \"sink\",\n \"slab\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures-util\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.33\",\n)\n" + "strip_prefix": "futures-task-0.3.34", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"futures_task\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures-task\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.34\",\n)\n" + } + }, + "crates_std__futures-util-0.3.34": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "patch_args": [], + "patch_tool": "", + "patches": [], + "remote_patch_strip": 1, + "sha256": "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/futures-util/0.3.34/download" + ], + "strip_prefix": "futures-util-0.3.34", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"futures_util\",\n deps = [\n \"@crates_std__futures-channel-0.3.34//:futures_channel\",\n \"@crates_std__futures-core-0.3.34//:futures_core\",\n \"@crates_std__futures-io-0.3.34//:futures_io\",\n \"@crates_std__futures-sink-0.3.34//:futures_sink\",\n \"@crates_std__futures-task-0.3.34//:futures_task\",\n \"@crates_std__memchr-2.8.3//:memchr\",\n \"@crates_std__pin-project-lite-0.2.17//:pin_project_lite\",\n \"@crates_std__slab-0.4.12//:slab\",\n ],\n proc_macro_deps = [\n \"@crates_std__futures-macro-0.3.34//:futures_macro\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"async-await\",\n \"async-await-macro\",\n \"channel\",\n \"futures-channel\",\n \"futures-io\",\n \"futures-macro\",\n \"futures-sink\",\n \"io\",\n \"memchr\",\n \"sink\",\n \"slab\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=futures-util\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.34\",\n)\n" } }, "crates_std__generic-array-0.14.7": { @@ -8419,23 +8169,7 @@ "https://static.crates.io/crates/hashbrown/0.17.1/download" ], "strip_prefix": "hashbrown-0.17.1", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"hashbrown\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=hashbrown\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.17.1\",\n)\n" - } - }, - "crates_std__hashlink-0.10.0": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "patch_args": [], - "patch_tool": "", - "patches": [], - "remote_patch_strip": 1, - "sha256": "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1", - "type": "tar.gz", - "urls": [ - "https://static.crates.io/crates/hashlink/0.10.0/download" - ], - "strip_prefix": "hashlink-0.10.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"hashlink\",\n deps = [\n \"@crates_std__hashbrown-0.15.5//:hashbrown\",\n \"@crates_std__serde-1.0.229//:serde\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"serde\",\n \"serde_impl\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=hashlink\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.10.0\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"hashbrown\",\n deps = [\n \"@crates_std__foldhash-0.2.0//:foldhash\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default-hasher\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=hashbrown\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.17.1\",\n)\n" } }, "crates_std__heck-0.5.0": { @@ -8515,7 +8249,7 @@ "https://static.crates.io/crates/indicatif/0.18.6/download" ], "strip_prefix": "indicatif-0.18.6", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"indicatif\",\n deps = [\n \"@crates_std__console-0.16.4//:console\",\n \"@crates_std__portable-atomic-1.14.0//:portable_atomic\",\n \"@crates_std__unicode-width-0.2.2//:unicode_width\",\n \"@crates_std__unit-prefix-0.5.2//:unit_prefix\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"unicode-width\",\n \"wasmbind\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=indicatif\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.18.6\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"indicatif\",\n deps = [\n \"@crates_std__console-0.16.4//:console\",\n \"@crates_std__portable-atomic-1.15.0//:portable_atomic\",\n \"@crates_std__unicode-width-0.2.2//:unicode_width\",\n \"@crates_std__unit-prefix-0.5.2//:unit_prefix\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"unicode-width\",\n \"wasmbind\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=indicatif\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.18.6\",\n)\n" } }, "crates_std__is_terminal_polyfill-1.70.2": { @@ -8547,7 +8281,7 @@ "https://static.crates.io/crates/itertools/0.11.0/download" ], "strip_prefix": "itertools-0.11.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"itertools\",\n deps = [\n \"@crates_std__either-1.17.0//:either\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"use_alloc\",\n \"use_std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=itertools\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.11.0\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"itertools\",\n deps = [\n \"@crates_std__either-1.18.0//:either\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"use_alloc\",\n \"use_std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=itertools\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.11.0\",\n)\n" } }, "crates_std__itertools-0.14.0": { @@ -8563,7 +8297,7 @@ "https://static.crates.io/crates/itertools/0.14.0/download" ], "strip_prefix": "itertools-0.14.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"itertools\",\n deps = [\n \"@crates_std__either-1.17.0//:either\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"use_alloc\",\n \"use_std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=itertools\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.14.0\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"itertools\",\n deps = [\n \"@crates_std__either-1.18.0//:either\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"use_alloc\",\n \"use_std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=itertools\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.14.0\",\n)\n" } }, "crates_std__itoa-1.0.18": { @@ -8582,20 +8316,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"itoa\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=itoa\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.0.18\",\n)\n" } }, - "crates_std__js-sys-0.3.103": { + "crates_std__js-sys-0.3.104": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102", + "sha256": "0e0c1080212aad755ea003d18543e8768dd432c48819efd73a7bf1e39b7a5a3a", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/js-sys/0.3.103/download" + "https://static.crates.io/crates/js-sys/0.3.104/download" ], - "strip_prefix": "js-sys-0.3.103", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"js_sys\",\n deps = [\n \"@crates_std__cfg-if-1.0.4//:cfg_if\",\n \"@crates_std__wasm-bindgen-0.2.126//:wasm_bindgen\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=js-sys\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.103\",\n)\n" + "strip_prefix": "js-sys-0.3.104", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"js_sys\",\n deps = [\n \"@crates_std__cfg-if-1.0.4//:cfg_if\",\n \"@crates_std__wasm-bindgen-0.2.127//:wasm_bindgen\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=js-sys\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.104\",\n)\n" } }, "crates_std__libc-0.2.189": { @@ -8662,20 +8396,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"lock_api\",\n deps = [\n \"@crates_std__scopeguard-1.2.0//:scopeguard\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"atomic_usize\",\n \"default\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=lock_api\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.4.14\",\n)\n" } }, - "crates_std__log-0.4.33": { + "crates_std__log-0.4.34": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad", + "sha256": "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/log/0.4.33/download" + "https://static.crates.io/crates/log/0.4.34/download" ], - "strip_prefix": "log-0.4.33", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"log\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=log\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.4.33\",\n)\n" + "strip_prefix": "log-0.4.34", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"log\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=log\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.4.34\",\n)\n" } }, "crates_std__logos-0.16.1": { @@ -8707,7 +8441,7 @@ "https://static.crates.io/crates/logos-codegen/0.16.1/download" ], "strip_prefix": "logos-codegen-0.16.1", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"logos_codegen\",\n deps = [\n \"@crates_std__fnv-1.0.7//:fnv\",\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__regex-automata-0.4.16//:regex_automata\",\n \"@crates_std__regex-syntax-0.8.11//:regex_syntax\",\n \"@crates_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=logos-codegen\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.16.1\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"logos_codegen\",\n deps = [\n \"@crates_std__fnv-1.0.7//:fnv\",\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__regex-automata-0.4.18//:regex_automata\",\n \"@crates_std__regex-syntax-0.8.11//:regex_syntax\",\n \"@crates_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=logos-codegen\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.16.1\",\n)\n" } }, "crates_std__logos-derive-0.16.1": { @@ -8790,20 +8524,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"mime_guess\",\n deps = [\n \"@crates_std__mime-0.3.17//:mime\",\n \"@crates_std__mime_guess-2.0.5//:build_script_build\",\n \"@crates_std__unicase-2.9.0//:unicase\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"rev-mappings\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2015\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=mime_guess\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.0.5\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"rev-mappings\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n deps = [\n \"@crates_std__unicase-2.9.0//:unicase\",\n ],\n edition = \"2015\",\n pkg_name = \"mime_guess\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=mime_guess\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"2.0.5\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, - "crates_std__minijinja-2.21.0": { + "crates_std__minijinja-2.24.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "cb3d648e68cea56d9858d535ee28f9538404e2dd8cb08ed0bd05dca379477f39", + "sha256": "86886cf6dbf4e614b19c9a1eec9775f021869d7eadde0fc73921a81b90c9b4c9", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/minijinja/2.21.0/download" + "https://static.crates.io/crates/minijinja/2.24.0/download" ], - "strip_prefix": "minijinja-2.21.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"minijinja\",\n deps = [\n \"@crates_std__memo-map-0.3.3//:memo_map\",\n \"@crates_std__serde-1.0.229//:serde\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"adjacent_loop_items\",\n \"builtins\",\n \"debug\",\n \"default\",\n \"deserialization\",\n \"loader\",\n \"macros\",\n \"multi_template\",\n \"serde\",\n \"std_collections\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=minijinja\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.21.0\",\n)\n" + "strip_prefix": "minijinja-2.24.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"minijinja\",\n deps = [\n \"@crates_std__memo-map-0.3.3//:memo_map\",\n \"@crates_std__serde-1.0.229//:serde\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"adjacent_loop_items\",\n \"builtins\",\n \"debug\",\n \"default\",\n \"deserialization\",\n \"loader\",\n \"macros\",\n \"multi_template\",\n \"serde\",\n \"std_collections\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=minijinja\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.24.0\",\n)\n" } }, "crates_std__minimal-lexical-0.2.1": { @@ -8819,7 +8553,7 @@ "https://static.crates.io/crates/minimal-lexical/0.2.1/download" ], "strip_prefix": "minimal-lexical-0.2.1", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"minimal_lexical\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=minimal-lexical\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.1\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"minimal_lexical\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=minimal-lexical\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.1\",\n)\n" } }, "crates_std__miniz_oxide-0.8.9": { @@ -8870,20 +8604,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"multimap\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2015\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=multimap\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.10.1\",\n)\n" } }, - "crates_std__nix-0.29.0": { + "crates_std__nix-0.31.3": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46", + "sha256": "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/nix/0.29.0/download" + "https://static.crates.io/crates/nix/0.31.3/download" ], - "strip_prefix": "nix-0.29.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"nix\",\n deps = [\n \"@crates_std__bitflags-2.13.1//:bitflags\",\n \"@crates_std__cfg-if-1.0.4//:cfg_if\",\n \"@crates_std__libc-0.2.189//:libc\",\n \"@crates_std__nix-0.29.0//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"fs\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=nix\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.29.0\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"fs\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n deps = [\n \"@crates_std__cfg_aliases-0.2.2//:cfg_aliases\",\n ],\n edition = \"2021\",\n pkg_name = \"nix\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=nix\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.29.0\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "strip_prefix": "nix-0.31.3", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"nix\",\n deps = [\n \"@crates_std__bitflags-2.13.1//:bitflags\",\n \"@crates_std__cfg-if-1.0.4//:cfg_if\",\n \"@crates_std__libc-0.2.189//:libc\",\n \"@crates_std__nix-0.31.3//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"fs\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=nix\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.31.3\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"fs\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n deps = [\n \"@crates_std__cfg_aliases-0.2.2//:cfg_aliases\",\n ],\n edition = \"2021\",\n pkg_name = \"nix\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=nix\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.31.3\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, "crates_std__nom-7.1.3": { @@ -8899,7 +8633,23 @@ "https://static.crates.io/crates/nom/7.1.3/download" ], "strip_prefix": "nom-7.1.3", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"nom\",\n deps = [\n \"@crates_std__memchr-2.8.3//:memchr\",\n \"@crates_std__minimal-lexical-0.2.1//:minimal_lexical\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=nom\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"7.1.3\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"nom\",\n deps = [\n \"@crates_std__memchr-2.8.3//:memchr\",\n \"@crates_std__minimal-lexical-0.2.1//:minimal_lexical\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=nom\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"7.1.3\",\n)\n" + } + }, + "crates_std__nom-8.0.0": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "patch_args": [], + "patch_tool": "", + "patches": [], + "remote_patch_strip": 1, + "sha256": "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/nom/8.0.0/download" + ], + "strip_prefix": "nom-8.0.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"nom\",\n deps = [\n \"@crates_std__memchr-2.8.3//:memchr\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=nom\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"8.0.0\",\n)\n" } }, "crates_std__num-traits-0.2.19": { @@ -8918,36 +8668,36 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"num_traits\",\n deps = [\n \"@crates_std__num-traits-0.2.19//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=num-traits\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.19\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"std\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n deps = [\n \"@crates_std__autocfg-1.5.1//:autocfg\",\n ],\n edition = \"2021\",\n pkg_name = \"num-traits\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=num-traits\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.2.19\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, - "crates_std__object-0.36.7": { + "crates_std__object-0.39.1": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87", + "sha256": "2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/object/0.36.7/download" + "https://static.crates.io/crates/object/0.39.1/download" ], - "strip_prefix": "object-0.36.7", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"object\",\n deps = [\n \"@crates_std__crc32fast-1.5.0//:crc32fast\",\n \"@crates_std__flate2-1.1.9//:flate2\",\n \"@crates_std__hashbrown-0.15.5//:hashbrown\",\n \"@crates_std__indexmap-2.14.0//:indexmap\",\n \"@crates_std__memchr-2.8.3//:memchr\",\n \"@crates_std__object-0.36.7//:build_script_build\",\n \"@crates_std__ruzstd-0.7.3//:ruzstd\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"archive\",\n \"build\",\n \"build_core\",\n \"coff\",\n \"compression\",\n \"default\",\n \"elf\",\n \"macho\",\n \"pe\",\n \"read\",\n \"read_core\",\n \"std\",\n \"unaligned\",\n \"write\",\n \"write_core\",\n \"write_std\",\n \"xcoff\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=object\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.36.7\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"archive\",\n \"build\",\n \"build_core\",\n \"coff\",\n \"compression\",\n \"default\",\n \"elf\",\n \"macho\",\n \"pe\",\n \"read\",\n \"read_core\",\n \"std\",\n \"unaligned\",\n \"write\",\n \"write_core\",\n \"write_std\",\n \"xcoff\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2018\",\n pkg_name = \"object\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=object\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.36.7\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "strip_prefix": "object-0.39.1", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"object\",\n deps = [\n \"@crates_std__memchr-2.8.3//:memchr\",\n \"@crates_std__object-0.39.1//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"archive\",\n \"coff\",\n \"elf\",\n \"macho\",\n \"pe\",\n \"read\",\n \"read_core\",\n \"std\",\n \"xcoff\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=object\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.39.1\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"archive\",\n \"coff\",\n \"elf\",\n \"macho\",\n \"pe\",\n \"read\",\n \"read_core\",\n \"std\",\n \"xcoff\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2018\",\n pkg_name = \"object\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=object\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.39.1\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, - "crates_std__object-0.37.3": { + "crates_std__object-0.40.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe", + "sha256": "dd229a0361b9d0d4396176e02d65897f487eebeab7caa6d443855ee152ca0b9c", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/object/0.37.3/download" + "https://static.crates.io/crates/object/0.40.0/download" ], - "strip_prefix": "object-0.37.3", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"object\",\n deps = [\n \"@crates_std__memchr-2.8.3//:memchr\",\n \"@crates_std__object-0.37.3//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"archive\",\n \"coff\",\n \"elf\",\n \"macho\",\n \"pe\",\n \"read\",\n \"read_core\",\n \"std\",\n \"unaligned\",\n \"xcoff\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=object\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.37.3\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"archive\",\n \"coff\",\n \"elf\",\n \"macho\",\n \"pe\",\n \"read\",\n \"read_core\",\n \"std\",\n \"unaligned\",\n \"xcoff\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2018\",\n pkg_name = \"object\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=object\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.37.3\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "strip_prefix": "object-0.40.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"object\",\n deps = [\n \"@crates_std__crc32fast-1.5.1//:crc32fast\",\n \"@crates_std__flate2-1.1.9//:flate2\",\n \"@crates_std__hashbrown-0.17.1//:hashbrown\",\n \"@crates_std__indexmap-2.14.0//:indexmap\",\n \"@crates_std__memchr-2.8.3//:memchr\",\n \"@crates_std__ruzstd-0.9.0//:ruzstd\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"archive\",\n \"build\",\n \"build_core\",\n \"coff\",\n \"compression\",\n \"default\",\n \"elf\",\n \"macho\",\n \"pe\",\n \"read\",\n \"read_core\",\n \"std\",\n \"write\",\n \"write_core\",\n \"write_std\",\n \"xcoff\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=object\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.40.0\",\n)\n" } }, "crates_std__once_cell-1.21.4": { @@ -9046,68 +8796,68 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"percent_encoding\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=percent-encoding\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.3.2\",\n)\n" } }, - "crates_std__pest-2.8.8": { + "crates_std__pest-2.9.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "7df728be843c7070fab6ab7c328c4e9e9d78e23bf749c0669c86ee7ebfa050a2", + "sha256": "5a07a60cc7a4d00c91f95c685609d1d2f79050e6804b70ebedd7650f0b839bcf", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/pest/2.8.8/download" + "https://static.crates.io/crates/pest/2.9.0/download" ], - "strip_prefix": "pest-2.8.8", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"pest\",\n deps = [\n \"@crates_std__memchr-2.8.3//:memchr\",\n \"@crates_std__ucd-trie-0.1.7//:ucd_trie\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"memchr\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=pest\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.8.8\",\n)\n" + "strip_prefix": "pest-2.9.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"pest\",\n deps = [\n \"@crates_std__memchr-2.8.3//:memchr\",\n \"@crates_std__ucd-trie-0.1.7//:ucd_trie\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"memchr\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=pest\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.9.0\",\n)\n" } }, - "crates_std__pest_derive-2.8.8": { + "crates_std__pest_derive-2.9.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "9e2dd6fc3b26b3462ee188aac870f5a41d398f1cd5e2408d16531bd71c9591fd", + "sha256": "b3a83744a5c8455b8b3e0dc5031362780a347c878bdd11584d1a8984228cc88d", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/pest_derive/2.8.8/download" + "https://static.crates.io/crates/pest_derive/2.9.0/download" ], - "strip_prefix": "pest_derive-2.8.8", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"pest_derive\",\n deps = [\n \"@crates_std__pest-2.8.8//:pest\",\n \"@crates_std__pest_generator-2.8.8//:pest_generator\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=pest_derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.8.8\",\n)\n" + "strip_prefix": "pest_derive-2.9.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"pest_derive\",\n deps = [\n \"@crates_std__pest-2.9.0//:pest\",\n \"@crates_std__pest_generator-2.9.0//:pest_generator\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=pest_derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.9.0\",\n)\n" } }, - "crates_std__pest_generator-2.8.8": { + "crates_std__pest_generator-2.9.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "6a7a9205cfb6f596a9e8b689c0a15f9ceb7a1aafae7aaf788150ac65b29975b6", + "sha256": "e0cd3451aa3de60d4b9a1e736885e4dea6b31617598026f12256ad566d63304a", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/pest_generator/2.8.8/download" + "https://static.crates.io/crates/pest_generator/2.9.0/download" ], - "strip_prefix": "pest_generator-2.8.8", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"pest_generator\",\n deps = [\n \"@crates_std__pest-2.8.8//:pest\",\n \"@crates_std__pest_meta-2.8.8//:pest_meta\",\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=pest_generator\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.8.8\",\n)\n" + "strip_prefix": "pest_generator-2.9.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"pest_generator\",\n deps = [\n \"@crates_std__pest-2.9.0//:pest\",\n \"@crates_std__pest_meta-2.9.0//:pest_meta\",\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=pest_generator\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.9.0\",\n)\n" } }, - "crates_std__pest_meta-2.8.8": { + "crates_std__pest_meta-2.9.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "85abd351c0de1e8384fc791a0737111a350394937e92b956b743dac12429f57c", + "sha256": "e04d3a0849e241d7dfce834c83b1c5edc8622009e8dd51a12ba1927c32f05496", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/pest_meta/2.8.8/download" + "https://static.crates.io/crates/pest_meta/2.9.0/download" ], - "strip_prefix": "pest_meta-2.8.8", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"pest_meta\",\n deps = [\n \"@crates_std__pest-2.8.8//:pest\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=pest_meta\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.8.8\",\n)\n" + "strip_prefix": "pest_meta-2.9.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"pest_meta\",\n deps = [\n \"@crates_std__pest-2.9.0//:pest\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=pest_meta\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.9.0\",\n)\n" } }, "crates_std__petgraph-0.8.3": { @@ -9142,20 +8892,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"pin_project_lite\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=pin-project-lite\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.17\",\n)\n" } }, - "crates_std__portable-atomic-1.14.0": { + "crates_std__portable-atomic-1.15.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "3d20d5497ef88037a52ff98267d066e7f11fcc5e99bbfbd58a42336193aacec3", + "sha256": "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/portable-atomic/1.14.0/download" + "https://static.crates.io/crates/portable-atomic/1.15.0/download" ], - "strip_prefix": "portable-atomic-1.14.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"portable_atomic\",\n deps = [\n \"@crates_std__portable-atomic-1.14.0//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"fallback\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=portable-atomic\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.14.0\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"fallback\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2018\",\n pkg_name = \"portable-atomic\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=portable-atomic\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"1.14.0\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "strip_prefix": "portable-atomic-1.15.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"portable_atomic\",\n deps = [\n \"@crates_std__portable-atomic-1.15.0//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"fallback\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=portable-atomic\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.15.0\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"fallback\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2018\",\n pkg_name = \"portable-atomic\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=portable-atomic\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"1.15.0\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, "crates_std__proc-macro2-1.0.107": { @@ -9203,7 +8953,7 @@ "https://static.crates.io/crates/prost-build/0.14.4/download" ], "strip_prefix": "prost-build-0.14.4", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"prost_build\",\n deps = [\n \"@crates_std__heck-0.5.0//:heck\",\n \"@crates_std__itertools-0.14.0//:itertools\",\n \"@crates_std__log-0.4.33//:log\",\n \"@crates_std__multimap-0.10.1//:multimap\",\n \"@crates_std__petgraph-0.8.3//:petgraph\",\n \"@crates_std__prost-0.14.4//:prost\",\n \"@crates_std__prost-types-0.14.4//:prost_types\",\n \"@crates_std__regex-1.13.1//:regex\",\n \"@crates_std__tempfile-3.27.0//:tempfile\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=prost-build\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.14.4\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"prost_build\",\n deps = [\n \"@crates_std__heck-0.5.0//:heck\",\n \"@crates_std__itertools-0.14.0//:itertools\",\n \"@crates_std__log-0.4.34//:log\",\n \"@crates_std__multimap-0.10.1//:multimap\",\n \"@crates_std__petgraph-0.8.3//:petgraph\",\n \"@crates_std__prost-0.14.4//:prost\",\n \"@crates_std__prost-types-0.14.4//:prost_types\",\n \"@crates_std__regex-1.13.1//:regex\",\n \"@crates_std__tempfile-3.27.0//:tempfile\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=prost-build\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.14.4\",\n)\n" } }, "crates_std__prost-derive-0.14.4": { @@ -9270,20 +9020,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\n \"@rules_rust//rust:defs.bzl\",\n \"rust_binary\",\n \"rust_library\",\n)\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"protoc_gen_prost\",\n deps = [\n \"@crates_std__once_cell-1.21.4//:once_cell\",\n \"@crates_std__prost-0.14.4//:prost\",\n \"@crates_std__prost-build-0.14.4//:prost_build\",\n \"@crates_std__prost-types-0.14.4//:prost_types\",\n \"@crates_std__regex-1.13.1//:regex\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=protoc-gen-prost\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.5.0\",\n)\n\nrust_binary(\n name = \"protoc-gen-prost__bin\",\n deps = [\n \":protoc_gen_prost\",\n \"@crates_std__once_cell-1.21.4//:once_cell\",\n \"@crates_std__prost-0.14.4//:prost\",\n \"@crates_std__prost-build-0.14.4//:prost_build\",\n \"@crates_std__prost-types-0.14.4//:prost_types\",\n \"@crates_std__regex-1.13.1//:regex\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/main.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=protoc-gen-prost\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.5.0\",\n)\n" } }, - "crates_std__psm-0.1.31": { + "crates_std__psm-0.1.32": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "645dbe486e346d9b5de3ef16ede18c26e6c70ad97418f4874b8b1889d6e761ea", + "sha256": "4dcd034599e63b970727f70d79e02d62390a4a84f7c6b827c27c46d5ac3fa622", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/psm/0.1.31/download" + "https://static.crates.io/crates/psm/0.1.32/download" ], - "strip_prefix": "psm-0.1.31", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"psm\",\n deps = [\n \"@crates_std__psm-0.1.31//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=psm\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.1.31\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n deps = [\n \"@crates_std__ar_archive_writer-0.5.2//:ar_archive_writer\",\n \"@crates_std__cc-1.4.0//:cc\",\n ],\n edition = \"2021\",\n pkg_name = \"psm\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=psm\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.1.31\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "strip_prefix": "psm-0.1.32", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"psm\",\n deps = [\n \"@crates_std__psm-0.1.32//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=psm\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.1.32\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n deps = [\n \"@crates_std__ar_archive_writer-0.5.3//:ar_archive_writer\",\n \"@crates_std__cc-1.4.4//:cc\",\n ],\n edition = \"2021\",\n pkg_name = \"psm\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=psm\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.1.32\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, "crates_std__quote-1.0.47": { @@ -9331,7 +9081,7 @@ "https://static.crates.io/crates/regex/1.13.1/download" ], "strip_prefix": "regex-1.13.1", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"regex\",\n deps = [\n \"@crates_std__regex-automata-0.4.16//:regex_automata\",\n \"@crates_std__regex-syntax-0.8.11//:regex_syntax\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"std\",\n \"unicode-bool\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=regex\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.13.1\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"regex\",\n deps = [\n \"@crates_std__regex-automata-0.4.18//:regex_automata\",\n \"@crates_std__regex-syntax-0.8.11//:regex_syntax\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"std\",\n \"unicode-bool\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=regex\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.13.1\",\n)\n" } }, "crates_std__regex-automata-0.3.9": { @@ -9350,20 +9100,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"regex_automata\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=regex-automata\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.3.9\",\n)\n" } }, - "crates_std__regex-automata-0.4.16": { + "crates_std__regex-automata-0.4.18": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "8fcfdb36bda0c880c5931cdc7a2bcdc8ba4556847b9d912bca70bc94708711ad", + "sha256": "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/regex-automata/0.4.16/download" + "https://static.crates.io/crates/regex-automata/0.4.18/download" ], - "strip_prefix": "regex-automata-0.4.16", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"regex_automata\",\n deps = [\n \"@crates_std__aho-corasick-1.1.4//:aho_corasick\",\n \"@crates_std__memchr-2.8.3//:memchr\",\n \"@crates_std__regex-syntax-0.8.11//:regex_syntax\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"default\",\n \"dfa\",\n \"dfa-build\",\n \"dfa-onepass\",\n \"dfa-search\",\n \"hybrid\",\n \"meta\",\n \"nfa\",\n \"nfa-backtrack\",\n \"nfa-pikevm\",\n \"nfa-thompson\",\n \"perf\",\n \"perf-inline\",\n \"perf-literal\",\n \"perf-literal-multisubstring\",\n \"perf-literal-substring\",\n \"std\",\n \"syntax\",\n \"unicode\",\n \"unicode-age\",\n \"unicode-bool\",\n \"unicode-case\",\n \"unicode-gencat\",\n \"unicode-perl\",\n \"unicode-script\",\n \"unicode-segment\",\n \"unicode-word-boundary\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=regex-automata\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.4.16\",\n)\n" + "strip_prefix": "regex-automata-0.4.18", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"regex_automata\",\n deps = [\n \"@crates_std__aho-corasick-1.1.5//:aho_corasick\",\n \"@crates_std__memchr-2.8.3//:memchr\",\n \"@crates_std__regex-syntax-0.8.11//:regex_syntax\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"default\",\n \"dfa\",\n \"dfa-build\",\n \"dfa-onepass\",\n \"dfa-search\",\n \"hybrid\",\n \"meta\",\n \"nfa\",\n \"nfa-backtrack\",\n \"nfa-pikevm\",\n \"nfa-thompson\",\n \"perf\",\n \"perf-inline\",\n \"perf-literal\",\n \"perf-literal-multisubstring\",\n \"perf-literal-substring\",\n \"std\",\n \"syntax\",\n \"unicode\",\n \"unicode-age\",\n \"unicode-bool\",\n \"unicode-case\",\n \"unicode-gencat\",\n \"unicode-perl\",\n \"unicode-script\",\n \"unicode-segment\",\n \"unicode-word-boundary\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=regex-automata\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.4.18\",\n)\n" } }, "crates_std__regex-syntax-0.7.5": { @@ -9446,20 +9196,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"rustversion\",\n deps = [\n \"@crates_std__rustversion-1.0.23//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=rustversion\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.0.23\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build/build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2018\",\n pkg_name = \"rustversion\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=rustversion\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"1.0.23\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, - "crates_std__ruzstd-0.7.3": { + "crates_std__ruzstd-0.9.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "fad02996bfc73da3e301efe90b1837be9ed8f4a462b6ed410aa35d00381de89f", + "sha256": "a252f5e20f038fe7b4ea53e073e65398d652c864cc162fc77c56c2f13717b888", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/ruzstd/0.7.3/download" + "https://static.crates.io/crates/ruzstd/0.9.0/download" ], - "strip_prefix": "ruzstd-0.7.3", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"ruzstd\",\n deps = [\n \"@crates_std__twox-hash-1.6.3//:twox_hash\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"hash\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=ruzstd\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.7.3\",\n)\n" + "strip_prefix": "ruzstd-0.9.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"ruzstd\",\n deps = [\n \"@crates_std__twox-hash-2.1.3//:twox_hash\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"hash\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=ruzstd\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.9.0\",\n)\n" } }, "crates_std__scopeguard-1.2.0": { @@ -9507,7 +9257,7 @@ "https://static.crates.io/crates/serde_core/1.0.229/download" ], "strip_prefix": "serde_core-1.0.229", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"serde_core\",\n deps = [\n \"@crates_std__serde_core-1.0.229//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"result\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=serde_core\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.0.229\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"result\",\n \"std\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"serde_core\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=serde_core\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"1.0.229\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"serde_core\",\n deps = [\n \"@crates_std__serde_core-1.0.229//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"result\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=serde_core\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.0.229\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"result\",\n \"std\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"serde_core\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=serde_core\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"1.0.229\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, "crates_std__serde_derive-1.0.229": { @@ -9523,7 +9273,7 @@ "https://static.crates.io/crates/serde_derive/1.0.229/download" ], "strip_prefix": "serde_derive-1.0.229", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"serde_derive\",\n deps = [\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__syn-3.0.3//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=serde_derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.0.229\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"serde_derive\",\n deps = [\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__syn-3.0.4//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=serde_derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.0.229\",\n)\n" } }, "crates_std__serde_json-1.0.151": { @@ -9555,23 +9305,23 @@ "https://static.crates.io/crates/serde_json5/0.2.1/download" ], "strip_prefix": "serde_json5-0.2.1", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"serde_json5\",\n deps = [\n \"@crates_std__pest-2.8.8//:pest\",\n \"@crates_std__serde-1.0.229//:serde\",\n ],\n proc_macro_deps = [\n \"@crates_std__pest_derive-2.8.8//:pest_derive\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=serde_json5\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.1\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"serde_json5\",\n deps = [\n \"@crates_std__pest-2.9.0//:pest\",\n \"@crates_std__serde-1.0.229//:serde\",\n ],\n proc_macro_deps = [\n \"@crates_std__pest_derive-2.9.0//:pest_derive\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=serde_json5\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.1\",\n)\n" } }, - "crates_std__serde_spanned-0.6.9": { + "crates_std__serde_spanned-1.1.1": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3", + "sha256": "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/serde_spanned/0.6.9/download" + "https://static.crates.io/crates/serde_spanned/1.1.1/download" ], - "strip_prefix": "serde_spanned-0.6.9", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"serde_spanned\",\n deps = [\n \"@crates_std__serde-1.0.229//:serde\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"serde\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=serde_spanned\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.6.9\",\n)\n" + "strip_prefix": "serde_spanned-1.1.1", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"serde_spanned\",\n deps = [\n \"@crates_std__serde_core-1.0.229//:serde_core\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"serde\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=serde_spanned\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.1.1\",\n)\n" } }, "crates_std__sha2-0.10.9": { @@ -9702,36 +9452,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"socket2\",\n deps = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [\n \"@crates_std__libc-0.2.189//:libc\", # cfg(any(unix, target_os = \"wasi\"))\n ],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [\n \"@crates_std__libc-0.2.189//:libc\", # cfg(any(unix, target_os = \"wasi\"))\n ],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [\n \"@crates_std__libc-0.2.189//:libc\", # cfg(any(unix, target_os = \"wasi\"))\n ],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [\n \"@crates_std__libc-0.2.189//:libc\", # cfg(any(unix, target_os = \"wasi\"))\n ],\n \"//conditions:default\": [],\n }),\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"all\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=socket2\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.6.5\",\n)\n" } }, - "crates_std__stacker-0.1.24": { + "crates_std__stacker-0.1.25": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "640c8cdd92b6b12f5bcb1803ca3bbf5ab96e5e6b6b96b9ab77dabe9e880b3190", + "sha256": "707f49d46706bacf8a2b00d51dace3f9de527c13eec3778f570c411f89e69967", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/stacker/0.1.24/download" + "https://static.crates.io/crates/stacker/0.1.25/download" ], - "strip_prefix": "stacker-0.1.24", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"stacker\",\n deps = [\n \"@crates_std__cfg-if-1.0.4//:cfg_if\",\n \"@crates_std__libc-0.2.189//:libc\",\n \"@crates_std__psm-0.1.31//:psm\",\n \"@crates_std__stacker-0.1.24//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=stacker\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.1.24\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n deps = [\n \"@crates_std__cc-1.4.0//:cc\",\n ],\n edition = \"2021\",\n pkg_name = \"stacker\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=stacker\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.1.24\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" - } - }, - "crates_std__static_assertions-1.1.0": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "patch_args": [], - "patch_tool": "", - "patches": [], - "remote_patch_strip": 1, - "sha256": "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f", - "type": "tar.gz", - "urls": [ - "https://static.crates.io/crates/static_assertions/1.1.0/download" - ], - "strip_prefix": "static_assertions-1.1.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"static_assertions\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2015\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=static_assertions\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.1.0\",\n)\n" + "strip_prefix": "stacker-0.1.25", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"stacker\",\n deps = [\n \"@crates_std__cfg-if-1.0.4//:cfg_if\",\n \"@crates_std__libc-0.2.189//:libc\",\n \"@crates_std__psm-0.1.32//:psm\",\n \"@crates_std__stacker-0.1.25//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=stacker\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.1.25\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n deps = [\n \"@crates_std__cc-1.4.4//:cc\",\n ],\n edition = \"2021\",\n pkg_name = \"stacker\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=stacker\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.1.25\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, "crates_std__strsim-0.11.1": { @@ -9766,20 +9500,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"syn\",\n deps = [\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__unicode-ident-1.0.24//:unicode_ident\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"clone-impls\",\n \"default\",\n \"derive\",\n \"extra-traits\",\n \"full\",\n \"parsing\",\n \"printing\",\n \"proc-macro\",\n \"visit\",\n \"visit-mut\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=syn\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.0.119\",\n)\n" } }, - "crates_std__syn-3.0.3": { + "crates_std__syn-3.0.4": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3", + "sha256": "e6275cddf4610d1775e6d1fe9469b2e77d0f39fd98fb7450901b821e0c53649f", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/syn/3.0.3/download" + "https://static.crates.io/crates/syn/3.0.4/download" ], - "strip_prefix": "syn-3.0.3", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"syn\",\n deps = [\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__unicode-ident-1.0.24//:unicode_ident\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"clone-impls\",\n \"default\",\n \"derive\",\n \"full\",\n \"parsing\",\n \"printing\",\n \"proc-macro\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=syn\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"3.0.3\",\n)\n" + "strip_prefix": "syn-3.0.4", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"syn\",\n deps = [\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__unicode-ident-1.0.24//:unicode_ident\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"clone-impls\",\n \"default\",\n \"derive\",\n \"extra-traits\",\n \"full\",\n \"parsing\",\n \"printing\",\n \"proc-macro\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=syn\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"3.0.4\",\n)\n" } }, "crates_std__tempfile-3.27.0": { @@ -9814,36 +9548,36 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"textwrap\",\n deps = [\n \"@crates_std__smawk-0.3.3//:smawk\",\n \"@crates_std__unicode-linebreak-0.1.5//:unicode_linebreak\",\n \"@crates_std__unicode-width-0.2.2//:unicode_width\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"smawk\",\n \"unicode-linebreak\",\n \"unicode-width\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=textwrap\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.16.2\",\n)\n" } }, - "crates_std__thiserror-2.0.19": { + "crates_std__thiserror-2.0.20": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "09a43598840e33d5b0331f38c5e30d13bb11c11210a4b58f0d9b18a5a5eefcd9", + "sha256": "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/thiserror/2.0.19/download" + "https://static.crates.io/crates/thiserror/2.0.20/download" ], - "strip_prefix": "thiserror-2.0.19", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"thiserror\",\n deps = [\n \"@crates_std__thiserror-2.0.19//:build_script_build\",\n ],\n proc_macro_deps = [\n \"@crates_std__thiserror-impl-2.0.19//:thiserror_impl\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=thiserror\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.0.19\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"std\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"thiserror\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=thiserror\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"2.0.19\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "strip_prefix": "thiserror-2.0.20", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"thiserror\",\n deps = [\n \"@crates_std__thiserror-2.0.20//:build_script_build\",\n ],\n proc_macro_deps = [\n \"@crates_std__thiserror-impl-2.0.20//:thiserror_impl\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=thiserror\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.0.20\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"std\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"thiserror\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=thiserror\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"2.0.20\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, - "crates_std__thiserror-impl-2.0.19": { + "crates_std__thiserror-impl-2.0.20": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "43cbfe0cf76104d42a574802844187e84a305e531ed54455f11fbde0f10541cd", + "sha256": "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/thiserror-impl/2.0.19/download" + "https://static.crates.io/crates/thiserror-impl/2.0.20/download" ], - "strip_prefix": "thiserror-impl-2.0.19", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"thiserror_impl\",\n deps = [\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__syn-3.0.3//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=thiserror-impl\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.0.19\",\n)\n" + "strip_prefix": "thiserror-impl-2.0.20", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"thiserror_impl\",\n deps = [\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__syn-3.0.4//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=thiserror-impl\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.0.20\",\n)\n" } }, "crates_std__tokio-1.53.1": { @@ -9875,7 +9609,7 @@ "https://static.crates.io/crates/tokio-macros/2.7.2/download" ], "strip_prefix": "tokio-macros-2.7.2", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"tokio_macros\",\n deps = [\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__syn-3.0.3//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=tokio-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.7.2\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"tokio_macros\",\n deps = [\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__syn-3.0.4//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=tokio-macros\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.7.2\",\n)\n" } }, "crates_std__tokio-util-0.7.19": { @@ -9891,87 +9625,87 @@ "https://static.crates.io/crates/tokio-util/0.7.19/download" ], "strip_prefix": "tokio-util-0.7.19", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"tokio_util\",\n deps = [\n \"@crates_std__bytes-1.12.1//:bytes\",\n \"@crates_std__futures-core-0.3.33//:futures_core\",\n \"@crates_std__futures-io-0.3.33//:futures_io\",\n \"@crates_std__futures-sink-0.3.33//:futures_sink\",\n \"@crates_std__pin-project-lite-0.2.17//:pin_project_lite\",\n \"@crates_std__tokio-1.53.1//:tokio\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"compat\",\n \"default\",\n \"futures-io\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=tokio-util\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.7.19\",\n)\n" + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"tokio_util\",\n deps = [\n \"@crates_std__bytes-1.12.1//:bytes\",\n \"@crates_std__futures-core-0.3.34//:futures_core\",\n \"@crates_std__futures-io-0.3.34//:futures_io\",\n \"@crates_std__futures-sink-0.3.34//:futures_sink\",\n \"@crates_std__pin-project-lite-0.2.17//:pin_project_lite\",\n \"@crates_std__tokio-1.53.1//:tokio\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"compat\",\n \"default\",\n \"futures-io\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=tokio-util\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.7.19\",\n)\n" } }, - "crates_std__toml-0.8.23": { + "crates_std__toml-1.1.4-spec-1.1.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362", + "sha256": "3aace63f4bbcdfc2c965b059de67119c89c4017a70d633be6c104910f67056f5", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/toml/0.8.23/download" + "https://static.crates.io/crates/toml/1.1.4+spec-1.1.0/download" ], - "strip_prefix": "toml-0.8.23", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"toml\",\n deps = [\n \"@crates_std__serde-1.0.229//:serde\",\n \"@crates_std__serde_spanned-0.6.9//:serde_spanned\",\n \"@crates_std__toml_datetime-0.6.11//:toml_datetime\",\n \"@crates_std__toml_edit-0.22.27//:toml_edit\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"display\",\n \"parse\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=toml\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.8.23\",\n)\n" + "strip_prefix": "toml-1.1.4+spec-1.1.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"toml\",\n deps = [\n \"@crates_std__serde_core-1.0.229//:serde_core\",\n \"@crates_std__serde_spanned-1.1.1//:serde_spanned\",\n \"@crates_std__toml_datetime-1.1.1-spec-1.1.0//:toml_datetime\",\n \"@crates_std__toml_parser-1.1.3-spec-1.1.0//:toml_parser\",\n \"@crates_std__toml_writer-1.1.2-spec-1.1.0//:toml_writer\",\n \"@crates_std__winnow-1.0.4//:winnow\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"default\",\n \"display\",\n \"parse\",\n \"serde\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=toml\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.1.4+spec-1.1.0\",\n)\n" } }, - "crates_std__toml_datetime-0.6.11": { + "crates_std__toml_datetime-1.1.1-spec-1.1.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c", + "sha256": "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/toml_datetime/0.6.11/download" + "https://static.crates.io/crates/toml_datetime/1.1.1+spec-1.1.0/download" ], - "strip_prefix": "toml_datetime-0.6.11", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"toml_datetime\",\n deps = [\n \"@crates_std__serde-1.0.229//:serde\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"serde\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=toml_datetime\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.6.11\",\n)\n" + "strip_prefix": "toml_datetime-1.1.1+spec-1.1.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"toml_datetime\",\n deps = [\n \"@crates_std__serde_core-1.0.229//:serde_core\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"serde\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=toml_datetime\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.1.1+spec-1.1.0\",\n)\n" } }, - "crates_std__toml_edit-0.22.27": { + "crates_std__toml_parser-1.1.3-spec-1.1.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a", + "sha256": "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/toml_edit/0.22.27/download" + "https://static.crates.io/crates/toml_parser/1.1.3+spec-1.1.0/download" ], - "strip_prefix": "toml_edit-0.22.27", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"toml_edit\",\n deps = [\n \"@crates_std__indexmap-2.14.0//:indexmap\",\n \"@crates_std__serde-1.0.229//:serde\",\n \"@crates_std__serde_spanned-0.6.9//:serde_spanned\",\n \"@crates_std__toml_datetime-0.6.11//:toml_datetime\",\n \"@crates_std__toml_write-0.1.2//:toml_write\",\n \"@crates_std__winnow-0.7.15//:winnow\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"display\",\n \"parse\",\n \"serde\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=toml_edit\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.22.27\",\n)\n" + "strip_prefix": "toml_parser-1.1.3+spec-1.1.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"toml_parser\",\n deps = [\n \"@crates_std__winnow-1.0.4//:winnow\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=toml_parser\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.1.3+spec-1.1.0\",\n)\n" } }, - "crates_std__toml_write-0.1.2": { + "crates_std__toml_writer-1.1.2-spec-1.1.0": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801", + "sha256": "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/toml_write/0.1.2/download" + "https://static.crates.io/crates/toml_writer/1.1.2+spec-1.1.0/download" ], - "strip_prefix": "toml_write-0.1.2", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"toml_write\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=toml_write\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.1.2\",\n)\n" + "strip_prefix": "toml_writer-1.1.2+spec-1.1.0", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"toml_writer\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2024\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=toml_writer\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.1.2+spec-1.1.0\",\n)\n" } }, - "crates_std__twox-hash-1.6.3": { + "crates_std__twox-hash-2.1.3": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675", + "sha256": "8464ec13c3691491391d9fce00f6416c9a48e46972f72d7865688be2080192c9", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/twox-hash/1.6.3/download" + "https://static.crates.io/crates/twox-hash/2.1.3/download" ], - "strip_prefix": "twox-hash-1.6.3", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"twox_hash\",\n deps = [\n \"@crates_std__cfg-if-1.0.4//:cfg_if\",\n \"@crates_std__static_assertions-1.1.0//:static_assertions\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=twox-hash\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.6.3\",\n)\n" + "strip_prefix": "twox-hash-2.1.3", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"twox_hash\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"xxhash64\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=twox-hash\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"2.1.3\",\n)\n" } }, "crates_std__typenum-1.20.1": { @@ -10166,68 +9900,68 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"wasi\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2018\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=wasi\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.11.1+wasi-snapshot-preview1\",\n)\n" } }, - "crates_std__wasm-bindgen-0.2.126": { + "crates_std__wasm-bindgen-0.2.127": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4", + "sha256": "1b70935747edd64d89de3efa29d73789b806c15798f8e7dca4d8ac356b50ce70", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/wasm-bindgen/0.2.126/download" + "https://static.crates.io/crates/wasm-bindgen/0.2.127/download" ], - "strip_prefix": "wasm-bindgen-0.2.126", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"wasm_bindgen\",\n deps = [\n \"@crates_std__cfg-if-1.0.4//:cfg_if\",\n \"@crates_std__once_cell-1.21.4//:once_cell\",\n \"@crates_std__wasm-bindgen-0.2.126//:build_script_build\",\n \"@crates_std__wasm-bindgen-shared-0.2.126//:wasm_bindgen_shared\",\n ],\n proc_macro_deps = [\n \"@crates_std__wasm-bindgen-macro-0.2.126//:wasm_bindgen_macro\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=wasm-bindgen\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.126\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n aliases = {\n \"@crates_std__rustversion-1.0.23//:rustversion\": \"rustversion_compat\",\n },\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n link_deps = [\n \"@crates_std__wasm-bindgen-shared-0.2.126//:wasm_bindgen_shared\",\n ],\n edition = \"2021\",\n pkg_name = \"wasm-bindgen\",\n proc_macro_deps = [\n \"@crates_std__rustversion-1.0.23//:rustversion\",\n ],\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=wasm-bindgen\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.2.126\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "strip_prefix": "wasm-bindgen-0.2.127", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"wasm_bindgen\",\n deps = [\n \"@crates_std__cfg-if-1.0.4//:cfg_if\",\n \"@crates_std__once_cell-1.21.4//:once_cell\",\n \"@crates_std__wasm-bindgen-0.2.127//:build_script_build\",\n \"@crates_std__wasm-bindgen-shared-0.2.127//:wasm_bindgen_shared\",\n ],\n proc_macro_deps = [\n \"@crates_std__wasm-bindgen-macro-0.2.127//:wasm_bindgen_macro\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=wasm-bindgen\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.127\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n aliases = {\n \"@crates_std__rustversion-1.0.23//:rustversion\": \"rustversion_compat\",\n },\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n link_deps = [\n \"@crates_std__wasm-bindgen-shared-0.2.127//:wasm_bindgen_shared\",\n ],\n edition = \"2021\",\n pkg_name = \"wasm-bindgen\",\n proc_macro_deps = [\n \"@crates_std__rustversion-1.0.23//:rustversion\",\n ],\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=wasm-bindgen\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.2.127\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, - "crates_std__wasm-bindgen-macro-0.2.126": { + "crates_std__wasm-bindgen-macro-0.2.127": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1", + "sha256": "77775f8f3f7217702089053b94958f8f54061a3f663417df76e19cbdcca29bc1", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/wasm-bindgen-macro/0.2.126/download" + "https://static.crates.io/crates/wasm-bindgen-macro/0.2.127/download" ], - "strip_prefix": "wasm-bindgen-macro-0.2.126", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"wasm_bindgen_macro\",\n deps = [\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__wasm-bindgen-macro-support-0.2.126//:wasm_bindgen_macro_support\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=wasm-bindgen-macro\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.126\",\n)\n" + "strip_prefix": "wasm-bindgen-macro-0.2.127", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"wasm_bindgen_macro\",\n deps = [\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__wasm-bindgen-macro-support-0.2.127//:wasm_bindgen_macro_support\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=wasm-bindgen-macro\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.127\",\n)\n" } }, - "crates_std__wasm-bindgen-macro-support-0.2.126": { + "crates_std__wasm-bindgen-macro-support-0.2.127": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e", + "sha256": "e11d33f857dc2fb11b8bc75aee111aa9cbeb12cd9f25efd3d4c2a3dd4e235284", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/wasm-bindgen-macro-support/0.2.126/download" + "https://static.crates.io/crates/wasm-bindgen-macro-support/0.2.127/download" ], - "strip_prefix": "wasm-bindgen-macro-support-0.2.126", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"wasm_bindgen_macro_support\",\n deps = [\n \"@crates_std__bumpalo-3.20.3//:bumpalo\",\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__syn-2.0.119//:syn\",\n \"@crates_std__wasm-bindgen-shared-0.2.126//:wasm_bindgen_shared\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=wasm-bindgen-macro-support\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.126\",\n)\n" + "strip_prefix": "wasm-bindgen-macro-support-0.2.127", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"wasm_bindgen_macro_support\",\n deps = [\n \"@crates_std__bumpalo-3.20.3//:bumpalo\",\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__syn-2.0.119//:syn\",\n \"@crates_std__wasm-bindgen-shared-0.2.127//:wasm_bindgen_shared\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=wasm-bindgen-macro-support\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.127\",\n)\n" } }, - "crates_std__wasm-bindgen-shared-0.2.126": { + "crates_std__wasm-bindgen-shared-0.2.127": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24", + "sha256": "7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/wasm-bindgen-shared/0.2.126/download" + "https://static.crates.io/crates/wasm-bindgen-shared/0.2.127/download" ], - "strip_prefix": "wasm-bindgen-shared-0.2.126", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"wasm_bindgen_shared\",\n deps = [\n \"@crates_std__unicode-ident-1.0.24//:unicode_ident\",\n \"@crates_std__wasm-bindgen-shared-0.2.126//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=wasm-bindgen-shared\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.126\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n links = \"wasm_bindgen\",\n pkg_name = \"wasm-bindgen-shared\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=wasm-bindgen-shared\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.2.126\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "strip_prefix": "wasm-bindgen-shared-0.2.127", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"wasm_bindgen_shared\",\n deps = [\n \"@crates_std__unicode-ident-1.0.24//:unicode_ident\",\n \"@crates_std__wasm-bindgen-shared-0.2.127//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=wasm-bindgen-shared\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.127\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n links = \"wasm_bindgen\",\n pkg_name = \"wasm-bindgen-shared\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=wasm-bindgen-shared\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.2.127\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, "crates_std__web-time-1.1.0": { @@ -10262,22 +9996,6 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"windows_link\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows-link\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.2.1\",\n)\n" } }, - "crates_std__windows-sys-0.59.0": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "patch_args": [], - "patch_tool": "", - "patches": [], - "remote_patch_strip": 1, - "sha256": "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b", - "type": "tar.gz", - "urls": [ - "https://static.crates.io/crates/windows-sys/0.59.0/download" - ], - "strip_prefix": "windows-sys-0.59.0", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"windows_sys\",\n deps = [\n \"@crates_std__windows-targets-0.52.6//:windows_targets\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows-sys\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.59.0\",\n)\n" - } - }, "crates_std__windows-sys-0.61.2": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { @@ -10294,164 +10012,20 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"windows_sys\",\n deps = [\n \"@crates_std__windows-link-0.2.1//:windows_link\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows-sys\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.61.2\",\n)\n" } }, - "crates_std__windows-targets-0.52.6": { + "crates_std__winnow-1.0.4": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973", + "sha256": "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/windows-targets/0.52.6/download" + "https://static.crates.io/crates/winnow/1.0.4/download" ], - "strip_prefix": "windows-targets-0.52.6", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"windows_targets\",\n deps = select({\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [\n \"@crates_std__windows_x86_64_gnu-0.52.6//:windows_x86_64_gnu\", # cfg(all(target_arch = \"x86_64\", target_env = \"gnu\", not(target_abi = \"llvm\"), not(windows_raw_dylib)))\n ],\n \"//conditions:default\": [],\n }),\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows-targets\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.52.6\",\n)\n" - } - }, - "crates_std__windows_aarch64_gnullvm-0.52.6": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "patch_args": [], - "patch_tool": "", - "patches": [], - "remote_patch_strip": 1, - "sha256": "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3", - "type": "tar.gz", - "urls": [ - "https://static.crates.io/crates/windows_aarch64_gnullvm/0.52.6/download" - ], - "strip_prefix": "windows_aarch64_gnullvm-0.52.6", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"windows_aarch64_gnullvm\",\n deps = [\n \"@crates_std__windows_aarch64_gnullvm-0.52.6//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows_aarch64_gnullvm\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.52.6\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"windows_aarch64_gnullvm\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows_aarch64_gnullvm\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.52.6\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" - } - }, - "crates_std__windows_aarch64_msvc-0.52.6": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "patch_args": [], - "patch_tool": "", - "patches": [], - "remote_patch_strip": 1, - "sha256": "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469", - "type": "tar.gz", - "urls": [ - "https://static.crates.io/crates/windows_aarch64_msvc/0.52.6/download" - ], - "strip_prefix": "windows_aarch64_msvc-0.52.6", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"windows_aarch64_msvc\",\n deps = [\n \"@crates_std__windows_aarch64_msvc-0.52.6//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows_aarch64_msvc\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.52.6\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"windows_aarch64_msvc\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows_aarch64_msvc\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.52.6\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" - } - }, - "crates_std__windows_i686_gnu-0.52.6": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "patch_args": [], - "patch_tool": "", - "patches": [], - "remote_patch_strip": 1, - "sha256": "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b", - "type": "tar.gz", - "urls": [ - "https://static.crates.io/crates/windows_i686_gnu/0.52.6/download" - ], - "strip_prefix": "windows_i686_gnu-0.52.6", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"windows_i686_gnu\",\n deps = [\n \"@crates_std__windows_i686_gnu-0.52.6//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows_i686_gnu\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.52.6\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"windows_i686_gnu\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows_i686_gnu\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.52.6\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" - } - }, - "crates_std__windows_i686_gnullvm-0.52.6": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "patch_args": [], - "patch_tool": "", - "patches": [], - "remote_patch_strip": 1, - "sha256": "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66", - "type": "tar.gz", - "urls": [ - "https://static.crates.io/crates/windows_i686_gnullvm/0.52.6/download" - ], - "strip_prefix": "windows_i686_gnullvm-0.52.6", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"windows_i686_gnullvm\",\n deps = [\n \"@crates_std__windows_i686_gnullvm-0.52.6//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows_i686_gnullvm\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.52.6\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"windows_i686_gnullvm\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows_i686_gnullvm\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.52.6\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" - } - }, - "crates_std__windows_i686_msvc-0.52.6": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "patch_args": [], - "patch_tool": "", - "patches": [], - "remote_patch_strip": 1, - "sha256": "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66", - "type": "tar.gz", - "urls": [ - "https://static.crates.io/crates/windows_i686_msvc/0.52.6/download" - ], - "strip_prefix": "windows_i686_msvc-0.52.6", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"windows_i686_msvc\",\n deps = [\n \"@crates_std__windows_i686_msvc-0.52.6//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows_i686_msvc\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.52.6\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"windows_i686_msvc\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows_i686_msvc\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.52.6\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" - } - }, - "crates_std__windows_x86_64_gnu-0.52.6": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "patch_args": [], - "patch_tool": "", - "patches": [], - "remote_patch_strip": 1, - "sha256": "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78", - "type": "tar.gz", - "urls": [ - "https://static.crates.io/crates/windows_x86_64_gnu/0.52.6/download" - ], - "strip_prefix": "windows_x86_64_gnu-0.52.6", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"windows_x86_64_gnu\",\n deps = [\n \"@crates_std__windows_x86_64_gnu-0.52.6//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows_x86_64_gnu\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.52.6\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"windows_x86_64_gnu\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows_x86_64_gnu\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.52.6\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" - } - }, - "crates_std__windows_x86_64_gnullvm-0.52.6": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "patch_args": [], - "patch_tool": "", - "patches": [], - "remote_patch_strip": 1, - "sha256": "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d", - "type": "tar.gz", - "urls": [ - "https://static.crates.io/crates/windows_x86_64_gnullvm/0.52.6/download" - ], - "strip_prefix": "windows_x86_64_gnullvm-0.52.6", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"windows_x86_64_gnullvm\",\n deps = [\n \"@crates_std__windows_x86_64_gnullvm-0.52.6//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows_x86_64_gnullvm\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.52.6\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"windows_x86_64_gnullvm\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows_x86_64_gnullvm\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.52.6\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" - } - }, - "crates_std__windows_x86_64_msvc-0.52.6": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "patch_args": [], - "patch_tool": "", - "patches": [], - "remote_patch_strip": 1, - "sha256": "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec", - "type": "tar.gz", - "urls": [ - "https://static.crates.io/crates/windows_x86_64_msvc/0.52.6/download" - ], - "strip_prefix": "windows_x86_64_msvc-0.52.6", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"windows_x86_64_msvc\",\n deps = [\n \"@crates_std__windows_x86_64_msvc-0.52.6//:build_script_build\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows_x86_64_msvc\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.52.6\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"windows_x86_64_msvc\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=windows_x86_64_msvc\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.52.6\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" - } - }, - "crates_std__winnow-0.7.15": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "patch_args": [], - "patch_tool": "", - "patches": [], - "remote_patch_strip": 1, - "sha256": "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945", - "type": "tar.gz", - "urls": [ - "https://static.crates.io/crates/winnow/0.7.15/download" - ], - "strip_prefix": "winnow-0.7.15", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"winnow\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"alloc\",\n \"default\",\n \"std\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=winnow\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.7.15\",\n)\n" + "strip_prefix": "winnow-1.0.4", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"winnow\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=winnow\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"1.0.4\",\n)\n" } }, "crates_std__yansi-0.5.1": { @@ -10470,36 +10044,36 @@ "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"yansi\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2015\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=yansi\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.5.1\",\n)\n" } }, - "crates_std__zerocopy-0.8.55": { + "crates_std__zerocopy-0.8.56": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "b5a105cd7b140f6eeec8acff2ea38135d3cab283ada58540f629fe51e46696eb", + "sha256": "556764e583adb45a9f8d413c2a147fa7e8d821e48e12b14fd560b607998b75eb", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/zerocopy/0.8.55/download" + "https://static.crates.io/crates/zerocopy/0.8.56/download" ], - "strip_prefix": "zerocopy-0.8.55", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"zerocopy\",\n deps = [\n \"@crates_std__zerocopy-0.8.55//:build_script_build\",\n ],\n proc_macro_deps = [\n \"@crates_std__zerocopy-derive-0.8.55//:zerocopy_derive\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"derive\",\n \"zerocopy-derive\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=zerocopy\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.8.55\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"derive\",\n \"zerocopy-derive\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"zerocopy\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=zerocopy\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.8.55\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" + "strip_prefix": "zerocopy-0.8.56", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\n \"@rules_rust//cargo:defs.bzl\",\n \"cargo_build_script\",\n \"cargo_toml_env_vars\",\n)\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_library(\n name = \"zerocopy\",\n deps = [\n \"@crates_std__zerocopy-0.8.56//:build_script_build\",\n ],\n proc_macro_deps = [\n \"@crates_std__zerocopy-derive-0.8.56//:zerocopy_derive\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"derive\",\n \"zerocopy-derive\",\n ],\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=zerocopy\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.8.56\",\n)\n\ncargo_build_script(\n name = \"_bs\",\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \"**/*.rs\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_features = [\n \"derive\",\n \"zerocopy-derive\",\n ],\n crate_name = \"build_script_build\",\n crate_root = \"build.rs\",\n data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n edition = \"2021\",\n pkg_name = \"zerocopy\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=zerocopy\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n version = \"0.8.56\",\n visibility = [\"//visibility:private\"],\n)\n\nalias(\n name = \"build_script_build\",\n actual = \":_bs\",\n tags = [\"manual\"],\n)\n" } }, - "crates_std__zerocopy-derive-0.8.55": { + "crates_std__zerocopy-derive-0.8.56": { "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", "attributes": { "patch_args": [], "patch_tool": "", "patches": [], "remote_patch_strip": 1, - "sha256": "0fe976fb70c78cd64cccfe3a6fc142244e8a77b70959b30faf9d0ac37ee228eb", + "sha256": "f2ab42fc20575779bd240faa45f94a74256f755c0fa9e89f0ede20d91d0cdfc1", "type": "tar.gz", "urls": [ - "https://static.crates.io/crates/zerocopy-derive/0.8.55/download" + "https://static.crates.io/crates/zerocopy-derive/0.8.56/download" ], - "strip_prefix": "zerocopy-derive-0.8.55", - "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"zerocopy_derive\",\n deps = [\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=zerocopy-derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.8.55\",\n)\n" + "strip_prefix": "zerocopy-derive-0.8.56", + "build_file_content": "###############################################################################\n# @generated\n# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To \n# regenerate this file, run the following:\n#\n# bazel mod show_repo 'pigweed'\n###############################################################################\n\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_toml_env_vars\")\n\nload(\"@rules_rust//rust:defs.bzl\", \"rust_proc_macro\")\n\n# buildifier: disable=bzl-visibility\nload(\"@rules_rust//crate_universe/private:selects.bzl\", \"selects\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\ncargo_toml_env_vars(\n name = \"cargo_toml_env_vars\",\n src = \"Cargo.toml\",\n)\n\nrust_proc_macro(\n name = \"zerocopy_derive\",\n deps = [\n \"@crates_std__proc-macro2-1.0.107//:proc_macro2\",\n \"@crates_std__quote-1.0.47//:quote\",\n \"@crates_std__syn-2.0.119//:syn\",\n ],\n compile_data = glob(\n allow_empty = True,\n include = [\"**\"],\n exclude = [\n \"**/* *\",\n \".tmp_git_root/**/*\",\n \"BUILD\",\n \"BUILD.bazel\",\n \"WORKSPACE\",\n \"WORKSPACE.bazel\",\n ],\n ),\n crate_root = \"src/lib.rs\",\n edition = \"2021\",\n rustc_env_files = [\n \":cargo_toml_env_vars\",\n ],\n rustc_flags = [\n \"--cap-lints=allow\",\n ],\n srcs = glob(\n allow_empty = True,\n include = [\"**/*.rs\"],\n ),\n tags = [\n \"cargo-bazel\",\n \"crate-name=zerocopy-derive\",\n \"manual\",\n \"noclippy\",\n \"norustfmt\",\n ],\n target_compatible_with = select({\n \"@rules_rust//rust/platform:aarch64-apple-darwin\": [],\n \"@rules_rust//rust/platform:aarch64-unknown-linux-gnu\": [],\n \"@rules_rust//rust/platform:x86_64-apple-darwin\": [],\n \"@rules_rust//rust/platform:x86_64-unknown-linux-gnu\": [],\n \"//conditions:default\": [\"@platforms//:incompatible\"],\n }),\n version = \"0.8.56\",\n)\n" } }, "crates_std__zeroize-1.9.0": { diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 6160138de..28cb5d7ae 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -32,6 +32,9 @@ * [Design](./design/README.md) * [Pigweed Integration Overview](./design/pigweed-overview.md) * [pw_kernel IPC](./design/pw-kernel-ipc.md) + * [IPC service stack](./design/ipc-service-stack.md) + * [Trust Boundaries](./design/trust-boundaries.md) + * [eRoT Self-Verification](./design/erot-self-verification.md) * [Orchestrator](./design/orchestrator/orchestrator-overview.md) * [Verification Model](./design/orchestrator/orchestrator-model.md) * [State Machine](./design/orchestrator/orchestrator-machine.md) diff --git a/docs/src/design/erot-self-verification.md b/docs/src/design/erot-self-verification.md new file mode 100644 index 000000000..c5c1289aa --- /dev/null +++ b/docs/src/design/erot-self-verification.md @@ -0,0 +1,138 @@ +# How the eRoT's own firmware is verified + +The orchestrator verifies every component it supervises: it reads the +firmware, verifies it at rest, releases the reset line and watches the boot +walk. It does none of that for the eRoT it runs on. + +That is not a gap. The orchestrator is the thing that got booted, so it cannot +be the thing that decides whether booting it was safe. By the time any of this +code runs, the answer is already settled. + +## Two different trust relationships + +Governing other components is the orchestrator's job. It walks the chain, +reading and verifying each component before releasing it, and the +[state machine](orchestrator/orchestrator-machine.md) owns every step. + +Self-governance happens one boot layer down, before the orchestrator exists. +The eRoT ROM verifies the bootloader, the bootloader verifies and measures the +runtime firmware, and only then does this code start. The orchestrator +receives a verdict it did not compute. + +```mermaid +flowchart TB + subgraph below["Below the orchestrator, before it runs"] + direction TB + rom["eRoT ROM
immutable, the hardware root"] + bl["Measuring bootloader
verified by the ROM"] + rt["eRoT runtime firmware
verified and measured by the bootloader"] + rom -->|verifies| bl + bl -->|verifies, measures| rt + end + + rt -->|"Event::PowerGood(PowerOnResult)"| sm + + subgraph sm["Orchestrator state machine"] + direction TB + por["PowerOnReset"] + pre["PreSupervision"] + locked["Locked"] + por -->|Provisioned| pre + por -->|"Unprovisioned
cannot act as a RoT"| locked + por -->|"SelfVerificationFailed
INV11: latches at once"| locked + end + + pre --> walk["Chain walk over the components the eRoT supervises:
ReadFirmware, VerifyFirmware, ReleaseReset
(steps past ComponentId(0), the eRoT itself)"] +``` + +## What the orchestrator does with the verdict + +The board hands it in as `PowerOnResult` inside `Event::PowerGood`, the first +event the machine ever sees. There are three answers: + +| `PowerOnResult` | meaning | where it goes | +|---|---|---| +| `Provisioned` | self-verified, has an identity | `PreSupervision` | +| `Unprovisioned` | self-verified, but cannot act as a RoT | `Locked` | +| `SelfVerificationFailed` | the layer below said no | `Locked` | + +`SelfVerificationFailed` latches `Locked` immediately, without passing through +`PreSupervision`. That is invariant INV11, pinned by +`self_verification_failure_latches_immediately`. + +Producing the value is platform code's job. Nothing in this repository +constructs a `PowerOnResult` outside tests: the board's bring-up reads what +the ROM and the bootloader recorded (a status register, say, or the fact that +a fallback image is running) and names one of the three. Where the ROM +refuses to start an image that failed verification, `SelfVerificationFailed` +never arrives, because nothing is running to send it. + +Refusing to run is the only move available. The orchestrator cannot re-verify +itself, so it cannot recover from a bad verdict, and a platform whose own RoT +is suspect has nothing left to supervise with. + +## Why the walk skips chain position 0 + +The eRoT holds `ComponentId(0)` in every device table, so the orchestrator can +address it the way it addresses anything else. The walk steps past it: no +`ReadFirmware`, no `VerifyFirmware`, no `ReleaseReset`. There is nothing to +read or verify at rest, because that already happened, and nothing to release, +because the eRoT is what drives the reset lines. + +The test `the_walk_passes_over_the_erot` pins both halves: a power-on walk +emits none of those three effects for the eRoT, and still reaches the +component behind it. + +## The eRoT's own reset + +A self-update activates a new image and resets the eRoT into it. The driver +does the sequence: it records the session with the SVN the verifier read off +the candidate, marks the trial pending, then asks the board's `SelfReset` to +reset. + +The `SelfUpdate` session is durable: it survives the reset, and the next boot +reads it. NIST SP 800-193 §4.1.2(2) requires a mutable Root of Trust for +Update to stay operational or recoverable across the reboot its own update +causes, including after a power loss in the middle of a flash write, and the +session is what the eRoT recovers from. + +The reset belongs to the platform. The eRoT's device table entry carries no +reset signal, because nothing outside the eRoT can reset it. + +## Where the SVN comes from + +A managed component's floor takes the SVN read back after the component +reboots, not the SVN read off the candidate. The two can differ: the +candidate is what the agent offered, the read-back is what runs. The +floor takes the read-back because the orchestrator verified it. + +The eRoT has only the candidate's SVN. It could read its own flash, but +then the running image would vouch for itself, so the orchestrator never +verifies itself. The ROM and the bootloader verify it. They report a +verdict with no version: `PowerOnResult` is `Provisioned`, `Unprovisioned` +or `SelfVerificationFailed`. + +`PollOutcome::Authenticated` carries the candidate's SVN. The activation +records it in the session. Confirming the trial does not move the floor. +The commit is a separate step, and it takes the SVN from the session. + +An eRoT image carries its SVN in the signed header, and the ROM compares +that SVN against the anti-rollback counter before booting. An eRoT image +without an SVN cannot be compared, so the eRoT cannot install it. That is +why `SelfUpdate::prepare` takes an `Svn` and not an `Option`: with no +SVN there is no session and no trial to mark, so the update is rejected. + +A managed component needs no session, because the walk judges it after it +reboots. The image installs even with no SVN, and the anti-rollback floor +for that component stays where it was, which `Report::SvnFloorHeld` +records. + +## Not covered here + +The ROM and bootloader are platform firmware, outside this repository. How a +given platform verifies each layer, and where it keeps the keys to do so, is +that platform's business. This page only says what the orchestrator may assume +about the result and what it does when the result is bad. + +Device identity and attestation key derivation are specified in +[Attestation](../specification/services/attestation.md). diff --git a/docs/src/design/ipc-service-stack.md b/docs/src/design/ipc-service-stack.md new file mode 100644 index 000000000..908ab1ce2 --- /dev/null +++ b/docs/src/design/ipc-service-stack.md @@ -0,0 +1,129 @@ +# IPC service stack + +How a service request travels from a client, through the kernel, to a +server and back. Two paths: the production kernel channel path and the +in-process loopback for host tests. + +## Production path (kernel channel) + +```mermaid +sequenceDiagram + participant C as Client
(event loop) + participant CT as AsyncChannelTransport
(util/ipc) + participant AT as AsyncTransaction
(util/ipc) + participant K as pw_kernel
(channel) + participant S as Server process + participant D as dispatch()
(pldm/server) + participant H as FdIpcHandler + + Note over C,H: Request + + C->>CT: start(req: &[u8]) + CT->>CT: copy req into 'static send buf + CT->>AT: start(send, send_len, recv) + AT->>K: channel_async_transact(send_ptr, recv_ptr) + K-->>C: returns immediately + + Note over C: event loop parks on
WaitGroup (READABLE) + + K->>S: delivers request bytes + S->>D: dispatch(request, response) + D->>H: accept_offer() / query_status() / ... + H-->>D: Ok(()) or Err(ResponseCode) + D->>D: encode response frame + D-->>S: response length + S->>K: channel_respond(response) + + Note over C,H: Response + + K-->>C: READABLE signal fires + C->>CT: poll(resp: &mut [u8]) + CT->>AT: try_recv() + AT->>K: channel_async_transact_complete() + K-->>AT: Ok(len) + AT-->>CT: Completion { len, send, recv } + CT->>CT: copy recv[..len] into resp + CT-->>C: Ok(Some(len)) + C->>C: decode resp[..len] +``` + +## Loopback path (host tests) + +A loopback answers on the first poll, so it cannot test a client's +not-ready path. `Delayed` wraps any transport and returns `Ok(None)` for a +set number of polls before forwarding, which is how a host test reaches that +path. + +```mermaid +sequenceDiagram + participant C as Client
(test code) + participant L as Loopback
(util/service) + participant D as dispatch()
(pldm/server) + participant H as FdIpcHandler + + C->>L: start(req: &[u8]) + L->>D: dispatch(req, held_buf) + D->>H: accept_offer() / query_status() / ... + H-->>D: Ok(()) or Err(ResponseCode) + D-->>L: response length + Note over L: response stored in held_buf,
ready immediately + + C->>L: poll(resp: &mut [u8]) + L->>L: copy held_buf[..len] into resp + L-->>C: Ok(Some(len)) + C->>C: decode resp[..len] +``` + +## Layer map + +```mermaid +graph TD + subgraph "Client process" + CL[Service client code] + CT[AsyncChannelTransport] + AT[AsyncTransaction] + end + + subgraph "Kernel" + CH[pw_kernel channel] + end + + subgraph "Server process" + SV[Server main loop] + DS[service dispatch] + FH["handler (e.g. FdIpcHandler)"] + end + + subgraph "Traits (util/service)" + TR["AsyncTransport trait"] + DI["Dispatch trait"] + end + + CL -->|"start/poll/cancel"| CT + CT -->|"implements"| TR + CT -->|"owns 'static bufs"| AT + AT -->|"unsafe syscalls"| CH + CH -->|"delivers frames"| SV + SV -->|"request bytes"| DS + DS -->|"implements"| DI + DS -->|"decoded opcodes"| FH + + style TR fill:#f0f0f0,stroke:#666 + style DI fill:#f0f0f0,stroke:#666 +``` + +## Buffer copies + +The async path copies twice per direction: + +| Step | What | Where | +|------|------|-------| +| 1 | req slice into 'static send buf | `AsyncChannelTransport::start()` | +| 2 | send buf to server process | kernel internal | +| 3 | server response to 'static recv buf | kernel internal | +| 4 | recv buf into caller's resp slice | `AsyncChannelTransport::poll()` | + +Copies 1 and 4 exist because the kernel needs `'static` buffers (it holds +raw pointers for the duration of the transaction), but callers work with +ordinary stack slices. The loopback skips steps 2 and 3 since everything +runs in one process. diff --git a/docs/src/design/orchestrator/orchestrator-machine.md b/docs/src/design/orchestrator/orchestrator-machine.md index b7227f8a8..51e7613e6 100644 --- a/docs/src/design/orchestrator/orchestrator-machine.md +++ b/docs/src/design/orchestrator/orchestrator-machine.md @@ -15,26 +15,28 @@ stateDiagram-v2 PreSupervision --> PreSupervision : VerificationPassed [more, Passive]
/ ReleaseReset · ReadFirmware · VerifyFirmware PreSupervision --> AwaitingReady : VerificationPassed [more, Active]
/ ReleaseReset · ReadFirmware · VerifyFirmware PreSupervision --> Ready : VerificationPassed [chain done]
/ ReleaseReset - PreSupervision --> Recovering : VerificationFailed (any policy)
/ RestoreGoldenImage + PreSupervision --> Recovering : VerificationFailed (any policy)
/ RecoverComponent AwaitingReady --> AwaitingReady : VerificationPassed [more]
/ ReleaseReset · ReadFirmware · VerifyFirmware AwaitingReady --> Ready : ComponentReady [chain done or cursor past end] AwaitingReady --> AwaitingReady : ComponentReady [more] - AwaitingReady --> Recovering : VerificationFailed (any policy)
/ RestoreGoldenImage - AwaitingReady --> Recovering : Timeout(id) [id == awaiting]
/ RestoreGoldenImage + AwaitingReady --> Recovering : VerificationFailed (any policy)
/ RecoverComponent + AwaitingReady --> Recovering : Timeout(id) [id == awaiting]
/ RecoverComponent state SupervisingPlatform { - Ready --> Updating : UpdateRequest
/ AuthenticateUpdate · StageUpdate - Updating --> Ready : UpdateVerified / ActivateUpdate + Ready --> Updating : UpdateRequest(id)
/ AuthenticateStageUpdate + Updating --> PreSupervision : UpdateVerified / ActivateUpdate Updating --> Ready : UpdateRejected / DiscardStaged - Ready --> Recovering : CorruptionDetected
/ RestoreGoldenImage - Updating --> Recovering : CorruptionDetected
/ RestoreGoldenImage - AwaitingReady --> Recovering : CorruptionDetected
/ RestoreGoldenImage + Ready --> Recovering : CorruptionDetected
/ RecoverComponent + Updating --> Recovering : CorruptionDetected
/ RecoverComponent + AwaitingReady --> Recovering : CorruptionDetected
/ RecoverComponent } Recovering --> PreSupervision : Restored [retry < max_retry]
(re-verify) Recovering --> PreSupervision : Restored [retry ≥ max_retry, Isolable/Cascading]
/ AssertReset (skip — held) Recovering --> Locked : Restored [retry ≥ max_retry, Required]
(self-emits RecoveryFailed) / LatchLockdown + Recovering --> PreSupervision : RecoveryUnavailable [Isolable/Cascading]
/ AssertReset (skip — held) + Recovering --> Locked : RecoveryUnavailable [Required]
(self-emits RecoveryFailed) / LatchLockdown Locked --> Locked : (terminal — all events ignored) ``` @@ -53,11 +55,15 @@ across events and is visible to every handler. States are a plain `State` enum | `cursor` | `u8` | Index of the component currently under verification. Reset to 0 on every `PreSupervision` entry. Advances on each `VerificationPassed`, and past any component marked `Isolated` in `statuses` (skipped without verification), via `Outcome::Handled`. | | `statuses` | `Vec` | One record per chain component, parallel by index. Each `ComponentStatus` is `{ lifecycle: ComponentLifecycle, retry: u8 }`. `lifecycle` (`Nominal` / `Isolated`) marks whether the component has been gated out of service — an `Isolated` component is held in reset and skipped on every walk. `retry` is its consecutive failed-restore count, kept per component so interleaved recoveries never share a budget. Durable across a return to `Ready` (only `retry` is cleared there; `Isolated` persists); reset only by a fresh `Rot` on `PowerOnReset`. | | `max_retry` | `u8` | Ceiling for a component's `retry`, chosen by the platform driver. When `statuses[i].retry >= max_retry` recovery is **exhausted** and the failed component's recovery-failure policy (`Isolable`/`Cascading`/`Required`) is applied. | +| `pending_commit` | `Option` | The component whose update was activated and whose test image is not confirmed yet. Set on `UpdateVerified`. The matching `BootConfirmed` clears it, emits `ConfirmDeviceTrial`, and records the component in `awaiting_floor_advance`. Entry to `Updating` or `Recovering` also clears it and emits `RevertDeviceTrial`, for an image an update supersedes or a recovery puts under suspicion. A `CommitTimeout` while it is set goes to `Locked`. | +| `awaiting_floor_advance` | `Option` | The component whose image has booted and whose SVN floor is still waiting for the Update Agent to request it. Set by `BootConfirmed`, cleared by the matching `SvnCommitRequest`, which emits `CommitSvnFloor`, on entry to `Updating` or `Recovering` (the SVN the floor would take belongs to the image those two supersede), and when the component is gated out of service, which puts its image under the same suspicion. No watchdog bounds it: with an Update Agent that never sends UpdateSecurityRevision the SVN floor keeps the SVN it has. | +| `self_trial_booted` | `bool` | Set by `SelfTrialBooted`: this boot is the trial run of the eRoT's own update. `Ready` entry emits `ConfirmSelfTrial` and clears it, so the trial is confirmed once, however many times the machine returns to `Ready`. Only ever set at the start of a boot; what survives the reset that decides the trial is the durable session, not this. | | `_effect_cap` | `PhantomData<[u8; E]>` | Zero-sized; ties the effect-buffer size `E` to the type so the `E >= 2 * N + 2` bound is enforced at construction. | -Two pieces of per-episode data are **not** stored on `Rot`: the component whose -recovery is in progress and the `Active` component whose readiness is -outstanding. These live in the `State` payloads `Recovering(ComponentId)` and +Three pieces of per-episode data are **not** stored on `Rot`: the component whose +recovery is in progress, the component being updated, and the `Active` component +whose readiness is outstanding. These live in the `State` payloads +`Recovering(ComponentId)`, `Updating(ComponentId)` and `AwaitingReady(Option)`, so they exist only while the machine is in those states — the type system guarantees they cannot be read in any other. @@ -80,7 +86,9 @@ and reads the effects out after the handler returns. ### `PowerOnReset` -The machine's initial state. The first event is always `PowerGood(PowerOnResult)`. +The machine's initial state. `PowerGood(PowerOnResult)` is what leaves it. A +boot that is settling the eRoT's own last self-update sends `SelfTrialBooted` +first, before anything walks. **Entry action**: none. @@ -89,6 +97,7 @@ The machine's initial state. The first event is always `PowerGood(PowerOnResult) | `PowerGood(Provisioned)` | — | — | `PreSupervision` | | `PowerGood(Unprovisioned)` | — | — | `Locked` | | `PowerGood(SelfVerificationFailed)` | — | — | `Locked` | +| `SelfTrialBooted` | — | — | `Handled` (records the trial; `Ready` entry acts on it) | | anything else | — | — | `Outcome::Super` (top level — discarded) | --- @@ -111,8 +120,10 @@ here — they persist across re-walks so exhausted components are not re-verifie | `VerificationPassed(id)` | more, current `Active` | `ReleaseReset` · `ReadFirmware(next)` · `VerifyFirmware(next)` | `AwaitingReady(Some(id))` | | `VerificationPassed(id)` | chain done | `ReleaseReset(id)` | `Ready` | | `VerificationFailed(id)` | — | — | `Recovering(id)` — recovery is attempted first, regardless of the component's recovery-failure policy | -| `CorruptionDetected(id)` | `Required`/unknown | `RestoreGoldenImage` | `Recovering(id)` | +| `CorruptionDetected(id)` | `Required`/unknown | `RecoverComponent` | `Recovering(id)` | | `CorruptionDetected(id)` | `Isolable`/`Cascading` | `AssertReset` · `ReportIsolated` | `Handled` (component gated; walk continues) | +| `CommitTimeout` | `pending_commit` set | — | `Locked` (commit window spans the post-activation walk; `LatchLockdown` on entry) | +| `CommitTimeout` | `pending_commit` clear | — | `Handled` (no window open, nothing to enforce) | | anything else | — | — | `Outcome::Super` (top level — discarded) | When advancing the cursor, any component marked `Isolated` is skipped without @@ -174,20 +185,35 @@ and corruption events. **Entry action**: reset every component's `retry` to 0 (makes the cap count *consecutive* failures — INV7). The `Isolated` marks are **not** cleared — a component isolated by exhausted recovery stays held across a return to `Ready`; -only a fresh `Rot` on `PowerOnReset` releases it. +only a fresh `Rot` on `PowerOnReset` releases it. If `self_trial_booted` is +set, emit `ConfirmSelfTrial` and clear it: the chain coming up is the verdict +on the trial image the eRoT booted, and the answer to UpdateSecurityRevision +checks the confirmed session. The Update Agent requests whenever it likes, and +the eRoT refuses the request before the confirm. | Event | Guard | Effects | Next state | |---|---|---|---| -| `UpdateRequest` | — | — | `Updating` | +| `UpdateRequest(id)` | `pending_commit` clear, or `== Some(id)` | — | `Updating(id)` | +| `UpdateRequest(id)` | `pending_commit` names another component | — | `Outcome::Super` → `SupervisingPlatform` (refused: entry to `Updating` would revert a trial the downstream device may still confirm) | +| `BootConfirmed(id)` | `pending_commit == Some(id)` | `ConfirmDeviceTrial(id)` | `Handled` (window closed; `id` moves to `awaiting_floor_advance`) | +| `BootConfirmed(id)` | otherwise | — | `Handled` (no window open for `id`) | +| `SvnCommitRequest(id)` | `awaiting_floor_advance == Some(id)` | `CommitSvnFloor(id)` | `Handled` | +| `SvnCommitRequest(id)` | otherwise | — | `Handled` (no SVN floor advance outstanding for `id`; the floor takes the SVN once) | +| `CommitTimeout` | `pending_commit` set | — | `Locked` (`LatchLockdown` on entry) | +| `CommitTimeout` | `pending_commit` clear | — | `Handled` | | anything else | — | — | `Outcome::Super` → `SupervisingPlatform` | --- ### `Updating` -An update is in progress. +An update is in progress on the component the request named, which is the +state's payload. -**Entry action**: emit `AuthenticateUpdate` + `StageUpdate`. +**Entry action**: emit `RevertDeviceTrial(id)` for a component left on trial +by an earlier activation, then `AuthenticateStageUpdate`. The superseded image +never got the boot that would confirm it, so the trial closes without keeping +it. > **Rejected** here has a specific meaning from the CSA authenticated-update > sequence: the staged candidate failed verification — its signature did not @@ -199,9 +225,9 @@ An update is in progress. | Event | Guard | Effects | Next state | |---|---|---|---| -| `UpdateVerified` | — | `ActivateUpdate` | `Ready` | +| `UpdateVerified` | — | `ActivateUpdate` | `PreSupervision` (re-walk; commit window spans the walk) | | `UpdateRejected` | — | `DiscardStaged` | `Ready` (INV4) | -| `CorruptionDetected(id)` | `Required`/unknown | `DiscardStaged` (then `RestoreGoldenImage` on entry) | `Recovering(id)` (update preempted; staged image discarded) | +| `CorruptionDetected(id)` | `Required`/unknown | `DiscardStaged` (then `RecoverComponent` on entry) | `Recovering(id)` (update preempted; staged image discarded) | | `CorruptionDetected(id)` | `Isolable`/`Cascading` | `AssertReset(id)` · `ReportIsolated(id)` | `Handled` (component gated; update continues, staged image kept) | | anything else | — | — | `Outcome::Super` → `SupervisingPlatform` | @@ -217,9 +243,12 @@ so its staged image is kept. The machine is attempting to restore a corrupted or rejected component. -**Entry action**: emit `RestoreGoldenImage(failed)`, where `failed` is the -`Recovering(ComponentId)` payload — targets the failed component's *recovery -region*: all components sharing the same `RegionId` are restored together. The +**Entry action**: emit `RevertDeviceTrial(id)` for a component left on trial +by an earlier activation (recovery puts the running image under suspicion), +then `RecoverComponent { id: failed, attempt }`, where `failed` is the +`Recovering(ComponentId)` payload and `attempt` is the consecutive-recovery +count for it. The effect targets the failed component's *recovery region*: +all components sharing the same `RegionId` are restored together. The core supplies the failed component ID; the platform driver resolves region membership from the chain at startup. Only the named component triggers the restore, but the @@ -232,11 +261,26 @@ entire region is affected (not the whole chain — INV5). | `Restored(id)` | `id == failed`, cap reached, `Isolable` | `AssertReset(failed)` · `ReportIsolated(failed)` | `PreSupervision` (recovery exhausted: mark `failed` `Isolated`, reset its `retry`; the re-walk skips it) | | `Restored(id)` | `id == failed`, cap reached, `Cascading` | `AssertReset` · `ReportIsolated` (per component) | `PreSupervision` (recovery exhausted: mark `failed` + `depends_on` dependents `Isolated`) | | `Restored(id)` | `id == failed`, cap reached, `Required` | `ReportRecoveryFailed(failed)` · `Effect::Emit(RecoveryFailed)` | `Handled` (orchestrator queues `RecoveryFailed` next — INV7) | +| `RecoveryUnavailable(id)` | `id != failed` | — | `Handled` (stale — belongs to a displaced episode) | +| `RecoveryUnavailable(id)` | `id == failed`, `Isolable` | `AssertReset(failed)` · `ReportIsolated(failed)` | `PreSupervision` (exhausted immediately, bypassing the retry cap) | +| `RecoveryUnavailable(id)` | `id == failed`, `Cascading` | `AssertReset` · `ReportIsolated` (per component) | `PreSupervision` (exhausted immediately) | +| `RecoveryUnavailable(id)` | `id == failed`, `Required` | `ReportRecoveryFailed(failed)` · `Effect::Emit(RecoveryFailed)` | `Handled` | | `RecoveryFailed` | — | — | `Locked` | | anything else | — | — | `Outcome::Super` → `SupervisingPlatform` | ("cap reached" = `retry + 1 >= max_retry`.) +**`RecoveryUnavailable` is the platform's own exhaustion signal.** Where +`Restored` past the retry cap means "the machine gave up after counting failed +restores," `RecoveryUnavailable` means "the platform driver reports no +recovery source left for this component" — reported in place of `Restored` +when it has no untried image/slot to swap in. It is authoritative: it runs +the same exhaustion handling as the retry cap (`Isolable`/`Cascading` gate and +skip, `Required` locks) immediately, without bumping or waiting on `retry`. +This keeps `max_retry` a pure liveness backstop against a restore that keeps +"succeeding" without ever re-verifying clean, rather than the only way +recovery ever ends. + **Two-stage recovery (CSA-aligned).** A verification failure never skips a component outright. Every failure — during initial boot or a re-walk — first brings the machine here, to `Recovering`, which restores the failed component's @@ -314,6 +358,9 @@ handler (`handle_supervising`). | `AttestationChallenge` | — | `SignAttestation` | `Handled` (no transition — INV6) | | `CorruptionDetected(id)` | `attrs.failure_policy == Required` | — | `Recovering(id)` (INV5) | | `CorruptionDetected(id)` | `attrs.failure_policy != Required` | `AssertReset(id)` · `ReportIsolated(id)` | `Handled` (component gated; machine stays in current state) | +| `UpdateRequest(_)` | — | `ReportUpdateDeferred` | `Handled` (a walk, an update or a recovery is running, or a trial is open for another component) | +| `CommitTimeout` | `pending_commit` set | — | `Locked` (the post-activation walk passes through supervised states too; `LatchLockdown` on entry) | +| `CommitTimeout` | `pending_commit` clear | — | `Handled` | | anything else | — | — | `Outcome::Super` (discarded) | --- @@ -353,6 +400,7 @@ the named test(s). | INV10 | An `Active` component **gates** the chain walk — the cursor does not advance past it until its `ComponentReady` arrives. | `active_component_gates_on_component_ready` | | INV11 | `SelfVerificationFailed` at power-on latches `Locked` immediately, without entering `PreSupervision`. | `self_verification_failure_latches_immediately` | | INV12 | `AttestationChallenge` is also handled in `AwaitingReady`. | `attestation_in_awaiting_ready` | +| INV13 | The state machine emits `CommitSvnFloor(id)` at most once per activation of `id`, and only on a `SvnCommitRequest(id)` that follows a `BootConfirmed(id)` which found the commit window open. | `property_floor_commits_once_per_activation_after_a_confirm` | --- diff --git a/docs/src/design/orchestrator/orchestrator-model.md b/docs/src/design/orchestrator/orchestrator-model.md index 3d39187de..c10e275a8 100644 --- a/docs/src/design/orchestrator/orchestrator-model.md +++ b/docs/src/design/orchestrator/orchestrator-model.md @@ -50,8 +50,14 @@ time; the core never derives it. ``` Active — has an integrated iRoT (e.g. Caliptra); both eRoT and iRoT checks apply Passive — no integrated iRoT; only the eRoT check applies +Erot — the eRoT itself, chain position 0; never released, walked or recovered ``` +`Erot` is in the chain because the eRoT is an update target like any other +component, not because anything supervises it: it is already running when the +walk starts, and nothing can reset the thing that drives the reset lines. The +walk steps past it the way it steps past a gated component. + In CSA terminology: `Active` corresponds to a *SoC with an integrated iRoT* (e.g. a BMC or CPU with Caliptra). `Passive` corresponds to a *symbiont device* — per NIST SP 800-193 §3.4, a device that lacks the capability to perform its @@ -305,7 +311,7 @@ invariant: > it was released, since the most recent full walk. No live component is ever > re-verified. -Re-verifying a still-live sibling from a previous walk would be meaningless: its +Re-verifying a still-live component from a previous walk would be meaningless: its earlier pass belongs to a walk that is over, and nothing has held it at rest since. Recovery returns the platform to a known-held state and rebuilds trust from there, exactly as power-on does. @@ -358,7 +364,7 @@ This inversion is what keeps the core testable without hardware: a test drives `Event`s in and asserts on the `Effect`s that come out, with no flash, no transports, and no clocks. It also fixes *where mechanism lives*. The core names **what** must happen to **which** component; the platform decides **how**. -For example, `Effect::RecoverComponent(id)` says only "recover this component" — +For example, `Effect::RecoverComponent` says only "recover this component"; whether that resolves to a golden-image restore, an A/B slot swap, a streamed image, or a vendor-specific scheme is a platform/configuration decision, never encoded in the core. @@ -419,7 +425,7 @@ policy deployments configure. delivered as `PowerOnResult` in `Event::PowerGood`. - **Attestation** (`AttestationChallenge` / `SignAttestation`): handled in the `SupervisingPlatform` superstate, not part of the boot-time verification chain. -- **Firmware update verification** (`AuthenticateUpdate`): handled in the +- **Firmware update verification** (`AuthenticateStageUpdate`): handled in the `Updating` state, distinct from boot-time chain verification. - **Multiple intermediate boot-progress checkpoints per component**: the CSA architecture allows platform policy to require multiple intermediate @@ -428,3 +434,42 @@ policy deployments configure. The platform is responsible for aggregating any intermediate signals and delivering `ComponentReady` only once all platform-policy checkpoints have been satisfied. + +## 8. Who the Orchestrator Trusts During an Update + +Firmware bytes never pass through the orchestrator. The PLDM firmware +device writes the candidate to the flash service, and the crypto service +reads it back from that same service to hash it. The orchestrator +commands each phase (accept the offer, verify, apply, activate) and +receives a verdict, so it controls policy and never touches data. The trade is +forced by size: a candidate is megabytes, it does not fit in RAM, and +routing it through the orchestrator would cost a copy per chunk and +block the event loop that has to keep answering boot signals. + +Three things follow, and none of them are enforceable from where the +orchestrator sits. + +It cannot check that the image the crypto service hashed is the image +the firmware device staged. It commands verify and believes the verdict. + +It cannot check that the flash service served the staged bytes rather +than stale or substituted ones. There is no second read path to the +staging region. + +It cannot check that an image landed in the slot it named. Slot +identity stays behind the device adapter. + +Against an external attacker this costs nothing. A BMC that offers a +forged image fails the signature check inside the crypto service, and +the orchestrator's command never entered into that outcome. + +Against a compromised service on the eRoT itself the orchestrator is not +the defence and cannot be made into one, because it has no independent +access to the flash. That case is answered in hardware: the SPI +protection filter that keeps the host off the RoT's flash, or a second +reader on a path the suspect service does not own. + +So the split is that the orchestrator owns policy, meaning who may +update, when, which components are isolated, and when the SVN floor +advances, and the crypto service owns data integrity. The orchestrator +trusts the verdict and does not re-check the contents. diff --git a/docs/src/design/orchestrator/orchestrator-overview.md b/docs/src/design/orchestrator/orchestrator-overview.md index 54f14166f..2872f7f3e 100644 --- a/docs/src/design/orchestrator/orchestrator-overview.md +++ b/docs/src/design/orchestrator/orchestrator-overview.md @@ -1,4 +1,4 @@ -# Orchestrator State Machine +# Orchestrator The orchestrator is the eRoT's boot-sequence controller. It walks the platform trust chain — verifying each component's firmware and releasing it from reset in @@ -28,6 +28,10 @@ avoid the two drifting apart. - [**Platform Architecture**](./orchestrator-platform.md): The platform half around the core — surrounding services, capability contracts, the board device table, and the fail-safe rules at the responsibility boundary. +- [**Runtime**](./orchestrator-runtime.md): How the runtime loop + gathers hardware interrupts, IPC channel messages, and watchdog deadlines into + the core's event stream, and carries the resulting effects and decisions back + out. ## Design Principles @@ -48,6 +52,22 @@ hiding them as implicit state changes. See the The platform supplies the trust chain (component ids, kinds, and required/optional policy) and the recovery-retry cap at startup. +## Board composition + +*Board composition* (or *system composition*) is the per-target choice — described +declaratively in a [`system.json5`](../../architecture.md) file, assembled by +Pigweed at build time — of how the platform's functions are split across +processes and which resources each process owns: hardware register blocks and the +kernel [interrupt objects and IPC channels](../pw-kernel-ipc.md) built on top of +them. It is separate from the +board-supplied *policy* above: policy is *what* to verify (the trust chain); +composition is *how* the surrounding services are wired. The orchestrator core +and its platform-agnostic crates are the same across every composition — a driver +may own a GPIO bank and forward boot-progress over a channel in one image, while +the orchestrator holds the pins directly in another. That choice changes which +inbound sources the [runtime](./orchestrator-runtime.md) sees and who owns each +device, but never the core's states or the loop that serves them. + ## Relationship to CSA Architecture The state machine is a direct implementation of the boot sequence described in @@ -61,7 +81,7 @@ the CSA architecture document: | Isolable component: failure skips, not blocks | `FailurePolicy::Isolable` → skip (held in reset); advance without `Recovering`; no cascade | | Cascading skip: failure also holds dependents | `FailurePolicy::Cascading` + `ComponentAttrs::depends_on` → cascade-skip via `statuses` (`Isolated`) | | Boot-progress watchdog: component must signal readiness in time | `Timeout(ComponentId)` event → `AwaitingReady` → `Recovering` | -| Recovery scope groups components that restore together | `ComponentAttrs::recovery_region` (`RegionId`) → platform restores full region on `RestoreGoldenImage` | +| Recovery scope groups components that restore together | `ComponentAttrs::recovery_region` (`RegionId`) → platform restores full region on `RecoverComponent` | ## Applicability Across Admissible Architectures diff --git a/docs/src/design/orchestrator/orchestrator-platform.md b/docs/src/design/orchestrator/orchestrator-platform.md index ddc9e3b5c..251d99e11 100644 --- a/docs/src/design/orchestrator/orchestrator-platform.md +++ b/docs/src/design/orchestrator/orchestrator-platform.md @@ -44,7 +44,7 @@ Two rules follow: - **Protection survives its crash.** The SPI monitor filters flash traffic in hardware, on its own; the orchestrator only loads its rules at boot and is not in the data path, and the hardware write filter stays - armed until the device's first fetch, closing the + enabled until the device's first fetch, closing the time-of-check/time-of-use window. Busy or crashed, the orchestrator cannot be bypassed — there is nothing to bypass. diff --git a/docs/src/design/orchestrator/orchestrator-runtime.md b/docs/src/design/orchestrator/orchestrator-runtime.md new file mode 100644 index 000000000..fbff52c24 --- /dev/null +++ b/docs/src/design/orchestrator/orchestrator-runtime.md @@ -0,0 +1,111 @@ +# Runtime + +The **runtime** is the orchestrator's event loop: the single task that sits +between two collaborators — the pure [state machine](./orchestrator-machine.md) +(the *core*) that decides, and the `PlatformDriver` that executes — turning +outside happenings (interrupts, timeouts, IPC messages) into the `Event`s the +core consumes, and handing the `Effect`s it emits to the driver. It holds no +policy of its own — every decision stays in the core; the runtime only moves +information across the process boundary. + +It gathers three possible inbound sources — **hardware interrupts** +(boot-progress lines the orchestrator owns directly), **IPC channels**, and +**watchdog deadlines** (timeouts) — into the one event stream the core +supervises, and carries the core's decision back out. Which sources are present +is a [board-composition](./orchestrator-overview.md#board-composition) choice: +boot-progress is a hardware interrupt only when the orchestrator owns the pins; +otherwise a monitor forwards it as an IPC message. + +The unifying idea is the kernel **wait group**: interrupts and IPC are not +separate mechanisms but interchangeable *members* of one group, and a watchdog +deadline is that same wait's *timeout* — so all three collapse into the return +of one `object_wait(handle, signal_mask, deadline)`. A *signal* here is just a +named bit on a waitable object, not a source in its own right: a latched IRQ bit +on an interrupt object, or `READABLE` / `USER` on a channel (a service raises +`Signals::USER` on a client channel to notify without a reply). The loop is +written once against "a member that signaled, or the deadline that lapsed," +never against a specific source; what differs between sources is only the +*decoder* that turns each into an `Event`. + +Two neighboring pages carry the supporting detail: +[Platform Architecture](./orchestrator-platform.md) names the services and the +responsibility boundary, and [pw_kernel IPC](../pw-kernel-ipc.md) gives the +concrete channel syscalls. The worked, compiling reference is the QEMU +integration test at `target/ast10x0/tests/orchestrator/runtime/main.rs`. + +## The single wait point + +The runtime is a single-threaded loop parked in one place: a kernel +`object_wait` over a **wait group**. Every inbound source is registered once as a +*member* of that group (`wait_group_add`), and the wait returns whichever member +signaled. Each member resolves to at most one `Event`: + +- **Boot-progress signals** — a component reaching a checkpoint raises a + boot-progress signal. Depending on the board's composition it arrives as an + interrupt object the orchestrator holds directly or as a message a monitor + forwards over a channel; either way the loop maps it to + [`Event::ComponentReady`] (an `Active` component's iRoT-verified readiness) + or [`Event::Booted`] (a `Passive` component's liveness). +- **Watchdog deadlines** — the timer is not a separate task. `BootWatchdogs` + (`services/orchestrator/server`) folds all armed boot windows and the commit + window into a *single deadline* passed straight to `object_wait`. When the + wait returns `DeadlineExceeded`, `poll_expired()` yields the mapped + [`Event::Timeout`] / [`Event::CommitTimeout`]. +- **IPC channel messages** — an update agent, management path, peer service, or + a boot-progress-forwarding monitor holds a channel *initiator*; the runtime + holds the *handler*. A readable channel is another object the loop waits on; + its message decodes to an `Event` — an [`Event::UpdateRequest`] to answer, or + a forwarded [`Event::Booted`] / [`Event::ComponentReady`] notification. + +The three share one `object_wait`, so a slow image hash on one path cannot +delay a boot window on another — this is the "never block" rule of the +[Platform Architecture](./orchestrator-platform.md#responsibility-scope) made +concrete: the loop only ever blocks at the wait, and only until the *nearest* +of any signal, any channel, or the nearest deadline. + +**Members are uniform; only the decode differs.** A wait-group member is an +object watched for a signal bit — a latched IRQ bit on an *interrupt object*, or +`READABLE` / `USER` on a *channel* — and the loop treats them identically: wait, +see which member signaled, run that member's decode, dispatch the resulting +`Event`. Nothing above the decode step knows which kind a member is. That +uniformity pushes two questions *below* the runtime layer, where they belong: + +- **Who owns the underlying hardware** — does the orchestrator own the GPIO bank + and hold the boot-progress interrupt object itself, or does a monitor/GPIO + server own the pins and forward boot-progress over a channel? — is a + [board-composition](./orchestrator-overview.md#board-composition) choice made + in `system.json5`. Either shape is just one member of the group; the loop is + byte-for-byte the same. +- **What a member means** is the per-member decode. + +```mermaid +flowchart LR + subgraph SRC["Inbound sources (SIG/CH are wait-group members; TMR is the wait's timeout; boot-progress rides CH if a monitor owns the pins)"] + SIG["Boot-progress signal
(directly-owned interrupt object, latched)"] + TMR["Watchdog deadline
(BootWatchdogs → one Instant)"] + CH["IPC channel
(handler endpoint, READABLE)"] + end + + WAIT["object_wait(signals, deadline)
the single park point"] + + subgraph MAP["Inbound adapters (source → Event)"] + SMAP["signal → ComponentReady / Booted"] + TMAP["poll_expired → Timeout / CommitTimeout"] + CMAP["channel_read → decode → UpdateRequest / ..."] + end + + CORE["Orchestrator::dispatch
(pure reducer)"] + + OUT["Effects → PlatformDriver
+ response → channel_respond"] + + SIG --> WAIT --> SMAP --> CORE + TMR --> WAIT --> TMAP --> CORE + CH --> WAIT --> CMAP --> CORE + CORE --> OUT +``` + +[`Event::ComponentReady`]: ./orchestrator-machine.md +[`Event::Booted`]: ./orchestrator-machine.md +[`Event::Timeout`]: ./orchestrator-machine.md +[`Event::CommitTimeout`]: ./orchestrator-machine.md +[`Event::UpdateRequest`]: ./orchestrator-machine.md diff --git a/docs/src/design/trust-boundaries.md b/docs/src/design/trust-boundaries.md new file mode 100644 index 000000000..1297e98c8 --- /dev/null +++ b/docs/src/design/trust-boundaries.md @@ -0,0 +1,55 @@ +# Trust Boundaries + +This page explains what OpenPRoT trusts and what it does not. It is +written for developers working on the orchestrator and its services. For +the formal threat analysis (assets, attacker profiles, mitigations), see +[Threat Model](../specification/threat_model.md). + +## The one rule + +Everything inside the RoT chip is trusted. Everything outside is not. + +The chip boundary is the trust boundary. Code running inside the chip +(the orchestrator, the crypto service, the flash service, the PLDM +service) all trust each other. They share the same hardware, the same +boot chain, and the same update path. If any one of them is compromised, +the whole RoT is compromised, so treating them as mutually suspicious +would add complexity without adding security. + +## What this means in practice + +**IPC between services needs no authentication.** The kernel enforces +which processes can open which channels, and that is enough. We do not +sign or add integrity tags to internal messages. + +**Flash contents are untrusted.** Firmware images on flash were written +by something outside the chip (a BMC, a host, a debug tool). The +orchestrator treats every image as potentially tampered until the crypto +service says otherwise. + +**Everything arriving over MCTP is adversarial.** The PLDM service +validates every field before acting on it. A malformed or unexpected +message is dropped, not trusted. + +**The BMC is not trusted.** An update is accepted because it passes +signature verification, not because the BMC sent it. + +For threats the orchestrator does not defend against (compromised RoT +hardware, BMC denial of service), see the +[Threat Model](../specification/threat_model.md#threat-modeling). + +## How this guides code + +When you are writing code inside the RoT: + +- Do not add authentication, signatures, or integrity tags to internal + IPC. It is wasted work. +- Validate everything that crosses the chip boundary: PLDM fields, + flash contents, SPDM payloads. +- Do not assume flash contains what you last wrote. The flash medium is + reachable from outside the chip, so its contents can change after the + write returns. +- Trust results from internal services. If the crypto service says + "authenticated" or the flash service says "write succeeded", that + answer is final. Readback exists to catch flash corruption, not to + second-guess a service inside the chip. diff --git a/hal/BUILD.bazel b/hal/BUILD.bazel new file mode 100644 index 000000000..e4da99857 --- /dev/null +++ b/hal/BUILD.bazel @@ -0,0 +1,25 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_doc", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "hal", + srcs = glob([ + "src/*.rs", + "src/**/*.rs", + ]), + crate_name = "openprot_hal", + edition = "2024", + deps = [ + "//util/region", + "@rust_crates//:embedded-hal", + ], +) + +rust_doc( + name = "openprot_hal_doc", + crate = ":hal", +) diff --git a/hal/blocking/flash/driver.rs b/hal/blocking/flash/driver.rs index 378152bf0..9d1ce5517 100644 --- a/hal/blocking/flash/driver.rs +++ b/hal/blocking/flash/driver.rs @@ -23,12 +23,18 @@ pub trait FlashDriver { /// The error type returned by driver operations. type Error; - /// The default page size in bytes. - const PAGE_SIZE: usize; + /// The page size in bytes. + /// + /// Prefer the [`page_size`](Self::page_size) method which is flexible to serve + /// statically defined or runtime discovered values. + const PAGE_SIZE: usize = 0; /// The maximum size of a single program operation (write window). /// Program operations cannot span across boundaries aligned to this size. - const PROGRAM_WINDOW_SIZE: usize; + /// + /// Prefer the [`program_window_size`](Self::program_window_size) method + /// which is flexible to serve statically defined or runtime discovered values. + const PROGRAM_WINDOW_SIZE: usize = 0; /// The maximum size of a single read operation. const MAX_READ_SIZE: usize; @@ -42,6 +48,17 @@ pub trait FlashDriver { /// Returns the total size of the flash in bytes. fn size(&self) -> NonZero; + /// Page size in bytes. + fn page_size(&self) -> usize { + Self::PAGE_SIZE + } + + /// The maximum size of a single program operation (write window). + /// Program operations cannot span across boundaries aligned to this size. + fn program_window_size(&self) -> usize { + Self::PROGRAM_WINDOW_SIZE + } + /// Returns a bitmap of supported erase block sizes. /// /// Each bit `i` represents a supported erase block size of `2^i` bytes. diff --git a/hal/blocking/flash/flash.rs b/hal/blocking/flash/flash.rs index 072e83c7d..da717ed12 100644 --- a/hal/blocking/flash/flash.rs +++ b/hal/blocking/flash/flash.rs @@ -166,17 +166,18 @@ impl Flash for BlockingFlash Result<(), Self::Error> { + let program_window_size = self.driver.program_window_size(); assert!( - TDriver::PROGRAM_WINDOW_SIZE.count_ones() == 1, - "TDriver::PROGRAM_WINDOW_SIZE must be a power of 2" + program_window_size.count_ones() == 1, + "program_window_size() must be a power of 2" ); - let window_mask = TDriver::PROGRAM_WINDOW_SIZE - 1; + let window_mask = program_window_size - 1; let mut addr = start_addr; while !data.is_empty() { // Calculate bytes remaining in the current program window let chunk = &data[..min( data.len(), - TDriver::PROGRAM_WINDOW_SIZE - ((addr.offset() & window_mask as u32) as usize), + program_window_size - ((addr.offset() & window_mask as u32) as usize), )]; self.driver.start_program(addr, chunk)?; self.blocking.wait_for_notification(); @@ -263,15 +264,15 @@ mod test { data: &[u8], ) -> Result<(), Self::Error> { let start_addr = start_addr.offset() as usize; + let program_window_size = self.program_window_size(); assert!(start_addr.checked_add(data.len()).unwrap() <= self.data.len()); assert!( - data.len() <= Self::PROGRAM_WINDOW_SIZE, + data.len() <= program_window_size, "Program window violation" ); let end_addr = start_addr.wrapping_add(data.len()); assert!( - start_addr / Self::PROGRAM_WINDOW_SIZE - == (end_addr - 1) / Self::PROGRAM_WINDOW_SIZE, + start_addr / program_window_size == (end_addr - 1) / program_window_size, "Program window violation" ); for (dest, src) in self.data[start_addr..end_addr].iter_mut().zip(data) { diff --git a/hal/src/field_mux.rs b/hal/src/field_mux.rs new file mode 100644 index 000000000..b4318ee27 --- /dev/null +++ b/hal/src/field_mux.rs @@ -0,0 +1,264 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Register-field mux mechanism: inline `FieldWrite`s coalesced to one RMW per register at compile time. + +use crate::resource::FieldWrite; +use core::marker::PhantomData; + +/// Fixed-size compile-time coalescing scratch; narrowed to the exact live count before apply, so it never reaches the binary. +pub(crate) const MAX_REGS: usize = 16; + +/// Central batch of register writes, coalesced to one op per distinct offset: `[..len]` of `ops` live. +#[derive(Clone, Copy)] +pub struct RegBatch { + /// Register ops, one per distinct offset; only `[..len]` are valid. + ops: [FieldWrite; MAX_REGS], + /// Number of live ops. + len: usize, +} + +impl RegBatch { + /// An empty accumulator. + #[must_use] + pub const fn new() -> Self { + Self { + ops: [FieldWrite { + offset: 0, + set: 0, + clr: 0, + }; MAX_REGS], + len: 0, + } + } + + /// Coalesce one write into the batch, grouped by register offset via [`find`](Self::find). + const fn push(&mut self, w: FieldWrite) { + let j = self.find(w.offset); + if j == self.len { + assert!(self.len < MAX_REGS, "MAX_REGS too small"); + self.ops[self.len] = w; + self.len += 1; + } else { + self.ops[j].coalesce(w); + } + } + + ///merges via `FieldWrite::coalesce`. Crate-private, can only be called by fns with pin token authority provided. + pub(crate) const fn append(&mut self, writes: &[FieldWrite]) { + let mut i = 0; + while i < writes.len() { + self.push(writes[i]); + i += 1; + } + } + + /// Merge another batch's live ops in, coalescing per register — the tuple/handle-list fold step. + pub(crate) const fn append_batch(&mut self, other: &RegBatch) { + let mut i = 0; + while i < other.len { + self.push(other.ops[i]); + i += 1; + } + } + + /// Live op count — the exact `N` [`into_ops`](Self::into_ops) narrows to so the fixed scratch tail never reaches the binary. + #[must_use] + pub const fn len(&self) -> usize { + self.len + } + + /// True if no route has been appended yet. + #[must_use] + pub const fn is_empty(&self) -> bool { + self.len == 0 + } + + /// Consume the batch into its exact `[FieldWrite; N]` ops (no zeroed tail); const-panics unless `N == len`. + #[must_use] + pub const fn into_ops(self) -> [FieldWrite; N] { + assert!(self.len == N, "into_ops: N must equal batch len"); + let mut out = [FieldWrite { + offset: 0, + set: 0, + clr: 0, + }; N]; + let mut k = 0; + while k < N { + out[k] = self.ops[k]; + k += 1; + } + out + } + + // HACK: the MAX_REGS-wide `ops` rides to rodata; `into_ops` trims it but needs generic_const_exprs. + /// The live ops as a tight slice — `[..len]` of the fixed scratch. + #[must_use] + pub const fn as_slice(&self) -> &[FieldWrite] { + self.ops.split_at(self.len).0 + } + + /// Index of `offset` in `ops[..len]`, or `len` if absent — group-by-register for [`append`]. + const fn find(&self, offset: u32) -> usize { + let mut j = 0; + while j < self.len { + if self.ops[j].offset == offset { + return j; + } + j += 1; + } + self.len + } +} + +impl Default for RegBatch { + fn default() -> Self { + Self::new() + } +} + +/// A register block a coalesced mux batch can be applied to: one read + one write per offset. +/// A target impls these two methods once; `apply` replaces a per-offset match in the applier. +pub trait RegBlock { + /// Read the 32-bit register at `offset`. + fn read_reg(&self, offset: u32) -> u32; + /// Write `val` to the 32-bit register at `offset`. + fn write_reg(&self, offset: u32, val: u32); +} + +/// Apply an exact-N mux batch to a block: one RMW (`reg = (reg & !clr) | set`) per register. Panic-free — a flat walk over the tight slice, no indexing. +pub fn apply(block: &impl RegBlock, batch: &[FieldWrite]) { + for op in batch { + block.write_reg(op.offset, (block.read_reg(op.offset) & !op.clr) | op.set); + } +} + +/// Coalesce a list of per-pin routes into one batch (one RMW per register) — the compile-time fold. +#[must_use] +pub const fn coalesce_routes(routes: &[&[FieldWrite]]) -> RegBatch { + let mut b = RegBatch::new(); + let mut i = 0; + while i < routes.len() { + b.append(routes[i]); + i += 1; + } + b +} + +/// A bound handle (or tuple of handles) whose SCU mux routes are folded to one RMW per register at +/// compile time in [`COALESCED`](MuxRoutes::COALESCED); the applier just flushes that const. +pub trait MuxRoutes { + /// This handle's routes, coalesced to one op per register — folded per monomorphization at compile time. + const COALESCED: RegBatch; + /// Distinct-register count of [`COALESCED`](Self::COALESCED) — the exact array length to narrow to before apply. + const LEN: usize = Self::COALESCED.len(); +} + +/// Route a handle through a shared reference: the applier reads only the type, so a borrow folds identically — non-Copy owners route without being consumed. +impl MuxRoutes for &H { + const COALESCED: RegBatch = H::COALESCED; +} + +/// Impl [`MuxRoutes`] for every tuple arity by folding each member's `COALESCED` into one batch at +/// compile time; recurses on the tail, so one invocation covers all arities down to the 1-tuple. +macro_rules! impl_muxroutes_tuple { + () => {}; + ($head:ident $(, $tail:ident)*) => { + impl<$head: MuxRoutes $(, $tail: MuxRoutes)*> MuxRoutes for ($head, $($tail,)*) { + const COALESCED: RegBatch = { + let mut out = RegBatch::new(); + out.append_batch(&$head::COALESCED); + $( out.append_batch(&$tail::COALESCED); )* + out + }; + } + impl_muxroutes_tuple!($($tail),*); + }; +} + +// HACK: tuple arity caps pins-per-apply at this ident count (no variadic generics); widen the list if needed. +impl_muxroutes_tuple!(A, B, C, D, E, F, G, H, I, J, K, L); + +/// A silicon-fixed singleton register block (e.g. the SCU): `BASE` names it, no pin token carries it. +/// +/// # Safety +/// `BASE` must name a valid, `'static`, aligned register block usable for `u32` volatile access at every offset its driver touches. +#[allow(unsafe_code)] +pub unsafe trait Block { + /// The silicon-fixed base of this singleton register block. + const BASE: *const u8; +} + +/// Confined MMIO applier over block `B`, phantom-typed so one block's applier can't stand in for another's. +pub struct Mmio { + base: *const u8, + _block: PhantomData, +} + +impl Clone for Mmio { + fn clone(&self) -> Self { + *self + } +} +impl Copy for Mmio {} + +impl Mmio { + /// HAL-internal ctor: base always rides on authored `DATA` or a `Block::BASE`, whose validity was promised upstream. + #[must_use] + pub(crate) const fn from_raw(base: *const u8) -> Self { + Self { + base, + _block: PhantomData, + } + } + + /// Read the 32-bit register at byte `offset`. + #[must_use] + pub fn read_reg(&self, offset: u32) -> u32 { + // SAFETY: `base` names a valid register block sized for `u32` access at every offset used. + #[allow(unsafe_code)] + // nosemgrep + unsafe { + self.base.add(offset as usize).cast::().read_volatile() + } + } + + /// Write `val` to the 32-bit register at byte `offset`. + pub fn write_reg(&self, offset: u32, val: u32) { + // SAFETY: `base` names a valid register block sized for `u32` access at every offset used. + #[allow(unsafe_code)] + // nosemgrep + unsafe { + (self.base.add(offset as usize) as *mut u32).write_volatile(val) + } + } + + /// True if `bit` is set in the register at byte `offset`. + #[must_use] + pub fn read_bit(&self, offset: u32, bit: u8) -> bool { + self.read_reg(offset) & (1 << bit) != 0 + } + + /// Read-modify-write a `mask`-wide field at `shift` in the register at `offset` to `val`. + pub fn modify_field(&self, offset: u32, shift: u8, mask: u32, val: u32) { + let cur = self.read_reg(offset); + self.write_reg(offset, (cur & !(mask << shift)) | ((val & mask) << shift)); + } +} + +impl Mmio { + /// Mint a token-less singleton's applier from its `Block::BASE`; safe, the `unsafe impl Block` made the promise. + #[must_use] + pub const fn block() -> Self { + Self::from_raw(B::BASE) + } +} + +impl RegBlock for Mmio { + fn read_reg(&self, offset: u32) -> u32 { + Mmio::read_reg(self, offset) + } + fn write_reg(&self, offset: u32, val: u32) { + Mmio::write_reg(self, offset, val) + } +} diff --git a/hal/src/gpio.rs b/hal/src/gpio.rs new file mode 100644 index 000000000..41b146975 --- /dev/null +++ b/hal/src/gpio.rs @@ -0,0 +1,485 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! GPIO pin capability: the [`Gpio`] role tag, its per-pin [`GpioData`] datum, the target's +//! [`GpioMap`] register-table, and the confined [`GpioPin`] accessor bound from a pin token. + +use crate::field_mux::{coalesce_routes, Mmio, MuxRoutes, RegBatch, MAX_REGS}; +use crate::resource::{field, Capability, Pin, Routes}; +use core::marker::PhantomData; +use util_region::{covers, Mmap, Region}; + +// A directed pin speaks the embedded-hal vocabulary; re-exported so callers need not name the crate. +pub use embedded_hal::digital::{InputPin, OutputPin}; + +/// GPIO-function capability: a pin muxable to GPIO, carrying [`GpioData`]. +pub struct Gpio; + +impl Capability for Gpio { + type Data = GpioData; +} + +/// One GPIO pin's datum: its bit slot in the GPIO register group. +#[derive(Clone, Copy)] +pub struct GpioData { + /// This pin's bit position within its GPIO register group. + pub bit: u8, + /// This pin's register group as data: base + per-role field ops + read handles at absolute offsets. + pub map: &'static GpioMap, +} + +/// One inert GPIO field op: write `value` into this pin's `width`-wide slot at absolute `offset`. +#[derive(Clone, Copy)] +pub struct RegOp { + /// Absolute byte offset of the register this op touches. + pub offset: u32, + /// Field width in bits per pin (1 for a plain data/dir bit, 2 for an STM32 `MODER`-style field). + pub width: u8, + /// Value written into this pin's field (its low `width` bits). + pub value: u32, +} + +impl RegOp { + /// Set the pin's single bit at `offset` (width-1 field, value 1) — the common one-bit-per-pin fact. + #[must_use] + pub const fn set(offset: u32) -> Self { + Self::field(offset, 1, 1) + } + + /// Clear the pin's single bit at `offset`. + #[must_use] + pub const fn clear(offset: u32) -> Self { + Self::field(offset, 1, 0) + } + + /// Write `value` into this pin's `width`-wide field at `offset` — the multi-bit escape (STM32 `MODER`). + #[must_use] + pub const fn field(offset: u32, width: u8, value: u32) -> Self { + Self { + offset, + width, + value, + } + } +} + +/// A checked read handle over an absolute register offset; `W1C` marks a write-1-to-clear (status) register. +#[derive(Clone, Copy)] +pub struct Reg(u32); + +impl Reg { + /// Wrap a register offset; `W1C` marks a write-1-to-clear (interrupt-status) register. + #[must_use] + pub const fn new(offset: u32) -> Self { + Self(offset) + } +} + +/// A generic GPIO role; a target's [`GpioMap`] supplies the field ops that realize each one. +#[derive(Clone, Copy)] +pub enum GpioRole { + /// Drive as output. + Output, + /// Switch to input. + Input, + /// Drive high. + SetHigh, + /// Drive low. + SetLow, + /// Enable rising-edge interrupt. + EnableRising, + /// Enable falling-edge interrupt. + EnableFalling, + /// Enable high-level interrupt. + EnableLevelHigh, + /// Enable low-level interrupt. + EnableLevelLow, + /// Enable both-edge interrupt. + EnableBoth, + /// Disable interrupt. + DisableInt, +} + +/// One GPIO register group as data: base + per-role field ops (absolute offsets) + read handles; a pin carries `&'static`. +#[derive(Clone, Copy)] +pub struct GpioMap { + /// Base of the GPIO register block these offsets are relative to — one per chip, folded at use. + pub base: usize, + /// Field ops to drive as output. + pub output: &'static [RegOp], + /// Field ops to switch to input. + pub input: &'static [RegOp], + /// Field ops to drive high. + pub set_high: &'static [RegOp], + /// Field ops to drive low. + pub set_low: &'static [RegOp], + /// Field ops to enable rising-edge interrupt. + pub enable_rising: &'static [RegOp], + /// Field ops to enable falling-edge interrupt. + pub enable_falling: &'static [RegOp], + /// Field ops to enable high-level interrupt. + pub enable_level_high: &'static [RegOp], + /// Field ops to enable low-level interrupt. + pub enable_level_low: &'static [RegOp], + /// Field ops to enable both-edge interrupt. + pub enable_both: &'static [RegOp], + /// Field ops to disable interrupt. + pub disable_int: &'static [RegOp], + /// Read handle for the sampled input-level register — bit=1 reads high. + pub in_level: Reg, + /// Read handle for the output-latch register — bit=1 latched high. + pub out_level: Reg, + /// Read handle for the interrupt-enable register. + pub int_enable: Reg, + /// Read/write-1-to-clear handle for the interrupt-status register. + pub int_status: Reg, + /// Read handle for the both-edge sensitivity register — the IRQ verify read. + pub sense_both: Reg, +} + +impl GpioMap { + /// The field ops realizing `role` in this register group. + #[must_use] + pub const fn role(&self, role: GpioRole) -> &'static [RegOp] { + match role { + GpioRole::Output => self.output, + GpioRole::Input => self.input, + GpioRole::SetHigh => self.set_high, + GpioRole::SetLow => self.set_low, + GpioRole::EnableRising => self.enable_rising, + GpioRole::EnableFalling => self.enable_falling, + GpioRole::EnableLevelHigh => self.enable_level_high, + GpioRole::EnableLevelLow => self.enable_level_low, + GpioRole::EnableBoth => self.enable_both, + GpioRole::DisableInt => self.disable_int, + } + } +} + +/// Fold a role_cfg's field writes at ordinal 0 — the merge asserts on any set/clear contradiction; true if it merges clean. +const fn role_cfg_ok(role_cfg: &[RegOp]) -> bool { + let mut folded = RegBatch::new(); + let mut i = 0; + while i < role_cfg.len() { + let op = role_cfg[i]; + let mask = (1u32 << op.width) - 1; + folded.append(&[field(op.offset, 0, mask, op.value)]); + i += 1; + } + true +} + +/// Prove every register in the map declares one field width, so per-pin bit slots never overlap. +const fn pin_slots_disjoint(role_cfgs: &[&[RegOp]]) -> bool { + let mut regs = [0u32; MAX_REGS]; + let mut width = [0u8; MAX_REGS]; + let mut n = 0; + + let mut v = 0; + while v < role_cfgs.len() { + let role_cfg = role_cfgs[v]; + let mut i = 0; + while i < role_cfg.len() { + let op = role_cfg[i]; + let mut k = 0; + while k < n && regs[k] != op.offset { + k += 1; + } + if k == n { + assert!(n < MAX_REGS, "GpioMap touches more registers than MAX_REGS"); + regs[n] = op.offset; + width[n] = op.width; + n += 1; + } else { + assert!( + width[k] == op.width, + "GpioMap: two ops on one register declare different field widths — \ + pin slots would overlap, so a pin could clobber a neighbor" + ); + } + i += 1; + } + v += 1; + } + true +} + +/// Const-check every role_cfg in a map: the target asserts this once so a contradictory role_cfg is a compile +/// error, not a runtime panic. Enumerates each role_cfg; no loop, since the trait's role_cfg set is fixed. +/// Also proves the whole map is consistently slotted (`pin_slots_disjoint`) so per-pin confinement +/// holds against any role_cfg the map could name. +#[must_use] +pub const fn role_cfgs_ok(map: &GpioMap) -> bool { + role_cfg_ok(map.output) + && role_cfg_ok(map.input) + && role_cfg_ok(map.set_high) + && role_cfg_ok(map.set_low) + && role_cfg_ok(map.enable_rising) + && role_cfg_ok(map.enable_falling) + && role_cfg_ok(map.enable_level_high) + && role_cfg_ok(map.enable_level_low) + && role_cfg_ok(map.enable_both) + && role_cfg_ok(map.disable_int) + && pin_slots_disjoint(&[ + map.output, + map.input, + map.set_high, + map.set_low, + map.enable_rising, + map.enable_falling, + map.enable_level_high, + map.enable_level_low, + map.enable_both, + map.disable_int, + ]) +} + +/// One byte past the last register this map names — the extent a grant must cover. +const fn map_extent(map: &GpioMap) -> usize { + const fn top(ops: &[RegOp], max: u32) -> u32 { + let mut max = max; + let mut i = 0; + while i < ops.len() { + if ops[i].offset > max { + max = ops[i].offset; + } + i += 1; + } + max + } + const fn top_reg(offset: u32, max: u32) -> u32 { + if offset > max { + offset + } else { + max + } + } + + let mut max = 0; + max = top(map.output, max); + max = top(map.input, max); + max = top(map.set_high, max); + max = top(map.set_low, max); + max = top(map.enable_rising, max); + max = top(map.enable_falling, max); + max = top(map.enable_level_high, max); + max = top(map.enable_level_low, max); + max = top(map.enable_both, max); + max = top(map.disable_int, max); + max = top_reg(map.in_level.0, max); + max = top_reg(map.out_level.0, max); + max = top_reg(map.int_enable.0, max); + max = top_reg(map.int_status.0, max); + max = top_reg(map.sense_both.0, max); + max as usize + 4 +} + +/// Proof that the granted region `R` contains the register group pin `P` lives in. An associated +/// const, not an anonymous `const {}`, so it evaluates under `generic_const_exprs`. +trait AssertGpioGrant { + /// Evaluating this forces the coverage check; referencing it is what makes it run. + const COVERS: (); +} + +impl, R: Mmap> AssertGpioGrant for (P, R) { + const COVERS: () = assert!( + covers::( +

>::DATA.map.base, + map_extent(

>::DATA.map) + ), + "granted region does not cover this pin's GPIO register group", + ); +} + +/// The GPIO register block this process was granted in `system.json5`. Holding one is the authority +/// to touch GPIO at all; binding a pin through it proves the grant covers that pin's group. +pub struct GpioBlock { + _region: PhantomData, +} + +impl GpioBlock { + /// Consume the granted region — the single gate between an MPU grant and any GPIO access. + #[must_use] + pub fn new(_region: Region) -> Self { + Self { + _region: PhantomData, + } + } +} + +/// Direction not yet chosen — what a freshly bound handle carries. +pub struct Unset; + +/// The pin has been switched to output. +pub struct Output; + +/// The pin has been switched to input. +pub struct Input; + +/// Which edge or level an input pin raises its interrupt on. +#[derive(Clone, Copy)] +pub enum IntTrigger { + /// Rising edge. + Rising, + /// Falling edge. + Falling, + /// High level. + LevelHigh, + /// Low level. + LevelLow, + /// Both edges. + Both, +} + +/// One GPIO pin's confined access: just the consumed pin token (a ZST). This pin's base, bit, and +/// register map all ride in on const `

>::DATA`, so every op folds to this pin's own +/// base and slot — handles for different pins never alias, with no shared block value to carry. +/// +/// `R` is the grant the pin was bound through; `D` is the pin's direction: [`Unset`] until +/// [`GpioPin::into_output`] or [`GpioPin::into_input`] switches it, after which the level and +/// interrupt verbs are the ones that direction allows. +pub struct GpioPin { + /// The pin's type is the authority (consumed at bind); the handle is a move-only ZST that reads no field. + _pin: PhantomData<(P, D)>, + /// The grant this pin was bound through, kept so the chain stays visible in the type. + _region: PhantomData, +} + +impl, R: Mmap> GpioPin { + /// Bind a (consumed) pin token through a granted block — the token is the authority for the + /// pin, the block for the registers; base/bit/map ride in on const DATA. + /// + /// Binds as [`Unset`]: only [`GpioPin::into_output`] and [`GpioPin::into_input`] mint a directed + /// handle, so a direction in the type always means the direction register was written. + pub fn new(_pin: P, _block: &GpioBlock) -> Self { + let () = <(P, R) as AssertGpioGrant>::COVERS; + Self { + _pin: PhantomData, + _region: PhantomData, + } + } +} + +impl, R: Mmap, D> GpioPin { + /// This pin's register group map — read handles (`int_enable`, `int_status`, `in_level`) hang off it. + #[must_use] + pub const fn map(&self) -> &'static GpioMap { +

>::DATA.map + } + + /// A transient MMIO accessor over this pin's GPIO base — a compile-time static carried in its map. + fn mmio(&self) -> Mmio<()> { + Mmio::from_raw(self.map().base as *const u8) + } + + /// Apply a role at this pin's slot: one panic-free RMW per op; conflicts rejected at compile time by [`role_cfgs_ok`]. + fn apply(&self, role: GpioRole) { + let bit =

>::DATA.bit; + let block = self.mmio(); + for op in self.map().role(role) { + let mask = (1u32 << op.width) - 1; + let fw = field(op.offset, bit * op.width, mask, op.value); + block.write_reg(fw.offset, (block.read_reg(fw.offset) & !fw.clr) | fw.set); + } + } + + /// True if this pin's bit is set in register `reg` (a read handle from this pin's [`GpioMap`]). + #[must_use] + pub fn read(&self, reg: Reg) -> bool { + self.mmio().read_reg(reg.0) & (1 <<

>::DATA.bit) != 0 + } + + /// Write-1-to-clear this pin's bit in the w1c register `reg` (typed `W1C`, so only status registers). + pub fn ack(&self, reg: Reg) { + self.mmio() + .write_reg(reg.0, 1 <<

>::DATA.bit); + } + + /// Switch the pin to output, carrying the direction in its type from here on. + #[must_use] + pub fn into_output(self) -> GpioPin { + self.apply(GpioRole::Output); + GpioPin { + _pin: PhantomData, + _region: PhantomData, + } + } + + /// Switch the pin to input, carrying the direction in its type from here on. + #[must_use] + pub fn into_input(self) -> GpioPin { + self.apply(GpioRole::Input); + GpioPin { + _pin: PhantomData, + _region: PhantomData, + } + } +} + +impl, R: Mmap> GpioPin { + /// Raise this pin's interrupt on `trigger`. + pub fn enable_interrupt(&self, trigger: IntTrigger) { + self.apply(match trigger { + IntTrigger::Rising => GpioRole::EnableRising, + IntTrigger::Falling => GpioRole::EnableFalling, + IntTrigger::LevelHigh => GpioRole::EnableLevelHigh, + IntTrigger::LevelLow => GpioRole::EnableLevelLow, + IntTrigger::Both => GpioRole::EnableBoth, + }); + } + + /// Stop this pin raising interrupts. + pub fn disable_interrupt(&self) { + self.apply(GpioRole::DisableInt); + } +} + +impl embedded_hal::digital::ErrorType for GpioPin { + type Error = core::convert::Infallible; +} + +impl, R: Mmap> embedded_hal::digital::OutputPin for GpioPin { + fn set_high(&mut self) -> Result<(), Self::Error> { + self.apply(GpioRole::SetHigh); + Ok(()) + } + + fn set_low(&mut self) -> Result<(), Self::Error> { + self.apply(GpioRole::SetLow); + Ok(()) + } +} + +impl embedded_hal::digital::ErrorType for GpioPin { + type Error = core::convert::Infallible; +} + +impl, R: Mmap> embedded_hal::digital::InputPin for GpioPin { + fn is_high(&mut self) -> Result { + Ok(self.read(self.map().in_level)) + } + + fn is_low(&mut self) -> Result { + self.is_high().map(|high| !high) + } +} + +/// Bind a pin already routed to GPIO by privileged init; touches no SCU register — userspace-safe. +pub fn bind_gpio + Pin, R: Mmap>(pin: P, block: &GpioBlock) -> GpioPin { + GpioPin::new(pin, block) +} + +/// A GPIO handle carries its pin's SCU route at the type level, folded to one RMW per register at compile time. +impl, R: Mmap, D> MuxRoutes for GpioPin { + const COALESCED: RegBatch = coalesce_routes(&[

>::ROUTE]); +} + +/// `pin.into_gpio(&block)`: consume a GPIO-capable token into a bind-only handle; the SCU applier routes it later. +pub trait IntoGpio: Routes + Pin + Sized { + /// Bind this pin token to a GPIO handle (no SCU write); its route rides in via [`MuxRoutes`]. + fn into_gpio(self, block: &GpioBlock) -> GpioPin { + GpioPin::new(self, block) + } +} + +impl + Pin> IntoGpio for P {} diff --git a/hal/src/i2c.rs b/hal/src/i2c.rs new file mode 100644 index 000000000..f05cb3ff5 --- /dev/null +++ b/hal/src/i2c.rs @@ -0,0 +1,118 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! I2C capability, owned by openprot: a bus is an SCL role + an SDA role + a controller. +//! Pins carry chip-local facts (approach D); the controller owns routing + config. + +use crate::field_mux::{coalesce_routes, Mmio, MuxRoutes, RegBatch}; +use crate::resource::{Capability, Routes}; + +/// I2C-SCL capability: a pin muxable as a controller's clock line, carrying [`I2cData`]. +pub struct I2cScl; +impl Capability for I2cScl { + type Data = I2cData; +} + +/// I2C-SDA capability: a pin muxable as a controller's data line, carrying [`I2cData`]. +pub struct I2cSda; +impl Capability for I2cSda { + type Data = I2cData; +} + +/// One I2C controller's `(I2C, I2CBUFF)` register bases, type-erased to stay PAC-agnostic. +#[derive(Clone, Copy)] +pub struct I2cCtrlRegs { + /// Const-comparable controller identity, so a bus's two pins prove they name one controller. + pub id: usize, + /// Base of the controller's I2C register block. + pub i2c: *const (), + /// Base of the controller's I2CBUFF register block. + pub buff: *const (), +} + +/// One I2C pin's datum: its mux route + the controller it wires to. +#[derive(Clone, Copy)] +pub struct I2cData { + /// The controller this pin is wired to. + pub ctrl: I2cCtrlRegs, +} + +/// Block-identity marker phantom-typing a controller's I2C applier so it can't stand in for its I2CBUFF applier. +pub struct I2cBlock; +/// Block-identity marker phantom-typing a controller's I2CBUFF applier so it can't stand in for its I2C applier. +pub struct I2cBuffBlock; + +/// Const-asserts both pins name one controller — an associated const carries the assert (control flow) a generic const block can't. +trait AssertI2cPins { + const SAME_CONTROLLER: (); +} + +impl, Sda: Routes> AssertI2cPins for (Scl, Sda) { + const SAME_CONTROLLER: () = assert!( + >::DATA.ctrl.id == >::DATA.ctrl.id, + "SCL and SDA pins name different I2C controllers", + ); +} + +/// Mint a controller's `(I2C, I2CBUFF)` appliers from a bus's two pin tokens; const-asserts both name one controller. +pub const fn i2c_mmios, Sda: Routes>( + _scl: &Scl, + _sda: &Sda, +) -> (Mmio, Mmio) { + let () = <(Scl, Sda) as AssertI2cPins>::SAME_CONTROLLER; + ( + Mmio::from_raw(>::DATA.ctrl.i2c as *const u8), + Mmio::from_raw(>::DATA.ctrl.buff as *const u8), + ) +} + +/// A controller that brings up an I2C bus — the chip-side seam. Pins are already muxed by the +/// bus constructor at boot, so this only initializes the controller registers. +pub trait I2cController: Sized { + /// Configuration consumed while opening (e.g. bus timing). + type Config; + /// The ready-to-use driver produced on success. + type Ready; + /// Failure returned if hardware bring-up fails. + type Error: core::fmt::Debug; + + /// Bring up the bus, consuming the controller (open-once). + fn open(self, config: &Self::Config) -> Result; +} + +/// An I2C bus: two role-capable pins + a controller, all owned (the bus is their claim). +pub struct I2cBus { + // Held to own the pin claim for the bus's lifetime; never read (routing is done at boot). + #[allow(dead_code)] + scl: Scl, + #[allow(dead_code)] + sda: Sda, + ctrl: C, +} + +impl I2cBus { + /// Token authority: the moved-in pin tokens are the sole right to route these pins; the bus's `MuxRoutes` carries their routes, applied by the SCU `route` applier. + pub const fn new(scl: Scl, sda: Sda, ctrl: C) -> Self { + Self { scl, sda, ctrl } + } +} + +/// An I2C bus carries both pins' SCU routes at the type level, folded to one RMW per register at compile time. +impl, Sda: Routes, C> MuxRoutes for I2cBus { + const COALESCED: RegBatch = coalesce_routes(&[ + >::ROUTE, + >::ROUTE, + ]); +} + +impl I2cBus +where + C: I2cController, +{ + /// Bring up the bus, consuming it (open-once). Pins are already muxed by the bus constructor, and + /// role capability was enforced at construction (`Routes`/`Routes` bounds); returns + /// the controller's error on bring-up failure. + pub fn open(self, config: &C::Config) -> Result { + self.ctrl.open(config) + } +} diff --git a/hal/src/i2c_cmd_words.rs b/hal/src/i2c_cmd_words.rs new file mode 100644 index 000000000..6ecc4af28 --- /dev/null +++ b/hal/src/i2c_cmd_words.rs @@ -0,0 +1,240 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Opt-in command-word I2C kit: the target fills the bit values, the HAL owns the vocabulary + one-write assembly. Not the mandatory I2C seam; FIFO chips implement `embedded_hal::i2c::I2c` directly instead. + +use crate::field_mux::RegBlock; +use core::marker::PhantomData; + +/// Target-supplied I2C master COMMAND register: the named config surface a new target fills out. +/// HAL owns the command vocabulary; the target supplies this chip's bit values + register offset. +pub trait I2cMasterCmdBits { + /// Command register offset. + const OFFSET: u32; + /// Enable packet mode. + const PACKET: u32; + /// Send START condition. + const START: u32; + /// Send STOP condition. + const STOP: u32; + /// TX command. + const TX: u32; + /// RX command (ACK). + const RX: u32; + /// RX command with NACK on the last byte. + const RX_LAST: u32; + /// Enable TX buffer mode. + const TX_BUFF: u32; + /// Enable RX buffer mode. + const RX_BUFF: u32; + /// Enable TX DMA mode. + const TX_DMA: u32; + /// Enable RX DMA mode. + const RX_DMA: u32; + /// Bus-recovery bit (set via RMW, not a fresh command word). + const RECOVER: u32; + /// Encode the packet-mode target address field. + fn pkt_addr(addr: u8) -> u32; +} + +/// Target-supplied I2C master STATUS register: the named config surface a new target fills out. +/// HAL owns the status vocabulary; the target supplies this chip's flag values + register offset. +pub trait I2cMasterStatusBits { + /// Status register offset (write-1-to-clear). + const OFFSET: u32; + /// TX received ACK. + const TX_ACK: u32; + /// TX received NACK. + const TX_NAK: u32; + /// RX transfer done. + const RX_DONE: u32; + /// Arbitration loss. + const ARBIT_LOSS: u32; + /// Normal STOP condition. + const NORMAL_STOP: u32; + /// Abnormal STOP condition. + const ABNORMAL: u32; + /// SCL low timeout. + const SCL_LOW_TO: u32; + /// Packet mode done. + const PKT_DONE: u32; + /// Packet mode error. + const PKT_ERROR: u32; + /// Bus recovery done. + const BUS_RECOVER: u32; + /// Bus recovery failed. + const BUS_RECOVER_FAIL: u32; + /// SDA data line timeout. + const SDA_DL_TO: u32; +} + +/// Master command bit names — the value of each is resolved from the target's `I2cMasterCmdBits`. +#[derive(Clone, Copy)] +pub enum I2cCmd { + /// Enable packet mode. + Packet, + /// Send START condition. + Start, + /// Send STOP condition. + Stop, + /// TX command. + Tx, + /// RX command (ACK). + Rx, + /// RX command with NACK on the last byte. + RxLast, + /// Enable TX buffer mode. + TxBuff, + /// Enable RX buffer mode. + RxBuff, + /// Enable TX DMA mode. + TxDma, + /// Enable RX DMA mode. + RxDma, +} + +impl I2cCmd { + /// This command's bit mask in the target's command register. + #[must_use] + pub const fn mask(self) -> u32 { + match self { + I2cCmd::Packet => B::PACKET, + I2cCmd::Start => B::START, + I2cCmd::Stop => B::STOP, + I2cCmd::Tx => B::TX, + I2cCmd::Rx => B::RX, + I2cCmd::RxLast => B::RX_LAST, + I2cCmd::TxBuff => B::TX_BUFF, + I2cCmd::RxBuff => B::RX_BUFF, + I2cCmd::TxDma => B::TX_DMA, + I2cCmd::RxDma => B::RX_DMA, + } + } +} + +/// Master status flag names — the value of each is resolved from the target's `I2cMasterStatusBits`. +#[derive(Clone, Copy)] +pub enum I2cStat { + /// TX received ACK. + TxAck, + /// TX received NACK. + TxNak, + /// RX transfer done. + RxDone, + /// Arbitration loss. + ArbitLoss, + /// Normal STOP condition. + NormalStop, + /// Abnormal STOP condition. + Abnormal, + /// SCL low timeout. + SclLowTo, + /// Packet mode done. + PktDone, + /// Packet mode error. + PktError, + /// Bus recovery done. + BusRecover, + /// Bus recovery failed. + BusRecoverFail, + /// SDA data line timeout. + SdaDlTo, +} + +impl I2cStat { + /// This flag's bit mask in the target's status register. + #[must_use] + pub const fn mask(self) -> u32 { + match self { + I2cStat::TxAck => B::TX_ACK, + I2cStat::TxNak => B::TX_NAK, + I2cStat::RxDone => B::RX_DONE, + I2cStat::ArbitLoss => B::ARBIT_LOSS, + I2cStat::NormalStop => B::NORMAL_STOP, + I2cStat::Abnormal => B::ABNORMAL, + I2cStat::SclLowTo => B::SCL_LOW_TO, + I2cStat::PktDone => B::PKT_DONE, + I2cStat::PktError => B::PKT_ERROR, + I2cStat::BusRecover => B::BUS_RECOVER, + I2cStat::BusRecoverFail => B::BUS_RECOVER_FAIL, + I2cStat::SdaDlTo => B::SDA_DL_TO, + } + } +} + +/// Builder for the master command register: only command names are reachable, so a status flag can +/// never be written as one. `PhantomData` keeps it a plain `u32` at runtime. +#[derive(Clone, Copy)] +pub struct I2cMasterCmd(u32, PhantomData); + +impl I2cMasterCmd { + /// Start a packet-mode command — every full-command site begins here. + #[must_use] + pub fn packet() -> Self { + Self(B::PACKET, PhantomData) + } + + /// OR in one command bit. + #[must_use] + pub fn with(self, c: I2cCmd) -> Self { + Self(self.0 | c.mask::(), PhantomData) + } + + /// Set the packet-mode target address field. + #[must_use] + pub fn address(self, addr: u8) -> Self { + Self(self.0 | B::pkt_addr(addr), PhantomData) + } + + /// Write the assembled command (one register write). + pub fn issue(self, regs: &impl RegBlock) { + regs.write_reg(B::OFFSET, self.0); + } + + /// Issue the bus-recovery command (read-modify-write of the one recovery bit). + pub fn recover(regs: &impl RegBlock) { + let cur = regs.read_reg(B::OFFSET); + regs.write_reg(B::OFFSET, cur | B::RECOVER); + } +} + +/// Flag-set over the master status register: only status names are reachable, so no command bit is +/// testable or clearable here. `PhantomData` keeps it a plain `u32` at runtime. +#[derive(Clone, Copy)] +pub struct I2cMasterStatus(u32, PhantomData); + +impl I2cMasterStatus { + /// The clear-everything (write-1-to-clear) mask. + #[must_use] + pub const fn all() -> Self { + Self(0xffff_ffff, PhantomData) + } + + /// A single-flag clear mask. + #[must_use] + pub const fn flag(s: I2cStat) -> Self { + Self(s.mask::(), PhantomData) + } + + /// Read the current status word. + pub fn read(regs: &impl RegBlock) -> Self { + Self(regs.read_reg(B::OFFSET), PhantomData) + } + + /// True if `s` is set. + #[must_use] + pub fn has(self, s: I2cStat) -> bool { + self.0 & s.mask::() != 0 + } + + /// Raw status word — for the few sites that round-trip the full value. + #[must_use] + pub const fn raw(self) -> u32 { + self.0 + } + + /// Write these flags back (write-1-to-clear the bits held). + pub fn clear(self, regs: &impl RegBlock) { + regs.write_reg(B::OFFSET, self.0); + } +} diff --git a/hal/src/lib.rs b/hal/src/lib.rs new file mode 100644 index 000000000..7bc3e6d6f --- /dev/null +++ b/hal/src/lib.rs @@ -0,0 +1,17 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Mode-agnostic OpenPRoT HAL vocabulary: capability + role traits, and the pin-token generators. +//! Unlike the blocking/nb/async crates, nothing here is flavored by an execution mode. + +#![no_std] +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] +#![deny(unsafe_code)] +#![deny(missing_docs)] + +pub mod field_mux; +pub mod gpio; +pub mod i2c; +pub mod i2c_cmd_words; +pub mod resource; diff --git a/hal/src/resource.rs b/hal/src/resource.rs new file mode 100644 index 000000000..60ae7979b --- /dev/null +++ b/hal/src/resource.rs @@ -0,0 +1,133 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Peripheral-agnostic pin vocabulary: the [`Pin`] token marker, the [`Capability`]/[`Routes`] typed +//! datum binding, and the [`pins!`](crate::pins!) generator. + +/// A tentative register write. +// TODO: any direct-MMIO bit/field mux; can't express ordered/timed write sequences, poll/read-back mux, +// non-`u32` registers, or off-chip (serial IO-expander) routing. +#[derive(Clone, Copy)] +pub struct FieldWrite { + /// Register offset the modification targets. + pub offset: u32, + /// Bits to OR in. + pub set: u32, + /// Bits to AND out. + pub clr: u32, +} + +/// A helper to make a fieldwrite for setting a single bit. +#[must_use] +pub const fn set(offset: u32, bit: u8) -> FieldWrite { + FieldWrite { + offset, + set: 1 << bit, + clr: 0, + } +} + +/// Clear a single bit. +#[must_use] +pub const fn clear(offset: u32, bit: u8) -> FieldWrite { + FieldWrite { + offset, + set: 0, + clr: 1 << bit, + } +} + +/// Write a `mask`-wide field: `value` into the field at `shift` (crossbar select). +#[must_use] +pub const fn field(offset: u32, shift: u8, mask: u32, value: u32) -> FieldWrite { + let reg_mask = mask << shift; + let set = (value << shift) & reg_mask; + FieldWrite { + offset, + set, + clr: reg_mask & !set, + } +} + +impl FieldWrite { + /// Merge another write to the **same** register into this one; const-panics on a set/clear + /// conflict, so a contradictory config fails to compile rather than silently racing the bits. + pub(crate) const fn coalesce(&mut self, w: FieldWrite) { + assert!( + self.offset == w.offset, + "coalesce of writes to different registers" + ); + assert!( + self.set & w.clr == 0 && self.clr & w.set == 0, + "config sets and clears the same bit" + ); + self.set |= w.set; + self.clr |= w.clr; + } +} + +/// A pin capability (GPIO, I2C-SCL, …): a type whose `Data` is the SoC-defined datum a pin carries +/// for that role. The HAL never reads `Data`; each peripheral defines the type and its own applier. +pub trait Capability { + /// Data associated to a pin for enabling use of the corresponding capability. + type Data: Copy; +} + +/// A pin's binding for capability `C`. +pub trait Routes { + /// List of FieldWrites which must happen for routing the pin to its capability + const ROUTE: &'static [FieldWrite]; + /// Data associated to the runtime usage of the pin capability + const DATA: C::Data; +} + +/// A compile time pin ownership token needed to access its register bits for routing, or runtime. +pub trait Pin {} + +/// Generate a chip's pins. +#[macro_export] +macro_rules! pins { + ( + $( + $pin:ident { $( $cap:path : $route:expr => $data:expr ),+ $(,)? } + ),+ $(,)? + ) => { + $( + #[allow(non_camel_case_types)] + pub struct $pin(()); + + impl $crate::resource::Pin for $pin {} + + $( + impl $crate::resource::Routes<$cap> for $pin { + const ROUTE: &'static [$crate::resource::FieldWrite] = { + // A route holds only `FieldWrite`s, so its ctors are in scope here + #[allow(unused_imports)] + use $crate::resource::{clear, field, set}; + $route + }; + const DATA: <$cap as $crate::resource::Capability>::Data = $data; + } + )+ + )+ + + /// Every physical pin this chip exposes, as owned singleton tokens created once at boot. + pub struct PinTokens { + $( + pub $pin: $pin + ),+ + } + + /// Create this chip's pin tokens — an unforgeable capability asserting each pin names real hardware. + /// # Safety + /// The caller must ensure: + /// - This is called **once** per process. A second call aliases every pin — two owners + /// of the same hardware, defeating the exclusivity the token type otherwise enforces. + /// - The `pins!` table is truthful: each pin's `Routes::ROUTE`/`DATA` names the correct, + /// valid mux bits, register bases, and slot for real silicon on this chip. + #[must_use] + pub const unsafe fn create_pins() -> PinTokens { + PinTokens { $( $pin: $pin(()) ),+ } + } + }; +} diff --git a/patches/BUILD.bazel b/patches/BUILD.bazel new file mode 100644 index 000000000..4112b4486 --- /dev/null +++ b/patches/BUILD.bazel @@ -0,0 +1,4 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +exports_files(glob(["*.patch"])) diff --git a/patches/pigweed_cortex_m_systick_double_count.patch b/patches/pigweed_cortex_m_systick_double_count.patch new file mode 100644 index 000000000..ec4ff3f21 --- /dev/null +++ b/patches/pigweed_cortex_m_systick_double_count.patch @@ -0,0 +1,54 @@ +Count each SysTick wrap once. + +The SysTick handler adds a reload period to TICKS, and Clock::now() added a +second one whenever it saw COUNTFLAG set. Entering the exception does not +clear COUNTFLAG -- only reading CSR does, and the handler never read it -- +so every wrap was counted twice and the monotonic clock ran at twice real +time. On AST1060 (SYS_TICK_HZ 200 MHz, SCHEDULER_TICK_HZ 100) a 90 s +deadline expired in 45 s, measured on hardware. + +The handler is the authoritative accumulator: it is delivered by the pending +bit and so catches every wrap. It now claims each wrap by clearing COUNTFLAG, +and Clock::now() corrects only its own return value, for the window where a +wrap has happened but the handler has not run yet. + +--- a/pw_kernel/arch/arm_cortex_m/timer.rs ++++ b/pw_kernel/arch/arm_cortex_m/timer.rs +@@ -31,18 +31,21 @@ + const TICKS_PER_SEC: u64 = KernelConfig::SYS_TICK_HZ as u64; + + fn now() -> pw_time_core::Instant { +- let mut ticks = TICKS.lock(crate::Arch); ++ let ticks = TICKS.lock(crate::Arch); + let systick_regs = Regs::get().systick; + let mut current = systick_regs.cvr.read().current(); + let reload = systick_regs.rvr.read().reload(); ++ // A set COUNTFLAG is a wrap the SysTick handler has not claimed yet, ++ // because it is masked or still pending. The handler owns TICKS, so ++ // only the value returned here is corrected; adding to TICKS as well ++ // would count the wrap twice and run the clock at twice real time. ++ let mut unclaimed_wrap = 0u64; + if systick_regs.csr.read().countflag() { +- // Update the global tick count, as reading the control bit +- // when it's 1 will clear it. +- *ticks += u64::from(SYSTICK_RELOAD_VALUE); ++ unclaimed_wrap = u64::from(SYSTICK_RELOAD_VALUE); + current = systick_regs.cvr.read().current(); + } + +- let delta = u64::from(reload - current); ++ let delta = unclaimed_wrap + u64::from(reload - current); + // The cortex-m systick is a count down timer which triggers + // ever reload period, which we define as (SYS_TICK_HZ / SCHEDULER_TICK_HZ). + // The current time is calculated as the number of ticks + delta where: +@@ -112,6 +115,10 @@ + + { + let mut ticks = TICKS.lock(crate::Arch); ++ // Claim the wrap by clearing COUNTFLAG, so the `Clock::now()` below ++ // does not correct for it a second time. This exception is delivered ++ // by the pending bit, not by COUNTFLAG, so clearing it is safe. ++ let _ = Regs::get().systick.csr.read(); + *ticks += u64::from(SYSTICK_RELOAD_VALUE); + log_if::info_if!(LOG_SYSTICK, "SysTick {}", *ticks as u64); + } diff --git a/services/crypto/api/BUILD.bazel b/services/crypto/api/BUILD.bazel new file mode 100644 index 000000000..55ac949e9 --- /dev/null +++ b/services/crypto/api/BUILD.bazel @@ -0,0 +1,16 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") + +rust_library( + name = "crypto_api", + srcs = glob(["src/**/*.rs"]), + edition = "2024", + visibility = ["//visibility:public"], +) + +rust_test( + name = "crypto_api_test", + crate = ":crypto_api", +) diff --git a/services/crypto/api/src/error.rs b/services/crypto/api/src/error.rs new file mode 100644 index 000000000..1b8d77fa4 --- /dev/null +++ b/services/crypto/api/src/error.rs @@ -0,0 +1,73 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Error types for the crypto IPC wire protocol. + +use core::fmt; + +/// Wire-level decode/encode error. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum WireError { + /// Output buffer too small for the encoded message. + BufferTooSmall, + /// Input buffer too short for a complete header or payload. + Truncated, + /// Unrecognized operation code. + InvalidOpcode(u8), + /// Unrecognized enum discriminant (status tag). + InvalidValue(u8), +} + +impl fmt::Display for WireError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::BufferTooSmall => f.write_str("buffer too small"), + Self::Truncated => f.write_str("truncated"), + Self::InvalidOpcode(op) => write!(f, "invalid opcode 0x{op:02x}"), + Self::InvalidValue(v) => write!(f, "invalid value 0x{v:02x}"), + } + } +} + +impl core::error::Error for WireError {} + +/// On-wire response code from the crypto service. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u8)] +pub enum ResponseCode { + Success = 0, + InternalError = 1, + InvalidOp = 2, + /// Operation not valid in the service's current state. + WrongState = 3, + MalformedRequest = 4, +} + +impl ResponseCode { + pub const fn is_success(self) -> bool { + matches!(self, Self::Success) + } + + pub const fn from_u8(val: u8) -> Option { + match val { + 0 => Some(Self::Success), + 1 => Some(Self::InternalError), + 2 => Some(Self::InvalidOp), + 3 => Some(Self::WrongState), + 4 => Some(Self::MalformedRequest), + _ => None, + } + } +} + +impl fmt::Display for ResponseCode { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Success => f.write_str("success"), + Self::InternalError => f.write_str("internal error"), + Self::InvalidOp => f.write_str("invalid op"), + Self::WrongState => f.write_str("wrong state"), + Self::MalformedRequest => f.write_str("malformed request"), + } + } +} diff --git a/services/crypto/api/src/lib.rs b/services/crypto/api/src/lib.rs new file mode 100644 index 000000000..236848a0e --- /dev/null +++ b/services/crypto/api/src/lib.rs @@ -0,0 +1,25 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Crypto service IPC API: wire format and types. +//! +//! Defines the binary protocol the orchestrator uses to talk to the +//! crypto service over IPC. The caller names a flash region by +//! absolute address and length; the crypto service reads the bytes +//! from the flash service itself and reports a verdict. Firmware +//! never crosses this interface. +//! +//! Host-buildable, no kernel dependencies. Server and client share +//! these types; neither side re-invents the encoding. The transport that carries these frames is a +//! `util_service::AsyncTransport`, shared with every other IPC service. + +#![no_std] + +pub mod error; +pub mod wire; + +pub use error::{ResponseCode, WireError}; +pub use wire::{ + CryptoOp, RequestHeader, ResponseHeader, VerifyRegion, VerifyStatus, MAX_PAYLOAD_SIZE, + MAX_REQUEST_SIZE, MAX_RESPONSE_SIZE, +}; diff --git a/services/crypto/api/src/wire.rs b/services/crypto/api/src/wire.rs new file mode 100644 index 000000000..aa3743286 --- /dev/null +++ b/services/crypto/api/src/wire.rs @@ -0,0 +1,556 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Crypto IPC wire protocol. +//! +//! Binary protocol for orchestrator-to-crypto-service operations over +//! IPC channels. Same 8-byte header shape as the PLDM IPC protocol. +//! +//! ```text +//! Request (8-byte header + optional args): +//! +----+-------+----------+ +//! | op | flags | reserved | + [args] +//! | 1B | 1B | 6B | +//! +----+-------+----------+ +//! +//! Response (8-byte header + optional payload): +//! +------+-------+-------------+----------+ +//! | code | flags | payload_len | reserved | + [payload] +//! | 1B | 1B | 2B LE | 4B | +//! +------+-------+-------------+----------+ +//! ``` + +use crate::error::{ResponseCode, WireError}; + +// ============================================================================ +// Operation codes +// ============================================================================ + +/// Orchestrator-to-crypto IPC operations. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u8)] +pub enum CryptoOp { + /// Begin verifying a flash region. Args: address (4B LE) + length (4B LE). + /// The address is an absolute flash offset; the crypto service reads + /// the bytes from the flash service itself. A StartVerify while + /// hashing is refused with WrongState: one verification at a time. + StartVerify = 0, + /// Query the current verify status. No args; the response payload + /// carries a `VerifyStatus`. + QueryStatus = 1, +} + +impl CryptoOp { + pub const fn from_u8(val: u8) -> Option { + match val { + 0 => Some(Self::StartVerify), + 1 => Some(Self::QueryStatus), + _ => None, + } + } +} + +// ============================================================================ +// Verify status (response payload for QueryStatus) +// ============================================================================ + +/// What the crypto service reports when asked for status. A verdict +/// holds until the next StartVerify resets it. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum VerifyStatus { + /// No verification in progress. + Idle, + /// Hashing is in progress. `hashed` and `total` are byte counts. + Hashing { hashed: u32, total: u32 }, + /// Verification finished: firmware is authentic. + Authenticated, + /// Verification finished: firmware was rejected. + Rejected, +} + +impl VerifyStatus { + pub const MAX_SIZE: usize = 9; + + pub fn encode(&self, buf: &mut [u8]) -> Result { + match self { + Self::Idle => { + if buf.is_empty() { + return Err(WireError::BufferTooSmall); + } + buf[0] = 0; + Ok(1) + } + Self::Hashing { hashed, total } => { + if buf.len() < 9 { + return Err(WireError::BufferTooSmall); + } + buf[0] = 1; + buf[1..5].copy_from_slice(&hashed.to_le_bytes()); + buf[5..9].copy_from_slice(&total.to_le_bytes()); + Ok(9) + } + Self::Authenticated => { + if buf.is_empty() { + return Err(WireError::BufferTooSmall); + } + buf[0] = 2; + Ok(1) + } + Self::Rejected => { + if buf.is_empty() { + return Err(WireError::BufferTooSmall); + } + buf[0] = 3; + Ok(1) + } + } + } + + pub fn decode(buf: &[u8]) -> Result { + if buf.is_empty() { + return Err(WireError::Truncated); + } + match buf[0] { + 0 => Ok(Self::Idle), + 1 => { + if buf.len() < 9 { + return Err(WireError::Truncated); + } + Ok(Self::Hashing { + hashed: u32::from_le_bytes([buf[1], buf[2], buf[3], buf[4]]), + total: u32::from_le_bytes([buf[5], buf[6], buf[7], buf[8]]), + }) + } + 2 => Ok(Self::Authenticated), + 3 => Ok(Self::Rejected), + v => Err(WireError::InvalidValue(v)), + } + } +} + +// ============================================================================ +// Request header +// ============================================================================ + +/// Request header (8 bytes). +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct RequestHeader { + pub op: u8, + pub flags: u8, +} + +impl RequestHeader { + pub const SIZE: usize = 8; + + pub fn to_bytes(&self) -> [u8; Self::SIZE] { + [self.op, self.flags, 0, 0, 0, 0, 0, 0] + } + + pub fn from_bytes(bytes: &[u8]) -> Option { + if bytes.len() < Self::SIZE { + return None; + } + Some(Self { + op: bytes[0], + flags: bytes[1], + }) + } + + pub fn operation(&self) -> Option { + CryptoOp::from_u8(self.op) + } +} + +// ============================================================================ +// Response header +// ============================================================================ + +/// Response header (8 bytes). +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct ResponseHeader { + pub code: u8, + pub flags: u8, + pub payload_len: u16, +} + +impl ResponseHeader { + pub const SIZE: usize = 8; + + pub const fn success() -> Self { + Self { + code: ResponseCode::Success as u8, + flags: 0, + payload_len: 0, + } + } + + pub const fn error(code: ResponseCode) -> Self { + Self { + code: code as u8, + flags: 0, + payload_len: 0, + } + } + + pub fn is_success(&self) -> bool { + self.code == ResponseCode::Success as u8 + } + + pub fn response_code(&self) -> Result { + ResponseCode::from_u8(self.code).ok_or(WireError::InvalidValue(self.code)) + } + + pub fn to_bytes(&self) -> [u8; Self::SIZE] { + let pl = self.payload_len.to_le_bytes(); + [self.code, self.flags, pl[0], pl[1], 0, 0, 0, 0] + } + + pub fn from_bytes(bytes: &[u8]) -> Option { + if bytes.len() < Self::SIZE { + return None; + } + Some(Self { + code: bytes[0], + flags: bytes[1], + payload_len: u16::from_le_bytes([bytes[2], bytes[3]]), + }) + } +} + +// ============================================================================ +// Constants +// ============================================================================ + +/// Maximum status payload (Hashing: 9 bytes). +pub const MAX_PAYLOAD_SIZE: usize = VerifyStatus::MAX_SIZE; + +/// Maximum total request size (header + StartVerify args). +pub const MAX_REQUEST_SIZE: usize = RequestHeader::SIZE + 8; + +/// Maximum total response size (header + QueryStatus payload). +pub const MAX_RESPONSE_SIZE: usize = ResponseHeader::SIZE + MAX_PAYLOAD_SIZE; + +// ============================================================================ +// Request types +// ============================================================================ + +/// A flash region to verify: absolute address and byte count. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct VerifyRegion { + pub address: u32, + pub length: u32, +} + +// ============================================================================ +// Request encoding (client side) +// ============================================================================ + +/// Encode StartVerify. The crypto service reads the region from the +/// flash service itself. +pub fn encode_start_verify(region: &VerifyRegion) -> [u8; MAX_REQUEST_SIZE] { + let h = RequestHeader { + op: CryptoOp::StartVerify as u8, + flags: 0, + }; + let mut buf = [0u8; MAX_REQUEST_SIZE]; + buf[..RequestHeader::SIZE].copy_from_slice(&h.to_bytes()); + buf[RequestHeader::SIZE..RequestHeader::SIZE + 4] + .copy_from_slice(®ion.address.to_le_bytes()); + buf[RequestHeader::SIZE + 4..MAX_REQUEST_SIZE].copy_from_slice(®ion.length.to_le_bytes()); + buf +} + +/// Encode QueryStatus. Header only, no args. +pub fn encode_query_status() -> [u8; RequestHeader::SIZE] { + RequestHeader { + op: CryptoOp::QueryStatus as u8, + flags: 0, + } + .to_bytes() +} + +// ============================================================================ +// Response encoding (server side) +// ============================================================================ + +/// Encode a success response with no payload. +pub fn encode_success_response(buf: &mut [u8]) -> Result { + if buf.len() < ResponseHeader::SIZE { + return Err(WireError::BufferTooSmall); + } + buf[..ResponseHeader::SIZE].copy_from_slice(&ResponseHeader::success().to_bytes()); + Ok(ResponseHeader::SIZE) +} + +/// Encode an error response. +pub fn encode_error_response(buf: &mut [u8], code: ResponseCode) -> Result { + if buf.len() < ResponseHeader::SIZE { + return Err(WireError::BufferTooSmall); + } + buf[..ResponseHeader::SIZE].copy_from_slice(&ResponseHeader::error(code).to_bytes()); + Ok(ResponseHeader::SIZE) +} + +/// Encode a QueryStatus success response with the current verify status. +pub fn encode_status_response(buf: &mut [u8], status: &VerifyStatus) -> Result { + let mut payload_buf = [0u8; VerifyStatus::MAX_SIZE]; + let payload_len = status.encode(&mut payload_buf)?; + let total = ResponseHeader::SIZE + payload_len; + if buf.len() < total { + return Err(WireError::BufferTooSmall); + } + let mut h = ResponseHeader::success(); + h.payload_len = payload_len as u16; + buf[..ResponseHeader::SIZE].copy_from_slice(&h.to_bytes()); + buf[ResponseHeader::SIZE..total].copy_from_slice(&payload_buf[..payload_len]); + Ok(total) +} + +// ============================================================================ +// Response decoding (client side) +// ============================================================================ + +/// Decode a response header. +pub fn decode_response_header(buf: &[u8]) -> Result { + ResponseHeader::from_bytes(buf).ok_or(WireError::Truncated) +} + +/// Extract the response payload bytes (after the header). +pub fn get_response_payload<'a>( + buf: &'a [u8], + header: &ResponseHeader, +) -> Result<&'a [u8], WireError> { + let end = ResponseHeader::SIZE + header.payload_len as usize; + if buf.len() < end { + return Err(WireError::Truncated); + } + Ok(&buf[ResponseHeader::SIZE..end]) +} + +// ============================================================================ +// Request decoding (server side) +// ============================================================================ + +/// Decode a request header. +pub fn decode_request_header(buf: &[u8]) -> Result { + RequestHeader::from_bytes(buf).ok_or(WireError::Truncated) +} + +/// Get the request args (bytes after the header). +pub fn get_request_args(buf: &[u8]) -> &[u8] { + if buf.len() > RequestHeader::SIZE { + &buf[RequestHeader::SIZE..] + } else { + &[] + } +} + +/// Extract the verify region from a StartVerify request's args. +pub fn get_start_verify_args(args: &[u8]) -> Result { + if args.len() < 8 { + return Err(WireError::Truncated); + } + Ok(VerifyRegion { + address: u32::from_le_bytes([args[0], args[1], args[2], args[3]]), + length: u32::from_le_bytes([args[4], args[5], args[6], args[7]]), + }) +} + +// ============================================================================ +// Tests +// ============================================================================ + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn request_header_roundtrip() { + let h = RequestHeader { + op: CryptoOp::QueryStatus as u8, + flags: 0, + }; + let bytes = h.to_bytes(); + let decoded = RequestHeader::from_bytes(&bytes).unwrap(); + assert_eq!(decoded.operation(), Some(CryptoOp::QueryStatus)); + } + + #[test] + fn response_header_roundtrip() { + let h = ResponseHeader { + code: ResponseCode::Success as u8, + flags: 0, + payload_len: 9, + }; + let bytes = h.to_bytes(); + let decoded = ResponseHeader::from_bytes(&bytes).unwrap(); + assert!(decoded.is_success()); + assert_eq!(decoded.payload_len, 9); + } + + #[test] + fn start_verify_roundtrip() { + let region = VerifyRegion { + address: 0x2000_0000, + length: 0x0008_0000, + }; + let buf = encode_start_verify(®ion); + assert_eq!(buf.len(), 16); + let h = decode_request_header(&buf).unwrap(); + assert_eq!(h.operation(), Some(CryptoOp::StartVerify)); + let args = get_request_args(&buf); + let decoded = get_start_verify_args(args).unwrap(); + assert_eq!(decoded, region); + } + + #[test] + fn query_status_roundtrip() { + let buf = encode_query_status(); + assert_eq!(buf.len(), RequestHeader::SIZE); + let h = decode_request_header(&buf).unwrap(); + assert_eq!(h.operation(), Some(CryptoOp::QueryStatus)); + } + + #[test] + fn verify_status_idle_roundtrip() { + let status = VerifyStatus::Idle; + let mut payload = [0u8; VerifyStatus::MAX_SIZE]; + let len = status.encode(&mut payload).unwrap(); + assert_eq!(len, 1); + assert_eq!(VerifyStatus::decode(&payload[..len]).unwrap(), status); + } + + #[test] + fn verify_status_hashing_roundtrip() { + let status = VerifyStatus::Hashing { + hashed: 0x1000, + total: 0x8000, + }; + let mut payload = [0u8; VerifyStatus::MAX_SIZE]; + let len = status.encode(&mut payload).unwrap(); + assert_eq!(len, 9); + assert_eq!(VerifyStatus::decode(&payload[..len]).unwrap(), status); + } + + #[test] + fn verify_status_authenticated_roundtrip() { + let status = VerifyStatus::Authenticated; + let mut payload = [0u8; VerifyStatus::MAX_SIZE]; + let len = status.encode(&mut payload).unwrap(); + assert_eq!(len, 1); + assert_eq!(VerifyStatus::decode(&payload[..len]).unwrap(), status); + } + + #[test] + fn verify_status_rejected_roundtrip() { + let status = VerifyStatus::Rejected; + let mut payload = [0u8; VerifyStatus::MAX_SIZE]; + let len = status.encode(&mut payload).unwrap(); + assert_eq!(len, 1); + assert_eq!(VerifyStatus::decode(&payload[..len]).unwrap(), status); + } + + #[test] + fn status_response_hashing_roundtrip() { + let status = VerifyStatus::Hashing { + hashed: 0x4000, + total: 0x0010_0000, + }; + let mut buf = [0u8; 32]; + let len = encode_status_response(&mut buf, &status).unwrap(); + let h = decode_response_header(&buf).unwrap(); + assert!(h.is_success()); + assert_eq!(h.payload_len, 9); + let payload = get_response_payload(&buf[..len], &h).unwrap(); + assert_eq!(VerifyStatus::decode(payload).unwrap(), status); + } + + #[test] + fn error_response_roundtrip() { + let mut buf = [0u8; 16]; + let len = encode_error_response(&mut buf, ResponseCode::WrongState).unwrap(); + assert_eq!(len, ResponseHeader::SIZE); + let h = decode_response_header(&buf).unwrap(); + assert!(!h.is_success()); + assert_eq!(h.response_code().unwrap(), ResponseCode::WrongState); + } + + #[test] + fn success_response_roundtrip() { + let mut buf = [0u8; 16]; + let len = encode_success_response(&mut buf).unwrap(); + assert_eq!(len, ResponseHeader::SIZE); + let h = decode_response_header(&buf).unwrap(); + assert!(h.is_success()); + assert_eq!(h.payload_len, 0); + } + + #[test] + fn unknown_opcode() { + assert_eq!(CryptoOp::from_u8(0xFF), None); + } + + #[test] + fn unknown_status_tag() { + assert_eq!( + VerifyStatus::decode(&[0xFF]), + Err(WireError::InvalidValue(0xFF)) + ); + } + + #[test] + fn decode_request_truncated() { + assert_eq!(decode_request_header(&[0u8; 4]), Err(WireError::Truncated)); + } + + #[test] + fn decode_response_truncated() { + assert_eq!(decode_response_header(&[0u8; 4]), Err(WireError::Truncated)); + } + + #[test] + fn get_response_payload_truncated() { + let mut h = ResponseHeader::success(); + h.payload_len = 100; + let mut buf = [0u8; 16]; + buf[..ResponseHeader::SIZE].copy_from_slice(&h.to_bytes()); + assert_eq!( + get_response_payload(&buf[..ResponseHeader::SIZE], &h), + Err(WireError::Truncated) + ); + } + + #[test] + fn response_buffer_too_small_errors() { + let mut buf = [0u8; 4]; + assert_eq!( + encode_success_response(&mut buf), + Err(WireError::BufferTooSmall) + ); + assert_eq!( + encode_error_response(&mut buf, ResponseCode::InternalError), + Err(WireError::BufferTooSmall) + ); + } + + #[test] + fn start_verify_args_truncated() { + assert_eq!(get_start_verify_args(&[0, 0]), Err(WireError::Truncated)); + } + + #[test] + fn status_decode_truncated() { + assert_eq!(VerifyStatus::decode(&[]), Err(WireError::Truncated)); + } + + #[test] + fn hashing_status_decode_truncated() { + assert_eq!(VerifyStatus::decode(&[1, 0, 0]), Err(WireError::Truncated)); + } + + #[test] + fn get_request_args_empty_for_header_only() { + let buf = encode_query_status(); + assert_eq!(get_request_args(&buf), &[]); + } +} diff --git a/services/crypto/client/BUILD.bazel b/services/crypto/client/BUILD.bazel new file mode 100644 index 000000000..edefde2a6 --- /dev/null +++ b/services/crypto/client/BUILD.bazel @@ -0,0 +1,20 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") + +rust_library( + name = "crypto_client", + srcs = glob(["src/**/*.rs"]), + edition = "2024", + visibility = ["//visibility:public"], + deps = [ + "//services/crypto/api:crypto_api", + "//util/service", + ], +) + +rust_test( + name = "crypto_client_test", + crate = ":crypto_client", +) diff --git a/services/crypto/client/src/client.rs b/services/crypto/client/src/client.rs new file mode 100644 index 000000000..cafe99de5 --- /dev/null +++ b/services/crypto/client/src/client.rs @@ -0,0 +1,434 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The client handle and the answers it collects. + +use crypto_api::wire::{self, CryptoOp, VerifyRegion, VerifyStatus, MAX_RESPONSE_SIZE}; +use util_service::AsyncTransport; + +use crate::ClientError; + +/// What the crypto service answered. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Reply { + /// The service took the request. QueryStatus reports how the + /// hash goes. + Accepted, + /// Current verify status, from QueryStatus. + Status(VerifyStatus), +} + +/// The orchestrator's handle on the crypto service. +/// +/// Generic over the transport so the same encode/decode paths run +/// behind a kernel channel in production and inside a Loopback in +/// host tests. +pub struct CryptoIpcClient { + transport: T, + in_flight: Option, + response: [u8; MAX_RESPONSE_SIZE], +} + +impl CryptoIpcClient { + pub const fn new(transport: T) -> Self { + Self { + transport, + in_flight: None, + response: [0u8; MAX_RESPONSE_SIZE], + } + } + + pub fn in_flight(&self) -> Option { + self.in_flight + } + + pub fn transport(&self) -> &T { + &self.transport + } +} + +impl CryptoIpcClient { + /// Begin verifying a flash region. The crypto service reads the + /// bytes from the flash service itself. + pub fn start_verify(&mut self, region: &VerifyRegion) -> Result<(), ClientError> { + self.send(CryptoOp::StartVerify, &wire::encode_start_verify(region)) + } + + /// Ask what the service is doing. + pub fn query_status(&mut self) -> Result<(), ClientError> { + self.send(CryptoOp::QueryStatus, &wire::encode_query_status()) + } + + /// Collect the answer, if it has arrived. + /// + /// `Ok(None)` means the service has not answered yet. Anything else + /// ends the round-trip, refusals included. + pub fn poll(&mut self) -> Result, ClientError> { + let op = self.in_flight.ok_or(ClientError::Idle)?; + let polled = self.transport.poll(&mut self.response); + let Some(len) = polled.inspect_err(|_| self.in_flight = None)? else { + return Ok(None); + }; + self.in_flight = None; + self.decode(op, len).map(Some) + } + + /// Abandon the round-trip in flight. + pub fn cancel(&mut self) -> Result<(), ClientError> { + if self.in_flight.is_none() { + return Err(ClientError::Idle); + } + self.in_flight = None; + Ok(self.transport.cancel()?) + } + + fn send(&mut self, op: CryptoOp, request: &[u8]) -> Result<(), ClientError> { + if self.in_flight.is_some() { + return Err(ClientError::Busy); + } + self.transport.start(request)?; + self.in_flight = Some(op); + Ok(()) + } + + fn decode(&self, op: CryptoOp, len: usize) -> Result { + let frame = &self.response[..len]; + let header = wire::decode_response_header(frame)?; + if !header.is_success() { + return Err(ClientError::Refused(header.response_code()?)); + } + match op { + CryptoOp::QueryStatus => { + let payload = wire::get_response_payload(frame, &header)?; + Ok(Reply::Status(VerifyStatus::decode(payload)?)) + } + CryptoOp::StartVerify => Ok(Reply::Accepted), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crypto_api::{ResponseCode, WireError}; + use util_service::{Delayed, Dispatch, DispatchError, Loopback, TransportError}; + + /// Minimal inline dispatcher that speaks the crypto wire protocol. + struct StubCrypto { + status: VerifyStatus, + refuse_with: Option, + last_address: Option, + last_length: Option, + } + + impl StubCrypto { + fn new() -> Self { + Self { + status: VerifyStatus::Idle, + refuse_with: None, + last_address: None, + last_length: None, + } + } + + fn refusing(code: ResponseCode) -> Self { + Self { + refuse_with: Some(code), + ..Self::new() + } + } + + fn holding(status: VerifyStatus) -> Self { + Self { + status, + ..Self::new() + } + } + } + + impl Dispatch for StubCrypto { + fn dispatch( + &mut self, + request: &[u8], + response: &mut [u8], + ) -> Result { + let header = wire::decode_request_header(request) + .map_err(|_| DispatchError::ResponseTooLarge)?; + let Some(op) = header.operation() else { + return wire::encode_error_response(response, ResponseCode::InvalidOp) + .map_err(|_| DispatchError::ResponseTooLarge); + }; + + if let Some(code) = self.refuse_with { + return wire::encode_error_response(response, code) + .map_err(|_| DispatchError::ResponseTooLarge); + } + + match op { + CryptoOp::StartVerify => { + let args = wire::get_request_args(request); + let Ok(region) = wire::get_start_verify_args(args) else { + return wire::encode_error_response( + response, + ResponseCode::MalformedRequest, + ) + .map_err(|_| DispatchError::ResponseTooLarge); + }; + self.last_address = Some(region.address); + self.last_length = Some(region.length); + wire::encode_success_response(response) + .map_err(|_| DispatchError::ResponseTooLarge) + } + CryptoOp::QueryStatus => wire::encode_status_response(response, &self.status) + .map_err(|_| DispatchError::ResponseTooLarge), + } + } + } + + const REGION: VerifyRegion = VerifyRegion { + address: 0x2000_0000, + length: 0x0008_0000, + }; + const ZERO_REGION: VerifyRegion = VerifyRegion { + address: 0, + length: 0, + }; + + type Direct = CryptoIpcClient>; + + fn client(stub: StubCrypto) -> Direct { + CryptoIpcClient::new(Loopback::new(stub)) + } + + fn handler(client: &Direct) -> &StubCrypto { + client.transport().server() + } + + #[test] + fn start_verify_carries_the_region() { + let mut c = client(StubCrypto::new()); + + c.start_verify(®ION).unwrap(); + assert_eq!(c.in_flight(), Some(CryptoOp::StartVerify)); + assert_eq!(c.poll(), Ok(Some(Reply::Accepted))); + + assert_eq!(handler(&c).last_address, Some(0x2000_0000)); + assert_eq!(handler(&c).last_length, Some(0x0008_0000)); + assert_eq!(c.in_flight(), None); + } + + #[test] + fn query_status_reports_hashing_progress() { + let status = VerifyStatus::Hashing { + hashed: 0x4000, + total: 0x0010_0000, + }; + let mut c = client(StubCrypto::holding(status)); + + c.query_status().unwrap(); + assert_eq!(c.poll(), Ok(Some(Reply::Status(status)))); + } + + #[test] + fn query_status_reports_idle() { + let mut c = client(StubCrypto::new()); + + c.query_status().unwrap(); + assert_eq!(c.poll(), Ok(Some(Reply::Status(VerifyStatus::Idle)))); + } + + #[test] + fn query_status_reports_authenticated() { + let mut c = client(StubCrypto::holding(VerifyStatus::Authenticated)); + + c.query_status().unwrap(); + assert_eq!( + c.poll(), + Ok(Some(Reply::Status(VerifyStatus::Authenticated))) + ); + } + + #[test] + fn query_status_reports_rejected() { + let mut c = client(StubCrypto::holding(VerifyStatus::Rejected)); + + c.query_status().unwrap(); + assert_eq!(c.poll(), Ok(Some(Reply::Status(VerifyStatus::Rejected)))); + } + + #[test] + fn a_refusal_ends_the_round_trip_with_the_code() { + let mut c = client(StubCrypto::refusing(ResponseCode::WrongState)); + + c.start_verify(&ZERO_REGION).unwrap(); + assert_eq!( + c.poll(), + Err(ClientError::Refused(ResponseCode::WrongState)) + ); + assert_eq!(c.in_flight(), None); + } + + #[test] + fn a_second_request_while_one_is_in_flight_is_refused() { + let mut c = client(StubCrypto::new()); + + c.start_verify(&ZERO_REGION).unwrap(); + assert_eq!(c.query_status(), Err(ClientError::Busy)); + assert_eq!(c.in_flight(), Some(CryptoOp::StartVerify)); + } + + #[test] + fn polling_with_nothing_in_flight_is_refused() { + let mut c = client(StubCrypto::new()); + assert_eq!(c.poll(), Err(ClientError::Idle)); + } + + #[test] + fn cancel_frees_the_client_for_the_next_request() { + let mut c = client(StubCrypto::new()); + c.start_verify(&ZERO_REGION).unwrap(); + + c.cancel().unwrap(); + + assert_eq!(c.in_flight(), None); + c.query_status().unwrap(); + assert_eq!(c.poll(), Ok(Some(Reply::Status(VerifyStatus::Idle)))); + } + + #[test] + fn cancel_with_nothing_in_flight_is_refused() { + let mut c = client(StubCrypto::new()); + assert_eq!(c.cancel(), Err(ClientError::Idle)); + } + + #[test] + fn a_response_that_is_not_ready_yet_polls_again() { + let mut c = CryptoIpcClient::new(Delayed::new( + Loopback::<_, MAX_RESPONSE_SIZE>::new(StubCrypto::new()), + 2, + )); + + c.start_verify(&ZERO_REGION).unwrap(); + + assert_eq!(c.poll(), Ok(None)); + assert_eq!(c.poll(), Ok(None)); + assert_eq!(c.in_flight(), Some(CryptoOp::StartVerify), "still waiting"); + assert_eq!(c.poll(), Ok(Some(Reply::Accepted))); + assert_eq!(c.in_flight(), None); + } + + #[test] + fn a_failed_start_leaves_the_client_idle() { + let mut c: CryptoIpcClient> = + CryptoIpcClient::new(Loopback::new(StubCrypto::new())); + + assert_eq!( + c.start_verify(&ZERO_REGION), + Err(ClientError::Transport(TransportError::TooLarge)) + ); + assert_eq!(c.in_flight(), None); + } + + struct BareSuccessChannel; + + impl AsyncTransport for BareSuccessChannel { + fn start(&mut self, _req: &[u8]) -> Result<(), TransportError> { + Ok(()) + } + fn poll(&mut self, resp: &mut [u8]) -> Result, TransportError> { + let h = wire::ResponseHeader::success(); + resp[..wire::ResponseHeader::SIZE].copy_from_slice(&h.to_bytes()); + Ok(Some(wire::ResponseHeader::SIZE)) + } + fn cancel(&mut self) -> Result<(), TransportError> { + Ok(()) + } + } + + #[test] + fn query_status_with_empty_payload_is_a_wire_error() { + let mut c = CryptoIpcClient::new(BareSuccessChannel); + c.query_status().unwrap(); + + assert_eq!(c.poll(), Err(ClientError::Wire(WireError::Truncated))); + assert_eq!(c.in_flight(), None); + } + + struct DeadChannel; + + impl AsyncTransport for DeadChannel { + fn start(&mut self, _req: &[u8]) -> Result<(), TransportError> { + Ok(()) + } + fn poll(&mut self, _resp: &mut [u8]) -> Result, TransportError> { + Err(TransportError::Failed) + } + fn cancel(&mut self) -> Result<(), TransportError> { + Ok(()) + } + } + + #[test] + fn a_failed_poll_ends_the_round_trip() { + let mut c = CryptoIpcClient::new(DeadChannel); + c.start_verify(&ZERO_REGION).unwrap(); + + assert_eq!( + c.poll(), + Err(ClientError::Transport(TransportError::Failed)) + ); + assert_eq!(c.in_flight(), None); + c.start_verify(&ZERO_REGION).unwrap(); + } + + struct GarbageChannel; + + impl AsyncTransport for GarbageChannel { + fn start(&mut self, _req: &[u8]) -> Result<(), TransportError> { + Ok(()) + } + fn poll(&mut self, resp: &mut [u8]) -> Result, TransportError> { + resp[..2].copy_from_slice(&[0xff, 0xff]); + Ok(Some(2)) + } + fn cancel(&mut self) -> Result<(), TransportError> { + Ok(()) + } + } + + #[test] + fn a_response_that_does_not_decode_ends_the_round_trip() { + let mut c = CryptoIpcClient::new(GarbageChannel); + c.start_verify(&ZERO_REGION).unwrap(); + + assert_eq!(c.poll(), Err(ClientError::Wire(WireError::Truncated))); + assert_eq!(c.in_flight(), None); + c.start_verify(&ZERO_REGION).unwrap(); + } + + struct UncancellableChannel; + + impl AsyncTransport for UncancellableChannel { + fn start(&mut self, _req: &[u8]) -> Result<(), TransportError> { + Ok(()) + } + fn poll(&mut self, _resp: &mut [u8]) -> Result, TransportError> { + Ok(None) + } + fn cancel(&mut self) -> Result<(), TransportError> { + Err(TransportError::Failed) + } + } + + #[test] + fn a_failed_cancel_is_reported_and_leaves_the_client_idle() { + let mut c = CryptoIpcClient::new(UncancellableChannel); + c.start_verify(&ZERO_REGION).unwrap(); + + assert_eq!( + c.cancel(), + Err(ClientError::Transport(TransportError::Failed)) + ); + assert_eq!(c.in_flight(), None); + } +} diff --git a/services/crypto/client/src/error.rs b/services/crypto/client/src/error.rs new file mode 100644 index 000000000..9395d59a6 --- /dev/null +++ b/services/crypto/client/src/error.rs @@ -0,0 +1,58 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! What a round-trip can fail with. + +use crypto_api::{ResponseCode, WireError}; +use util_service::TransportError; + +/// Why a round-trip did not produce an answer. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ClientError { + /// The transport failed, or was used in the wrong order. + Transport(TransportError), + /// The response did not decode. + Wire(WireError), + /// The service answered with a refusal. Carries the code the + /// service sent: a decision, not a fault in the channel. + Refused(ResponseCode), + /// A request is already in flight. One at a time, so the caller + /// collects the outstanding reply first. + Busy, + /// `poll` or `cancel` with nothing in flight. + Idle, +} + +impl core::fmt::Display for ClientError { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::Transport(e) => write!(f, "crypto ipc transport error: {e}"), + Self::Wire(e) => write!(f, "crypto ipc response did not decode: {e}"), + Self::Refused(code) => write!(f, "crypto service refused: {code}"), + Self::Busy => f.write_str("a crypto ipc request is already in flight"), + Self::Idle => f.write_str("no crypto ipc request in flight"), + } + } +} + +impl core::error::Error for ClientError { + fn source(&self) -> Option<&(dyn core::error::Error + 'static)> { + match self { + Self::Transport(e) => Some(e), + Self::Wire(e) => Some(e), + Self::Refused(_) | Self::Busy | Self::Idle => None, + } + } +} + +impl From for ClientError { + fn from(e: TransportError) -> Self { + Self::Transport(e) + } +} + +impl From for ClientError { + fn from(e: WireError) -> Self { + Self::Wire(e) + } +} diff --git a/services/crypto/client/src/lib.rs b/services/crypto/client/src/lib.rs new file mode 100644 index 000000000..7547b449e --- /dev/null +++ b/services/crypto/client/src/lib.rs @@ -0,0 +1,45 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Crypto IPC client: the orchestrator's side of the crypto channel. +//! +//! Two operations: `start_verify` names a flash region (absolute +//! address + length), and `query_status` polls for hashing progress +//! or a verdict. The crypto service reads the firmware bytes from the +//! flash service itself; nothing crosses this interface but a region +//! descriptor and a verdict. +//! +//! One round-trip at a time. The response frame does not name the +//! operation, so the client remembers what it asked. +//! +//! ## Usage +//! +//! ```rust,ignore +//! use crypto_api::VerifyRegion; +//! use crypto_client::{ClientError, CryptoIpcClient, Reply}; +//! +//! let region = VerifyRegion { address: 0x2000_0000, length: 0x0008_0000 }; +//! client.start_verify(®ion)?; +//! +//! match client.poll() { +//! Ok(None) => {} // not answered yet +//! Ok(Some(Reply::Accepted)) => {} // ack only, not a verdict +//! Err(ClientError::Refused(code)) => {} // the service said no +//! Err(e) => {} // channel failed +//! } +//! +//! // Later, poll for progress: +//! client.query_status()?; +//! match client.poll() { +//! Ok(Some(Reply::Status(s))) => {} // hashing or done +//! _ => {} +//! } +//! ``` + +#![no_std] + +mod client; +mod error; + +pub use client::{CryptoIpcClient, Reply}; +pub use error::ClientError; diff --git a/services/flash/BUILD.bazel b/services/flash/BUILD.bazel new file mode 100644 index 000000000..e4a6babd3 --- /dev/null +++ b/services/flash/BUILD.bazel @@ -0,0 +1,58 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "opcode", + srcs = [ + "opcode.rs", + ], + crate_name = "services_flash_opcode", + edition = "2024", + deps = [ + "//hal/blocking/flash", + "//util/types", + "@rust_crates//:zerocopy", + ], +) + +rust_library( + name = "client", + srcs = [ + "client.rs", + ], + crate_name = "services_flash_client", + edition = "2024", + deps = [ + ":opcode", + "//hal/blocking/flash", + "//util/error", + "//util/ipc", + "//util/types", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + "@rust_crates//:zerocopy", + ], +) + +rust_library( + name = "server", + srcs = [ + "server.rs", + ], + crate_name = "services_flash_server", + edition = "2024", + deps = [ + ":opcode", + "//hal/blocking/flash", + "//util/error", + "//util/ipc", + "//util/types", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + "@rust_crates//:zerocopy", + ], +) diff --git a/services/flash/README.md b/services/flash/README.md new file mode 100644 index 000000000..e352c54a8 --- /dev/null +++ b/services/flash/README.md @@ -0,0 +1,88 @@ +# Flash Service + +The Flash Service provides a centralized interface for userspace applications to interact with on-chip and external flash memory. This is achieved via an IPC-based client-server architecture. + +## Overview + +Applications interact with flash through the `Flash` trait, typically using the `FlashIpcClient` implementation. All operations are blocking from the perspective of the caller. + +### Key Features +- **Partition Support**: Access to both primary Data partitions and auxiliary Info partitions. +- **Flexible Erase**: Support for multiple erase granularities (e.g., page vs. block) as reported by the hardware. +- **Unified Addressing**: A logical `FlashAddress` system that abstracts hardware-specific bank and page layouts. + +## Usage + +To use the flash service, initialize a `FlashIpcClient` with a handle to the flash service: + +```rust +use hal_flash::{Flash, FlashAddress}; +use services_flash_client::FlashIpcClient; +use util_ipc::IpcHandle; + +// 1. Connect to the flash service +let mut flash = FlashIpcClient::new(IpcHandle::new(FLASH_SERVICE_HANDLE))?; + +// 2. Retrieve device geometry +let (total_size, page_size, erasable_bitmap) = flash.geometry(); + +// 3. Erase a block (using the default page size) +let addr = FlashAddress::new(0x1000); +flash.erase(addr, page_size)?; + +// 4. Program data +flash.program(addr, b"Hello, Flash!")?; + +// 5. Read data back +let mut buf = [0u8; 13]; +flash.read(addr, &mut buf)?; +``` + +## The `Flash` Trait + +The primary interface for flash operations: + +- `geometry() -> (NonZero, PowerOf2Usize, u32)`: Returns the total capacity, the default/smallest page size, and a bitmap of all supported erase block sizes. +- `read(addr, buf)`: Reads data from the specified address. +- `erase(addr, size)`: Erases a block of the specified size. The size must be one of the values supported in the `erasable_bitmap`. +- `program(addr, data)`: Writes data to the specified address. Flash must be erased before programming. + +### Understanding `erasable_bitmap` +The `erasable_bitmap` is a `u32` where each set bit `i` indicates that an erase block size of `2^i` bytes is supported. +- Bit 11 set (`0x800`) -> 2048-byte erase supported. +- Bit 16 set (`0x10000`) -> 64KB erase supported. + +## Addressing + +Flash memory is addressed using the `FlashAddress` type, which wraps a single 32-bit `offset`. + +On platforms like Earlgrey, the most significant bit (MSB) of this offset is used to distinguish between different partitions: +- **DATA partition**: MSB is 0 (offset < 0x80000000). +- **INFO partition**: MSB is 1 (offset >= 0x80000000). + +The `EarlgreyFlashAddress` trait (from `earlgrey_util`) provides helper methods to construct and inspect addresses: +- `FlashAddress::data(offset)`: Accesses the main data partition. +- `FlashAddress::info(bank, page, offset)`: Accesses specific info pages. + +## Implementation Details + +The service is built on several layers of abstraction: + +### IPC Layer +- **`FlashIpcServer`**: Wraps a hardware-backed `Flash` implementation and dispatches IPC requests. +- **`FlashIpcClient`**: Implements the `Flash` trait by proxying calls to the server. + +### Hardware Abstraction +- **`FlashDriver` Trait**: Defines the low-level, often asynchronous, interface for hardware drivers. +- **`BlockingFlash`**: A wrapper that converts a `FlashDriver` into a synchronous `Flash` implementation using a provided blocking mechanism. + +### Component Diagram + +```mermaid +graph TD + Client[Userspace Application] -- "Flash Trait" --> IPC_Client[FlashIpcClient] + IPC_Client -- "IPC" --> IPC_Server[FlashIpcServer] + IPC_Server -- "Flash Trait" --> BlockingFlash[BlockingFlash] + BlockingFlash -- "FlashDriver Trait" --> HardwareDriver[e.g., EmbeddedFlash] + HardwareDriver --> HW[Flash Controller] +``` diff --git a/services/flash/client.rs b/services/flash/client.rs new file mode 100644 index 000000000..7d15544f1 --- /dev/null +++ b/services/flash/client.rs @@ -0,0 +1,109 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Flash IPC client implementation. + +#![no_std] +use core::num::NonZero; + +use hal_flash::{Flash, FlashAddress}; +use services_flash_opcode::*; +use userspace::time::Instant; +use util_error::{self as error, ErrorCode}; +use util_ipc::{IpcHandle, IpcInitiator}; +use util_types::PowerOf2Usize; +use zerocopy::{FromZeros, IntoBytes}; + +/// An IPC-based client for the flash service. +/// +/// This struct implements the `Flash` trait by proxying requests to a remote +/// flash server via an IPC handle. +pub struct FlashIpcClient { + ipc: IpcHandle, + page_size: PowerOf2Usize, + total_size: NonZero, + erasable_sizes_bitmap: u32, +} + +impl FlashIpcClient { + /// Creates a new `FlashIpcClient` using the provided IPC handle. + /// + /// This constructor will perform an IPC transaction to retrieve flash + /// geometry and capabilities from the server. + pub fn new(ipc: IpcHandle) -> Result { + let mut info = FlashInfo::new_zeroed(); + let mut result = 0u32; + + ipc.transact( + &[IPC_OP_FLASH_GET_INFO.as_bytes()], + &mut [result.as_mut_bytes(), info.as_mut_bytes()], + Instant::MAX, + ) + .map_err(ErrorCode::kernel_error)?; + ErrorCode::check_status(result)?; + + let Some(page_size) = PowerOf2Usize::new(info.page_size as usize) else { + return Err(error::FLASH_GENERIC_INVALID_PAGE_SIZE); + }; + let Some(total_size) = NonZero::new(info.total_size as usize) else { + return Err(error::FLASH_GENERIC_INVALID_SIZE); + }; + Ok(Self { + ipc, + page_size, + total_size, + erasable_sizes_bitmap: info.erasable_sizes_bitmap, + }) + } +} + +impl Flash for FlashIpcClient { + type Error = ErrorCode; + fn geometry(&mut self) -> Result<(NonZero, PowerOf2Usize, u32), ErrorCode> { + Ok((self.total_size, self.page_size, self.erasable_sizes_bitmap)) + } + + fn erase(&mut self, start_addr: FlashAddress, size: PowerOf2Usize) -> Result<(), ErrorCode> { + let mut result = 0u32; + let op = EraseOp { + address: start_addr, + size: size.get() as u32, + }; + self.ipc + .transact( + &[IPC_OP_FLASH_ERASE.as_bytes(), op.as_bytes()], + &mut [result.as_mut_bytes()], + Instant::MAX, + ) + .map_err(ErrorCode::kernel_error)?; + ErrorCode::check_status(result) + } + + fn program(&mut self, start_addr: FlashAddress, data: &[u8]) -> Result<(), ErrorCode> { + let mut result = 0u32; + self.ipc + .transact( + &[IPC_OP_FLASH_PROGRAM.as_bytes(), start_addr.as_bytes(), data], + &mut [result.as_mut_bytes()], + Instant::MAX, + ) + .map_err(ErrorCode::kernel_error)?; + ErrorCode::check_status(result) + } + + fn read(&mut self, start_addr: FlashAddress, buf: &mut [u8]) -> Result<(), ErrorCode> { + let mut result = 0u32; + let op = ReadOp { + address: start_addr, + length: buf.len() as u32, + }; + self.ipc + .transact( + &[IPC_OP_FLASH_READ.as_bytes(), op.as_bytes()], + &mut [result.as_mut_bytes(), buf], + Instant::MAX, + ) + .map_err(ErrorCode::kernel_error)?; + ErrorCode::check_status(result) + } +} diff --git a/services/flash/opcode.rs b/services/flash/opcode.rs new file mode 100644 index 000000000..ef6805eef --- /dev/null +++ b/services/flash/opcode.rs @@ -0,0 +1,51 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Shared flash IPC opcodes and data structures. + +#![no_std] + +use hal_flash::FlashAddress; +use util_types::Opcode; +use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; + +/// IPC opcode for erasing a flash block. +pub const IPC_OP_FLASH_ERASE: Opcode = Opcode::new(*b"FLET"); +/// IPC opcode for programming flash. +pub const IPC_OP_FLASH_PROGRAM: Opcode = Opcode::new(*b"FLWR"); +/// IPC opcode for reading from flash. +pub const IPC_OP_FLASH_READ: Opcode = Opcode::new(*b"FLRD"); +/// IPC opcode for retrieving flash information. +pub const IPC_OP_FLASH_GET_INFO: Opcode = Opcode::new(*b"FLIN"); + +/// Information about the flash device. +#[derive(FromBytes, Immutable, IntoBytes, KnownLayout)] +#[repr(C)] +pub struct FlashInfo { + /// The size of a single flash page in bytes. + pub page_size: u32, + /// The total size of the flash in bytes. + pub total_size: u32, + /// A bitmap of supported erase block sizes. + pub erasable_sizes_bitmap: u32, +} + +/// Arguments for the `IPC_OP_FLASH_ERASE` request. +#[derive(FromBytes, IntoBytes, KnownLayout, Immutable)] +#[repr(C)] +pub struct EraseOp { + /// The start address of the block to erase. + pub address: FlashAddress, + /// The size of the block to erase in bytes. + pub size: u32, +} + +/// Arguments for the `IPC_OP_FLASH_READ` request. +#[derive(FromBytes, IntoBytes, KnownLayout, Immutable)] +#[repr(C)] +pub struct ReadOp { + /// The start address to read from. + pub address: FlashAddress, + /// The number of bytes to read. + pub length: u32, +} diff --git a/services/flash/server.rs b/services/flash/server.rs new file mode 100644 index 000000000..40970f49c --- /dev/null +++ b/services/flash/server.rs @@ -0,0 +1,134 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Flash IPC server implementation. + +#![no_std] + +use hal_flash::{Flash, FlashAddress}; +use services_flash_opcode::*; +use util_error::{self as error, ErrorCode}; +use util_ipc::{IpcHandle, IpcHandler}; +use util_types::{Opcode, PowerOf2Usize}; +use zerocopy::{FromBytes, IntoBytes}; + +/// A flash server that handles flash IPC requests. +/// +/// This struct wraps an object implementing the `Flash` trait and provides +/// an IPC interface to it. +pub struct FlashIpcServer { + flash: TFlash, +} + +impl> FlashIpcServer { + /// Creates a new `FlashIpcServer` wrapping the given flash implementation. + pub fn new(flash: TFlash) -> Self { + Self { flash } + } + + /// Handles the `IPC_OP_FLASH_GET_INFO` request. + /// + /// Writes the flash geometry into the provided buffer and returns it. + fn handle_geometry<'a>( + &mut self, + data: &'a mut [u8], + reqsz: usize, + ) -> Result<&'a [u8], ErrorCode> { + if reqsz != 0 { + return Err(error::IPC_ERROR_BAD_REQ_LEN); + } + let (info, _rest) = + FlashInfo::mut_from_prefix(data).map_err(|_| error::IPC_ERROR_BAD_REQ_LEN)?; + let (total_size, page_size, erasable_sizes_bitmap) = self.flash.geometry()?; + info.page_size = page_size.get() as u32; + info.total_size = total_size.get() as u32; + info.erasable_sizes_bitmap = erasable_sizes_bitmap; + Ok(info.as_bytes()) + } + + /// Handles the `IPC_OP_FLASH_ERASE` request. + /// + /// Parses the `EraseOp` from the input data and erases the specified block. + fn handle_erase<'a>( + &mut self, + data: &'a mut [u8], + reqsz: usize, + ) -> Result<&'a [u8], ErrorCode> { + let req_data = data.get(..reqsz).ok_or(error::IPC_ERROR_BAD_REQ_LEN)?; + let op = EraseOp::read_from_bytes(req_data).map_err(|_| error::IPC_ERROR_BAD_REQ_LEN)?; + let Some(size) = PowerOf2Usize::new(op.size as usize) else { + return Err(error::FLASH_GENERIC_ERASE_INVALID_SIZE); + }; + self.flash.erase(op.address, size)?; + Ok(&data[0..0]) + } + + /// Handles the `IPC_OP_FLASH_PROGRAM` request. + /// + /// Parses the start address and data from the input, then programs it. + fn handle_program<'a>( + &mut self, + data: &'a mut [u8], + reqsz: usize, + ) -> Result<&'a [u8], ErrorCode> { + let req_data = data.get(..reqsz).ok_or(error::IPC_ERROR_BAD_REQ_LEN)?; + let (addr, program_data) = + FlashAddress::read_from_prefix(req_data).map_err(|_| error::IPC_ERROR_BAD_REQ_LEN)?; + self.flash.program(addr, program_data)?; + Ok(&data[0..0]) + } + + /// Handles the `IPC_OP_FLASH_READ` request. + /// + /// Parses the `ReadOp` from the input, reads the data from flash into the + /// buffer, and returns the read slice. + fn handle_read<'a>(&mut self, data: &'a mut [u8], reqsz: usize) -> Result<&'a [u8], ErrorCode> { + let req_data = data.get(..reqsz).ok_or(error::IPC_ERROR_BAD_REQ_LEN)?; + let op = ReadOp::read_from_bytes(req_data).map_err(|_| error::IPC_ERROR_BAD_REQ_LEN)?; + let length = op.length as usize; + if length > data.len() { + return Err(error::FLASH_GENERIC_INVALID_SIZE); + } + self.flash.read(op.address, &mut data[..length])?; + Ok(&data[..length]) + } + + fn handle_op<'a>( + &mut self, + opcode: Opcode, + data: &'a mut [u8], + reqsz: usize, + ) -> Result<&'a [u8], ErrorCode> { + match opcode { + IPC_OP_FLASH_GET_INFO => self.handle_geometry(data, reqsz), + IPC_OP_FLASH_ERASE => self.handle_erase(data, reqsz), + IPC_OP_FLASH_PROGRAM => self.handle_program(data, reqsz), + IPC_OP_FLASH_READ => self.handle_read(data, reqsz), + _ => Err(error::IPC_ERROR_UNKNOWN_OP), + } + } + + /// Handles a single IPC request. + /// + /// This method performs a non-blocking read on the IPC handle. The caller + /// must ensure the handle is readable (e.g., by calling `syscall::object_wait`) + /// before calling this method. + pub fn handle_one(&mut self, ipc: &IpcHandle, data: &mut [u8]) -> Result<(), ErrorCode> { + let len = ipc.read(0, data).map_err(ErrorCode::kernel_error)?; + let (opcode, reqrsp) = data.split_at_mut(core::mem::size_of::()); + let opcode = Opcode::read_from_bytes(opcode).map_err(|_| error::IPC_ERROR_BAD_REQ_LEN)?; + let len = len.saturating_sub(core::mem::size_of::()); + + let mut status = 0u32; + let result = match self.handle_op(opcode, reqrsp, len) { + Ok(result) => result, + Err(e) => { + status = e.0.get(); + &[] + } + }; + ipc.respond(&[status.as_bytes(), result]) + .map_err(ErrorCode::kernel_error)?; + Ok(()) + } +} diff --git a/services/i2c/api/src/lib.rs b/services/i2c/api/src/lib.rs index 25698e56e..aaf311c64 100644 --- a/services/i2c/api/src/lib.rs +++ b/services/i2c/api/src/lib.rs @@ -10,7 +10,7 @@ pub mod transport; #[doc(inline)] pub use protocol::{ I2cError, I2cOp, I2cOpDesc, I2cOpKind, I2cRequestHeader, I2cResponseHeader, SlaveEvent, - MAX_OPS, MAX_PAYLOAD_SIZE, + MAX_BUF_SIZE, MAX_OPS, MAX_PAYLOAD_SIZE, }; pub use seam::I2cSlaveEvent; pub use transport::{Transport, TransportError}; diff --git a/services/i2c/api/src/protocol.rs b/services/i2c/api/src/protocol.rs index c69969270..19d2c1b28 100644 --- a/services/i2c/api/src/protocol.rs +++ b/services/i2c/api/src/protocol.rs @@ -22,12 +22,22 @@ use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; -/// Max total payload (sum of read or write bytes) in one transaction. -pub const MAX_PAYLOAD_SIZE: usize = 256; +/// One IPC message buffer. A whole transaction crosses the boundary in a +/// single round-trip and is never fragmented, so this bounds header plus +/// payload in either direction. +pub const MAX_BUF_SIZE: usize = 512; /// Max number of `Operation`s in one transaction. pub const MAX_OPS: usize = 16; +/// Max total payload (sum of read or write bytes) in one transaction. +/// +/// Derived from [`MAX_BUF_SIZE`] rather than chosen: the request direction is +/// the tighter of the two, carrying an op descriptor per operation on top of +/// the header. Raising the payload ceiling means raising `MAX_BUF_SIZE`. +pub const MAX_PAYLOAD_SIZE: usize = + MAX_BUF_SIZE - I2cRequestHeader::SIZE - MAX_OPS * I2cOpDesc::SIZE; + #[non_exhaustive] #[repr(u8)] #[derive(Debug, Clone, Copy, PartialEq, Eq)] diff --git a/services/i2c/client/src/lib.rs b/services/i2c/client/src/lib.rs index 3eeafea1b..da94b07a9 100644 --- a/services/i2c/client/src/lib.rs +++ b/services/i2c/client/src/lib.rs @@ -21,13 +21,9 @@ use i2c_api::seam::{error_kind, ErrorKind, ErrorType, I2c, Operation, SevenBitAddress}; use i2c_api::{ I2cError, I2cOp, I2cOpDesc, I2cOpKind, I2cRequestHeader, I2cResponseHeader, SlaveEvent, - Transport, TransportError, MAX_OPS, MAX_PAYLOAD_SIZE, + Transport, TransportError, MAX_BUF_SIZE, MAX_OPS, MAX_PAYLOAD_SIZE, }; -// One IPC message fits in a single 512-byte channel buffer on the server side. -// Raising this requires a matching change to the server's receive buffer. -const MAX_BUF_SIZE: usize = 512; - #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum ClientError { Transport(TransportError), diff --git a/services/i2c/server-runtime/src/lib.rs b/services/i2c/server-runtime/src/lib.rs index 98889c5e0..9a632176f 100644 --- a/services/i2c/server-runtime/src/lib.rs +++ b/services/i2c/server-runtime/src/lib.rs @@ -27,9 +27,12 @@ use i2c_api::seam::{ I2c, I2cBusRecovery, I2cIsrEvent, I2cSlaveBuffer, I2cSlaveEvent, SevenBitAddress, }; -use i2c_api::{I2cError, I2cOp, I2cRequestHeader, I2cResponseHeader, SlaveEvent, MAX_PAYLOAD_SIZE}; +use i2c_api::{ + I2cError, I2cOp, I2cRequestHeader, I2cResponseHeader, SlaveEvent, MAX_BUF_SIZE, + MAX_PAYLOAD_SIZE, +}; +use i2c_server::dispatch; use i2c_server::slave::dispatch_slave; -use i2c_server::{dispatch, MAX_BUF_SIZE}; use userspace::syscall::{self, Signals}; use userspace::time::Instant; diff --git a/services/i2c/server/src/lib.rs b/services/i2c/server/src/lib.rs index 5994bd9fb..8fc892baf 100644 --- a/services/i2c/server/src/lib.rs +++ b/services/i2c/server/src/lib.rs @@ -41,10 +41,6 @@ use i2c_api::{ MAX_PAYLOAD_SIZE, }; -/// One request/response buffer size. Matches the client's `MAX_BUF_SIZE`: a -/// whole transaction must fit one round-trip and is never fragmented. -pub const MAX_BUF_SIZE: usize = 512; - /// Map the embedded-hal error taxonomy onto the wire status code. The server /// stays decoupled from any concrete backend: it only needs `B::Error: Error`. pub(crate) fn kind_to_wire(kind: ErrorKind) -> I2cError { diff --git a/services/mctp/transport-i2c/src/sender.rs b/services/mctp/transport-i2c/src/sender.rs index a4bc3deb5..49acc10b2 100644 --- a/services/mctp/transport-i2c/src/sender.rs +++ b/services/mctp/transport-i2c/src/sender.rs @@ -10,6 +10,10 @@ use embedded_hal::i2c::I2c; use mctp::Result; use mctp_lib::i2c::{MctpI2cEncap, MCTP_I2C_MAXMTU}; +/// MCTP transport header bytes the fragmenter prepends to every fragment. +/// `mctp-estack` keeps `MctpHeader::LEN` private, so it is restated here. +const MCTP_HEADER_LEN: usize = 4; + /// I2C MCTP sender. /// /// Implements `mctp_lib::Sender` to fragment and send MCTP packets @@ -144,7 +148,7 @@ impl> mctp_lib::Sender for I2cSender { } fn get_mtu(&self) -> usize { - MCTP_I2C_MAXMTU + MCTP_I2C_MAXMTU - MCTP_HEADER_LEN } } diff --git a/services/mctp/transport-loopback/BUILD.bazel b/services/mctp/transport-loopback/BUILD.bazel new file mode 100644 index 000000000..8f4e5dfc7 --- /dev/null +++ b/services/mctp/transport-loopback/BUILD.bazel @@ -0,0 +1,30 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") + +rust_library( + name = "mctp_transport_loopback", + srcs = [ + "src/lib.rs", + "src/queue.rs", + "src/sender.rs", + "src/tests.rs", + ], + crate_name = "openprot_mctp_transport_loopback", + edition = "2024", + visibility = ["//visibility:public"], + deps = [ + "@rust_crates//:heapless", + "@rust_crates//:mctp", + "@rust_crates//:mctp-lib", + ], +) + +# Host tests: the round trip goes through a real server, which is why the +# server is a test-only dependency rather than a dependency of the library. +rust_test( + name = "mctp_transport_loopback_test", + crate = ":mctp_transport_loopback", + deps = ["//services/mctp/server:mctp_server_lib"], +) diff --git a/services/mctp/transport-loopback/src/lib.rs b/services/mctp/transport-loopback/src/lib.rs new file mode 100644 index 000000000..cda3e5de6 --- /dev/null +++ b/services/mctp/transport-loopback/src/lib.rs @@ -0,0 +1,48 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! An MCTP transport that goes nowhere: packets come straight back in. +//! +//! On a board the server's [`Sender`](mctp_lib::Sender) hands fragments to +//! a wire. In a QEMU test there is no wire and no second chip, so both +//! endpoints live in one image. This sender queues what its router +//! fragments, and the caller feeds that queue to the *other* endpoint's +//! `Server::inbound`. One server's outbox is the other's wire. +//! +//! The queue is owned by the caller rather than by the sender, because the +//! router takes the sender by value and offers no way back to it. The +//! caller keeps [`LoopbackQueue`] and lends it to [`LoopbackSender`]: +//! +//! ```ignore +//! let out_a = LoopbackQueue::<8>::new(); +//! let out_b = LoopbackQueue::<8>::new(); +//! let mut a = Server::new(Eid(8), now, LoopbackSender::new(&out_a)); +//! let mut b = Server::new(Eid(42), now, LoopbackSender::new(&out_b)); +//! // a sends; what a queued is what b receives. +//! while let Some(pkt) = out_a.take() { +//! b.inbound(&pkt)?; +//! } +//! ``` +//! +//! Two servers, not one looping to itself: a message addressed to a +//! server's own EID has no route out and back. +//! +//! Draining in the caller's loop rather than re-entering the router keeps +//! the send path non-blocking and the borrow straight, since the router +//! owns the sender and offers no way back to it. +//! +//! What this does not model: a wire that drops, reorders, delays or +//! corrupts. Every packet arrives, in order, as soon as the caller drains. +//! A test that wants retry or timeout behaviour needs something else. + +#![cfg_attr(not(test), no_std)] +#![forbid(unsafe_code)] + +mod queue; +mod sender; + +pub use queue::{LoopbackQueue, Packet, LOOPBACK_MTU}; +pub use sender::LoopbackSender; + +#[cfg(test)] +mod tests; diff --git a/services/mctp/transport-loopback/src/queue.rs b/services/mctp/transport-loopback/src/queue.rs new file mode 100644 index 000000000..7d9c17c73 --- /dev/null +++ b/services/mctp/transport-loopback/src/queue.rs @@ -0,0 +1,87 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The packet queue the caller keeps and the sender writes to. + +use core::cell::RefCell; + +use heapless::Deque; + +/// Largest payload this transport carries in one fragment. Nothing here is +/// limited by a bus, so the number only has to be agreed by both ends, +/// which it is by construction. +pub const LOOPBACK_MTU: usize = 255; + +/// MCTP transport header, which rides in front of the payload. The +/// fragment buffer has to hold both: a buffer of exactly the MTU makes the +/// router reject the send rather than truncate it. +pub(crate) const MCTP_HEADER_SIZE: usize = 4; + +/// One fragmented packet waiting to be fed back in, header included. +pub type Packet = heapless::Vec; + +/// Packets on their way from the router back to it. +/// +/// `DEPTH` bounds how many fragments may be in flight between drains. A +/// caller that drains after every send needs one; one that sends a whole +/// message first needs as many fragments as that message takes. +pub struct LoopbackQueue { + inner: RefCell>, +} + +struct Inner { + packets: Deque, + dropped: u32, +} + +impl Default for LoopbackQueue { + fn default() -> Self { + Self::new() + } +} + +impl LoopbackQueue { + /// An empty queue. + #[must_use] + pub const fn new() -> Self { + Self { + inner: RefCell::new(Inner { + packets: Deque::new(), + dropped: 0, + }), + } + } + + /// Takes the oldest queued packet, or `None` when none are waiting. + /// Feed what this returns to `Server::inbound`. + pub fn take(&self) -> Option { + self.inner.borrow_mut().packets.pop_front() + } + + /// How many packets are waiting. + #[must_use] + pub fn pending(&self) -> usize { + self.inner.borrow().packets.len() + } + + /// How many packets were discarded because the queue was full. + /// + /// A wire drops packets silently and MCTP is built to cope, so a full + /// queue is not an error here. It is still worth reporting, because in + /// this transport it means `DEPTH` is too small rather than that the + /// medium is lossy, and the test that follows will fail for a reason + /// that looks unrelated. + #[must_use] + pub fn dropped(&self) -> u32 { + self.inner.borrow().dropped + } + + /// Queues one packet, counting a drop instead when the queue is full. + /// The sender's only way in, which is why `inner` stays private. + pub(crate) fn push(&self, packet: Packet) { + let mut inner = self.inner.borrow_mut(); + if inner.packets.push_back(packet).is_err() { + inner.dropped = inner.dropped.saturating_add(1); + } + } +} diff --git a/services/mctp/transport-loopback/src/sender.rs b/services/mctp/transport-loopback/src/sender.rs new file mode 100644 index 000000000..a183b2eee --- /dev/null +++ b/services/mctp/transport-loopback/src/sender.rs @@ -0,0 +1,49 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The [`Sender`] the router sees. Every fragment the router hands it goes +//! to the caller's queue. + +use mctp::{Error, Result, Tag}; +use mctp_lib::fragment::{Fragmenter, SendOutput}; +use mctp_lib::Sender; + +use crate::queue::{LoopbackQueue, Packet, LOOPBACK_MTU, MCTP_HEADER_SIZE}; + +/// The [`Sender`] half. Holds no packets of its own; everything goes to the +/// queue the caller kept. +pub struct LoopbackSender<'q, const DEPTH: usize> { + queue: &'q LoopbackQueue, +} + +impl<'q, const DEPTH: usize> LoopbackSender<'q, DEPTH> { + /// Lends `queue` to the router. + #[must_use] + pub const fn new(queue: &'q LoopbackQueue) -> Self { + Self { queue } + } +} + +impl Sender for LoopbackSender<'_, DEPTH> { + fn send_vectored(&mut self, mut fragmenter: Fragmenter, payload: &[&[u8]]) -> Result { + loop { + let mut buf = [0u8; LOOPBACK_MTU + MCTP_HEADER_SIZE]; + match fragmenter.fragment_vectored(payload, &mut buf) { + SendOutput::Packet(p) => { + let mut packet = Packet::new(); + if packet.extend_from_slice(p).is_err() { + // A fragment longer than the MTU we advertised. + return Err(Error::NoSpace); + } + self.queue.push(packet); + } + SendOutput::Complete { tag, .. } => break Ok(tag), + SendOutput::Error { err, .. } => break Err(err), + } + } + } + + fn get_mtu(&self) -> usize { + LOOPBACK_MTU + } +} diff --git a/services/mctp/transport-loopback/src/tests.rs b/services/mctp/transport-loopback/src/tests.rs new file mode 100644 index 000000000..507fe925e --- /dev/null +++ b/services/mctp/transport-loopback/src/tests.rs @@ -0,0 +1,139 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The queue contract, plus a round trip between two cross-wired servers. +//! +//! A `Fragmenter` is built by the router rather than by callers, so +//! `send_vectored` is exercised through real servers rather than called +//! directly. The two-server arrangement mirrors +//! `services/mctp/echo/tests/echo_host.rs`, which is where it comes from. + +use super::*; +use crate::queue::MCTP_HEADER_SIZE; + +use mctp::Eid; +use mctp_lib::Sender; +use openprot_mctp_server::Server; + +/// The two endpoints. Values are arbitrary; they only have to differ. +const EID_A: u8 = 8; +const EID_B: u8 = 42; + +/// Vendor-defined message type. Nothing here cares what the bytes mean. +const MSG_TYPE: u8 = 0x7E; + +/// Moves everything one side queued into the other side, the way a wire +/// would. Returns how many packets crossed. +fn transfer( + from: &LoopbackQueue, + to: &mut Server, +) -> usize { + let mut crossed = 0; + while let Some(pkt) = from.take() { + to.inbound(&pkt).expect("inbound accepts the packet"); + crossed += 1; + } + crossed +} + +#[test] +fn a_new_queue_has_nothing_in_it() { + let q: LoopbackQueue<4> = LoopbackQueue::new(); + assert_eq!(q.pending(), 0); + assert_eq!(q.dropped(), 0); +} + +#[test] +fn the_advertised_mtu_excludes_the_header() { + let q: LoopbackQueue<4> = LoopbackQueue::new(); + let s = LoopbackSender::new(&q); + assert_eq!(s.get_mtu(), LOOPBACK_MTU); + // The packets it queues carry the header on top of that payload. + assert_eq!(Packet::new().capacity(), LOOPBACK_MTU + MCTP_HEADER_SIZE); +} + +#[test] +fn taking_from_an_empty_queue_gives_nothing() { + let q: LoopbackQueue<4> = LoopbackQueue::new(); + assert!(q.take().is_none()); +} + +#[test] +fn a_message_crosses_from_one_server_to_the_other() { + let out_a: LoopbackQueue<16> = LoopbackQueue::new(); + let out_b: LoopbackQueue<16> = LoopbackQueue::new(); + let mut a: Server<_, 16> = Server::new(Eid(EID_A), 0, LoopbackSender::new(&out_a)); + let mut b: Server<_, 16> = Server::new(Eid(EID_B), 0, LoopbackSender::new(&out_b)); + + let listener = b.listener(MSG_TYPE).expect("B binds a listener"); + + let payload = b"openprot"; + let req = a.req(EID_B).expect("A opens a request to B"); + a.send(Some(req), MSG_TYPE, Some(EID_B), None, false, payload) + .expect("A sends"); + + assert!(transfer(&out_a, &mut b) > 0, "nothing crossed the wire"); + + let mut buf = [0u8; LOOPBACK_MTU]; + let meta = b.try_recv(listener, &mut buf).expect("B receives it"); + assert_eq!(&buf[..payload.len()], payload); + assert_eq!(meta.remote_eid, EID_A); +} + +#[test] +fn a_payload_longer_than_the_mtu_arrives_whole() { + let out_a: LoopbackQueue<16> = LoopbackQueue::new(); + let out_b: LoopbackQueue<16> = LoopbackQueue::new(); + let mut a: Server<_, 16> = Server::new(Eid(EID_A), 0, LoopbackSender::new(&out_a)); + let mut b: Server<_, 16> = Server::new(Eid(EID_B), 0, LoopbackSender::new(&out_b)); + + let listener = b.listener(MSG_TYPE).expect("B binds a listener"); + + // More than one fragment, so reassembly is actually exercised. + let payload: std::vec::Vec = (0..(LOOPBACK_MTU * 2) as u16).map(|i| i as u8).collect(); + let req = a.req(EID_B).expect("A opens a request to B"); + a.send(Some(req), MSG_TYPE, Some(EID_B), None, false, &payload) + .expect("A sends"); + + let fragments = transfer(&out_a, &mut b); + assert!(fragments > 1, "expected several fragments, got {fragments}"); + + let mut buf = [0u8; LOOPBACK_MTU * 3]; + b.try_recv(listener, &mut buf).expect("B receives it"); + assert_eq!(&buf[..payload.len()], &payload[..]); +} + +#[test] +fn the_reply_crosses_back() { + let out_a: LoopbackQueue<16> = LoopbackQueue::new(); + let out_b: LoopbackQueue<16> = LoopbackQueue::new(); + let mut a: Server<_, 16> = Server::new(Eid(EID_A), 0, LoopbackSender::new(&out_a)); + let mut b: Server<_, 16> = Server::new(Eid(EID_B), 0, LoopbackSender::new(&out_b)); + + let listener = b.listener(MSG_TYPE).expect("B binds a listener"); + let req = a.req(EID_B).expect("A opens a request to B"); + a.send(Some(req), MSG_TYPE, Some(EID_B), None, false, b"ping") + .expect("A sends"); + transfer(&out_a, &mut b); + + let mut buf = [0u8; LOOPBACK_MTU]; + let meta = b + .try_recv(listener, &mut buf) + .expect("B receives the request"); + + // A response carries no handle and reuses the request's tag. + b.send( + None, + MSG_TYPE, + Some(EID_A), + Some(meta.msg_tag), + false, + b"pong", + ) + .expect("B replies"); + assert!(transfer(&out_b, &mut a) > 0, "the reply did not cross"); + + let mut reply = [0u8; LOOPBACK_MTU]; + a.try_recv(req, &mut reply).expect("A receives the reply"); + assert_eq!(&reply[..4], b"pong"); +} diff --git a/services/ocp-recovery/api/BUILD.bazel b/services/ocp-recovery/api/BUILD.bazel new file mode 100644 index 000000000..f4c0e85ca --- /dev/null +++ b/services/ocp-recovery/api/BUILD.bazel @@ -0,0 +1,24 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") + +rust_library( + name = "ocp_recovery_api", + srcs = [ + "src/command.rs", + "src/error.rs", + "src/lib.rs", + "src/regs.rs", + ], + crate_name = "openprot_ocp_recovery_api", + edition = "2024", + visibility = ["//visibility:public"], + deps = ["@rust_crates//:zerocopy"], +) + +# Host tests: build on the host platform, no kernel/QEMU. +rust_test( + name = "ocp_recovery_api_test", + crate = ":ocp_recovery_api", +) diff --git a/services/ocp-recovery/api/src/command.rs b/services/ocp-recovery/api/src/command.rs new file mode 100644 index 000000000..bec8f8d8c --- /dev/null +++ b/services/ocp-recovery/api/src/command.rs @@ -0,0 +1,285 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The recovery command codes and the access rules that come with them. + +use crate::error::WireError; + +/// Whether the Recovery Agent may write a command, or only read it. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Access { + /// The Recovery Agent reads the command. A write raises + /// [`WireError::WriteToReadOnly`]. + ReadOnly, + /// The Recovery Agent reads and writes the command. + ReadWrite, +} + +/// How many bytes a command carries. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Length { + /// The command carries exactly this many bytes. + Fixed(usize), + /// The command carries a fixed head followed by a vendor-defined tail, so + /// the length runs from `min` to `max` inclusive. + Range { + /// Smallest accepted length, the fixed head on its own. + min: usize, + /// Largest accepted length. + max: usize, + }, + /// The command is a data aperture and carries as many bytes as the + /// transport allows. SMBus caps it at + /// [`SMBUS_MAX_PAYLOAD`](crate::SMBUS_MAX_PAYLOAD); I3C and USB + /// negotiate their own cap. + Payload, +} + +impl Length { + /// Whether a transfer of `len` bytes fits the command. + /// + /// `transport_max` is the largest payload the transport carries in one + /// access, and only [`Length::Payload`] consults it: the fixed and ranged + /// lengths come from the spec and hold on every transport. + pub fn accepts(self, len: usize, transport_max: usize) -> bool { + match self { + Self::Fixed(n) => len == n, + Self::Range { min, max } => (min..=max).contains(&len), + Self::Payload => (1..=transport_max).contains(&len), + } + } +} + +/// When the device must answer a command. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Scope { + /// The device answers whenever the recovery interface is up, so the + /// contents are populated at init rather than when recovery starts. + Always, + /// The device answers once the recovery interface is in recovery mode. + RecoveryMode, +} + +/// A recovery command, named by the command byte of the transaction. +/// +/// Decoding the byte once through [`RecoveryCommand::try_from`] gives the +/// handler a value whose access rule, length and scope are settled, so no +/// later step re-validates the byte. The spec closes the command set at +/// 0x2f, so the enum is exhaustive and a consumer match covers every command +/// without a wildcard arm. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u8)] +pub enum RecoveryCommand { + /// Device capabilities, magic string and protocol version. + ProtCap = 0x22, + /// Device identity, in the form the DMTF firmware update standard uses. + DeviceId = 0x23, + /// Accumulated device status, protocol error and recovery reason code. + DeviceStatus = 0x24, + /// Device reset, forced recovery and interface mastering control. + DeviceReset = 0x25, + /// Selects the memory region to recover from and activates the image. + RecoveryCtrl = 0x26, + /// How far the device has come with the image it is recovering. + RecoveryStatus = 0x27, + /// Hardware status, including the composite temperature. + HwStatus = 0x28, + /// Selects a memory region for indirect access. + IndirectCtrl = 0x29, + /// Status of the region the indirect window selects. + IndirectStatus = 0x2a, + /// Read and write aperture of the indirect window. + IndirectData = 0x2b, + /// Vendor-defined command. + Vendor = 0x2c, + /// Selects a FIFO region and carries the size of the image to come. + IndirectFifoCtrl = 0x2d, + /// FIFO indices, region size and maximum transfer size. + IndirectFifoStatus = 0x2e, + /// Write aperture the Recovery Agent pushes the image through. + IndirectFifoData = 0x2f, +} + +impl RecoveryCommand { + /// Whether the Recovery Agent may write the command. + pub fn access(self) -> Access { + match self { + Self::ProtCap + | Self::DeviceId + | Self::DeviceStatus + | Self::RecoveryStatus + | Self::HwStatus + | Self::IndirectStatus + | Self::IndirectFifoStatus => Access::ReadOnly, + Self::DeviceReset + | Self::RecoveryCtrl + | Self::IndirectCtrl + | Self::IndirectData + | Self::Vendor + | Self::IndirectFifoCtrl + | Self::IndirectFifoData => Access::ReadWrite, + } + } + + /// How many bytes the command carries, as the command table states them. + pub fn length(self) -> Length { + match self { + Self::ProtCap => Length::Fixed(15), + Self::DeviceId => Length::Range { min: 24, max: 255 }, + Self::DeviceStatus => Length::Range { min: 7, max: 255 }, + Self::DeviceReset | Self::RecoveryCtrl => Length::Fixed(3), + Self::RecoveryStatus => Length::Fixed(2), + Self::HwStatus => Length::Range { min: 4, max: 255 }, + Self::IndirectCtrl | Self::IndirectStatus | Self::IndirectFifoCtrl => Length::Fixed(6), + Self::IndirectFifoStatus => Length::Fixed(20), + Self::IndirectData | Self::Vendor | Self::IndirectFifoData => Length::Payload, + } + } + + /// When the device must answer the command. + pub fn scope(self) -> Scope { + match self { + Self::ProtCap + | Self::DeviceId + | Self::DeviceStatus + | Self::DeviceReset + | Self::RecoveryCtrl + | Self::RecoveryStatus => Scope::Always, + Self::HwStatus + | Self::IndirectCtrl + | Self::IndirectStatus + | Self::IndirectData + | Self::Vendor + | Self::IndirectFifoCtrl + | Self::IndirectFifoStatus + | Self::IndirectFifoData => Scope::RecoveryMode, + } + } + + /// Checks an incoming write against the access rule and the length. + /// + /// The device calls this before touching any register state, so a refused + /// write leaves the register file as it was. `transport_max` is the + /// largest payload one access of the transport carries, which SMBus sets + /// to [`SMBUS_MAX_PAYLOAD`](crate::SMBUS_MAX_PAYLOAD). + pub fn check_write(self, len: usize, transport_max: usize) -> Result<(), WireError> { + if self.access() == Access::ReadOnly { + return Err(WireError::WriteToReadOnly(self)); + } + if !self.length().accepts(len, transport_max) { + return Err(WireError::LengthMismatch { + command: self, + got: len, + }); + } + Ok(()) + } +} + +impl TryFrom for RecoveryCommand { + type Error = WireError; + + fn try_from(value: u8) -> Result { + match value { + 0x22 => Ok(Self::ProtCap), + 0x23 => Ok(Self::DeviceId), + 0x24 => Ok(Self::DeviceStatus), + 0x25 => Ok(Self::DeviceReset), + 0x26 => Ok(Self::RecoveryCtrl), + 0x27 => Ok(Self::RecoveryStatus), + 0x28 => Ok(Self::HwStatus), + 0x29 => Ok(Self::IndirectCtrl), + 0x2a => Ok(Self::IndirectStatus), + 0x2b => Ok(Self::IndirectData), + 0x2c => Ok(Self::Vendor), + 0x2d => Ok(Self::IndirectFifoCtrl), + 0x2e => Ok(Self::IndirectFifoStatus), + 0x2f => Ok(Self::IndirectFifoData), + other => Err(WireError::UnknownCommand(other)), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::error::ProtocolError; + + #[test] + fn command_bytes_outside_the_recovery_range_are_refused() { + assert_eq!( + RecoveryCommand::try_from(0x21), + Err(WireError::UnknownCommand(0x21)) + ); + assert_eq!( + RecoveryCommand::try_from(0x30), + Err(WireError::UnknownCommand(0x30)) + ); + } + + #[test] + fn every_command_byte_in_the_recovery_range_decodes() { + for byte in 0x22..=0x2fu8 { + let command = RecoveryCommand::try_from(byte).expect("command in range decodes"); + assert_eq!(command as u8, byte); + } + } + + #[test] + fn writing_a_read_only_command_reports_unsupported_command() { + let err = RecoveryCommand::ProtCap + .check_write(15, crate::SMBUS_MAX_PAYLOAD) + .unwrap_err(); + assert_eq!(err, WireError::WriteToReadOnly(RecoveryCommand::ProtCap)); + assert_eq!(ProtocolError::from(err), ProtocolError::UnsupportedCommand); + } + + #[test] + fn a_write_of_the_wrong_length_reports_length_write_error() { + let err = RecoveryCommand::RecoveryCtrl + .check_write(2, crate::SMBUS_MAX_PAYLOAD) + .unwrap_err(); + assert_eq!( + err, + WireError::LengthMismatch { + command: RecoveryCommand::RecoveryCtrl, + got: 2, + } + ); + assert_eq!(ProtocolError::from(err), ProtocolError::LengthWriteError); + assert!(RecoveryCommand::RecoveryCtrl + .check_write(3, crate::SMBUS_MAX_PAYLOAD) + .is_ok()); + } + + #[test] + fn variable_length_commands_accept_the_head_alone_and_a_vendor_tail() { + let device_status = RecoveryCommand::DeviceStatus.length(); + let cap = crate::SMBUS_MAX_PAYLOAD; + assert!(device_status.accepts(7, cap)); + assert!(device_status.accepts(255, cap)); + assert!(!device_status.accepts(6, cap)); + assert!(!device_status.accepts(256, cap)); + } + + #[test] + fn a_data_aperture_is_capped_by_the_transport_and_not_by_the_spec() { + let aperture = RecoveryCommand::IndirectFifoData.length(); + assert!(aperture.accepts(crate::SMBUS_MAX_PAYLOAD, crate::SMBUS_MAX_PAYLOAD)); + assert!(!aperture.accepts(crate::SMBUS_MAX_PAYLOAD + 1, crate::SMBUS_MAX_PAYLOAD)); + assert!(!aperture.accepts(0, crate::SMBUS_MAX_PAYLOAD)); + + // A transport that carries more carries more: the cap is the + // transport's, not a constant this crate applies. + assert!(aperture.accepts(crate::SMBUS_MAX_PAYLOAD + 1, 1024)); + } + + #[test] + fn prot_cap_answers_before_recovery_starts() { + assert_eq!(RecoveryCommand::ProtCap.scope(), Scope::Always); + assert_eq!( + RecoveryCommand::IndirectFifoCtrl.scope(), + Scope::RecoveryMode + ); + } +} diff --git a/services/ocp-recovery/api/src/error.rs b/services/ocp-recovery/api/src/error.rs new file mode 100644 index 000000000..59ada15b6 --- /dev/null +++ b/services/ocp-recovery/api/src/error.rs @@ -0,0 +1,94 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Errors raised while decoding an access from the Recovery Agent. + +use crate::command::RecoveryCommand; + +/// Why an access from the Recovery Agent could not be served. +/// +/// Each variant maps to one of the protocol error codes the spec defines for +/// byte 1 of `DEVICE_STATUS`, so a handler converts with `ProtocolError::from` +/// and reports the result without a second match. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[non_exhaustive] +pub enum WireError { + /// The command byte names no recovery command. + UnknownCommand(u8), + /// The Recovery Agent wrote a command the device serves read-only. + WriteToReadOnly(RecoveryCommand), + /// The write carried the wrong number of bytes for the command. + LengthMismatch { + /// The command the Recovery Agent addressed. + command: RecoveryCommand, + /// How many bytes arrived. + got: usize, + }, + /// A field held a value the spec reserves or does not define. + UnsupportedParameter { + /// The command the Recovery Agent addressed. + command: RecoveryCommand, + /// Which byte of the register carried the value. + offset: usize, + /// The value that arrived. + value: u8, + }, +} + +impl core::fmt::Display for WireError { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::UnknownCommand(byte) => write!(f, "unknown recovery command 0x{byte:02x}"), + Self::WriteToReadOnly(command) => write!(f, "{command:?} is read-only"), + Self::LengthMismatch { command, got } => { + write!(f, "{command:?} write carried {got} bytes") + } + Self::UnsupportedParameter { + command, + offset, + value, + } => write!(f, "{command:?} byte {offset} holds 0x{value:02x}"), + } + } +} + +impl core::error::Error for WireError {} + +/// The protocol error codes of `DEVICE_STATUS` byte 1. +/// +/// The device latches the code and clears it when the Recovery Agent reads +/// `DEVICE_STATUS`, which is why [`DeviceStatus::take_protocol_error`] is the +/// only way to read it. +/// +/// [`DeviceStatus::take_protocol_error`]: crate::regs::DeviceStatus::take_protocol_error +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] +#[repr(u8)] +#[non_exhaustive] +pub enum ProtocolError { + /// Nothing to report. + #[default] + None = 0x0, + /// The command is not supported, or the Recovery Agent wrote a read-only + /// command. + UnsupportedCommand = 0x1, + /// A field held a reserved or undefined value. + UnsupportedParameter = 0x2, + /// The write carried the wrong number of bytes. + LengthWriteError = 0x3, + /// The PEC of the transaction did not match. + CrcError = 0x4, + /// Catch-all for errors the other codes do not classify. + General = 0xff, +} + +impl From for ProtocolError { + fn from(e: WireError) -> Self { + match e { + WireError::UnknownCommand(_) | WireError::WriteToReadOnly(_) => { + Self::UnsupportedCommand + } + WireError::LengthMismatch { .. } => Self::LengthWriteError, + WireError::UnsupportedParameter { .. } => Self::UnsupportedParameter, + } + } +} diff --git a/services/ocp-recovery/api/src/lib.rs b/services/ocp-recovery/api/src/lib.rs new file mode 100644 index 000000000..c9e44724d --- /dev/null +++ b/services/ocp-recovery/api/src/lib.rs @@ -0,0 +1,59 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Register layouts of the OCP Recovery interface, for the eRoT serving them +//! as the device. +//! +//! The BMC is the Recovery Agent and drives the registers over SMBus block +//! transactions; the eRoT answers as the Device, the word the recovery spec +//! uses for the side being recovered. This crate holds +//! the half that does not depend on the transport: the command codes, the +//! byte layouts, the field encodings and the rules for which accesses the +//! device refuses. The SMBus framing, the PEC and the register file the +//! server-runtime owns live elsewhere, so this crate stays host-testable and +//! free of kernel dependencies. +//! +//! [`RecoveryCommand`] decodes the command byte once and carries the access +//! rule, the length and the availability scope with it. The register structs +//! in [`regs`] match the spec byte layout, so the handler writes their bytes +//! to the transport without a conversion step. +//! +//! The AST1030 has no OCP recovery silicon, so the device side is firmware +//! and has to keep the access semantics that the agent state machine expects +//! from hardware. Three of them are easy to get wrong, and each is a named +//! operation here rather than a plain field write: `RECOVERY_CTRL` byte 2 is +//! activated by the agent writing [`ACTIVATE_RECOVERY_IMAGE`] and zeroed by +//! the device afterwards, `DEVICE_RESET` byte 0 works the same way, and +//! `DEVICE_STATUS` byte 1 clears when the agent reads it. +//! +//! [`ACTIVATE_RECOVERY_IMAGE`]: regs::ACTIVATE_RECOVERY_IMAGE + +#![cfg_attr(not(test), no_std)] +#![forbid(unsafe_code)] +#![warn(missing_docs)] +#![deny( + clippy::unwrap_used, + clippy::expect_used, + clippy::panic, + clippy::unreachable, + clippy::todo, + clippy::unimplemented +)] +// Tests unwrap results whose shape the same lines settle. +#![cfg_attr(test, allow(clippy::unwrap_used, clippy::expect_used))] + +pub mod command; +pub mod error; +pub mod regs; + +pub use command::{Access, Length, RecoveryCommand, Scope}; +pub use error::{ProtocolError, WireError}; + +/// Largest payload one SMBus access to a data aperture may carry. +/// +/// The spec caps `INDIRECT_DATA` and `INDIRECT_FIFO_DATA` at 252 bytes for +/// SMBus. I3C and USB cap them at a size the transport negotiates instead, +/// which is why the cap is an argument to +/// [`RecoveryCommand::check_write`](command::RecoveryCommand::check_write) +/// rather than a constant this crate applies on its own. +pub const SMBUS_MAX_PAYLOAD: usize = 252; diff --git a/services/ocp-recovery/api/src/regs.rs b/services/ocp-recovery/api/src/regs.rs new file mode 100644 index 000000000..135a7d801 --- /dev/null +++ b/services/ocp-recovery/api/src/regs.rs @@ -0,0 +1,1235 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The register layouts the device serves to the Recovery Agent. +//! +//! Every struct matches the byte layout of one command, so the handler hands +//! the bytes straight to the transport. Fields are private: the accessors are +//! what decode a byte into a named value, and what refuse a value the spec +//! reserves. +//! +//! Three commands carry a field the agent writes and the device clears: +//! `RECOVERY_CTRL` byte 2, `DEVICE_RESET` byte 0 and `INDIRECT_FIFO_CTRL` +//! byte 1. The agent writes the command value and the device zeroes the field +//! once it has acted, so each of the three has an `apply_agent_write` that +//! takes the write and a `clear_*` the device calls afterwards. Zeroing is not +//! a bitwise clear of the written bits: writing 0x1 to the activate field is +//! not how activation ends, and `apply_agent_write` refuses the value. + +use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; + +use crate::command::RecoveryCommand; +use crate::error::WireError; + +/// The magic string that opens `PROT_CAP`, "OCP RECV" in ASCII. +pub const PROT_CAP_MAGIC: [u8; 8] = *b"OCP RECV"; + +/// Major version of the recovery protocol this crate implements. +pub const PROT_CAP_VERSION_MAJOR: u8 = 1; + +/// Minor version of the recovery protocol this crate implements. +pub const PROT_CAP_VERSION_MINOR: u8 = 1; + +/// Value the Recovery Agent writes to `RECOVERY_CTRL` byte 2 to activate the +/// image it pushed. +pub const ACTIVATE_RECOVERY_IMAGE: u8 = 0xf; + +/// Value `RECOVERY_CTRL` byte 2 holds while no activation is in flight. The +/// device writes it back after the activation it was asked for. +pub const ACTIVATE_IDLE: u8 = 0x0; + +/// Value the Recovery Agent writes to `INDIRECT_FIFO_CTRL` byte 1 to reset the +/// FIFO indices. +pub const FIFO_RESET: u8 = 0x1; + +/// Value `INDIRECT_FIFO_CTRL` byte 1 holds while no reset is in flight. +pub const FIFO_IDLE: u8 = 0x0; + +fn unsupported(command: RecoveryCommand, offset: usize, value: u8) -> WireError { + WireError::UnsupportedParameter { + command, + offset, + value, + } +} + +/// Capability bits of `PROT_CAP` bytes 10 and 11. +pub mod capability { + /// The device serves `DEVICE_ID`. + pub const IDENTIFICATION: u16 = 1 << 0; + /// The device enters recovery when the agent commands forced recovery. + pub const FORCED_RECOVERY: u16 = 1 << 1; + /// The device supports the management reset of `DEVICE_RESET`. + pub const MGMT_RESET: u16 = 1 << 2; + /// The device supports the device reset of `DEVICE_RESET`. + pub const DEVICE_RESET: u16 = 1 << 3; + /// The device serves `DEVICE_STATUS`. + pub const DEVICE_STATUS: u16 = 1 << 4; + /// The device serves the indirect memory window. + pub const MEMORY_ACCESS: u16 = 1 << 5; + /// The device holds a recovery image of its own. + pub const LOCAL_C_IMAGE: u16 = 1 << 6; + /// The agent may push a recovery image to the device. + pub const PUSH_C_IMAGE: u16 = 1 << 7; + /// The device can isolate the interface. + pub const INTERFACE_ISOLATION: u16 = 1 << 8; + /// The device serves `HW_STATUS`. + pub const HARDWARE_STATUS: u16 = 1 << 9; + /// The device serves the vendor command. + pub const VENDOR_COMMAND: u16 = 1 << 10; + /// The device supports flashless boot. + pub const FLASHLESS_BOOT: u16 = 1 << 11; + /// The device serves the FIFO component memory space. + pub const FIFO_CMS: u16 = 1 << 12; +} + +/// `PROT_CAP`, the capabilities the device advertises. +/// +/// The device fills this at init, not when recovery starts: the spec has the +/// agent read it whenever the recovery interface is up. +#[repr(C, packed)] +#[derive(Debug, Clone, Copy, FromBytes, IntoBytes, Immutable, KnownLayout)] +pub struct ProtCap { + magic: [u8; 8], + version_major: u8, + version_minor: u8, + capabilities: u16, + cms_count: u8, + max_response_time: u8, + heartbeat_period: u8, +} + +impl ProtCap { + /// Encoded size in bytes. + pub const SIZE: usize = core::mem::size_of::(); + + /// Builds the capability block for a device. + /// + /// `max_response_time` and `heartbeat_period` are exponents: the value is + /// 2^x microseconds, and a heartbeat period of 0 says the device sends no + /// heartbeat. + pub fn new( + capabilities: u16, + cms_count: u8, + max_response_time: u8, + heartbeat_period: u8, + ) -> Self { + Self { + magic: PROT_CAP_MAGIC, + version_major: PROT_CAP_VERSION_MAJOR, + version_minor: PROT_CAP_VERSION_MINOR, + capabilities: capabilities.to_le(), + cms_count, + max_response_time, + heartbeat_period, + } + } + + /// The advertised capability bits, as in [`capability`]. + pub fn capabilities(&self) -> u16 { + u16::from_le(self.capabilities) + } + + /// Whether the device advertises every bit in `bits`. + pub fn advertises(&self, bits: u16) -> bool { + self.capabilities() & bits == bits + } + + /// How many component memory space regions the device holds. + pub fn cms_count(&self) -> u8 { + self.cms_count + } +} + +/// The device status codes of `DEVICE_STATUS` byte 0. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u8)] +#[non_exhaustive] +pub enum DeviceState { + /// The device is booting and has not populated a reason code. + StatusPending = 0x0, + /// The device is running its operational firmware. + Healthy = 0x1, + /// The device hit an error it could not classify. + DeviceError = 0x2, + /// The device is in recovery mode and will accept an image. + RecoveryModeReady = 0x3, + /// The device holds an image and waits for the agent to activate it. + RecoveryPending = 0x4, + /// The device is running the image it recovered. + RunningRecoveryImage = 0x5, + /// The boot halted, and the reason code says why. Recoverable, which is + /// what separates it from [`DeviceState::FatalError`]. + BootFailure = 0xe, + /// The device cannot be recovered through the OCP flow. + FatalError = 0xf, +} + +impl DeviceState { + /// Decodes byte 0 of `DEVICE_STATUS`, or `None` if the spec reserves the + /// value. + pub fn from_byte(value: u8) -> Option { + match value { + 0x0 => Some(Self::StatusPending), + 0x1 => Some(Self::Healthy), + 0x2 => Some(Self::DeviceError), + 0x3 => Some(Self::RecoveryModeReady), + 0x4 => Some(Self::RecoveryPending), + 0x5 => Some(Self::RunningRecoveryImage), + 0xe => Some(Self::BootFailure), + 0xf => Some(Self::FatalError), + _ => None, + } + } + + /// Whether the agent reads a recovery reason code alongside this status. + /// + /// The agent reads the reason code in recovery mode, while an activation + /// is pending, and on a boot failure. The other states leave it stale, so + /// the device writes 0 with them. + pub fn populates_reason_code(self) -> bool { + matches!( + self, + Self::RecoveryModeReady | Self::RecoveryPending | Self::BootFailure + ) + } +} + +/// The recovery reason codes of `DEVICE_STATUS` bytes 2 and 3. +/// +/// The names follow the spec abbreviations. Vendor codes 0x80 to 0xff are +/// legal and this enum does not name them. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u16)] +#[non_exhaustive] +pub enum RecoveryReason { + /// No boot failure detected. + NoFailure = 0x0, + /// Generic hardware error. + GenericHardwareError = 0x1, + /// Generic hardware soft error, which may be recoverable. + GenericSoftError = 0x2, + /// A self-test failed. + SelfTestFailure = 0x3, + /// Critical data is missing or corrupt. + CorruptedCriticalData = 0x4, + /// The key manifest is missing or corrupt. + KeyManifestMissing = 0x5, + /// The key manifest failed authentication. + KeyManifestAuthFailure = 0x6, + /// The key manifest failed the anti-rollback check. + KeyManifestRollback = 0x7, + /// The boot loader image is missing or corrupt. + BootLoaderMissing = 0x8, + /// The boot loader image failed authentication. + BootLoaderAuthFailure = 0x9, + /// The boot loader image failed the anti-rollback check. + BootLoaderRollback = 0xa, + /// The main firmware image is missing or corrupt. + MainFirmwareMissing = 0xb, + /// The main firmware image failed authentication. + MainFirmwareAuthFailure = 0xc, + /// The main firmware image failed the anti-rollback check. + MainFirmwareRollback = 0xd, + /// The recovery firmware is missing or corrupt. + RecoveryFirmwareMissing = 0xe, + /// The recovery firmware failed authentication. + RecoveryFirmwareAuthFailure = 0xf, + /// The recovery firmware failed the anti-rollback check. + RecoveryFirmwareRollback = 0x10, + /// The agent commanded forced recovery. + ForcedRecovery = 0x11, + /// The device boots with no local image and streams one over the + /// recovery interface. + FlashlessStreamingBoot = 0x12, +} + +/// `DEVICE_STATUS`, the fixed head the vendor status follows. +/// +/// Byte 1 holds the protocol error and the device clears it when the agent +/// reads the register, which is why [`DeviceStatus::take_protocol_error`] is +/// the only way to read it. +#[repr(C, packed)] +#[derive(Debug, Clone, Copy, FromBytes, IntoBytes, Immutable, KnownLayout)] +pub struct DeviceStatus { + status: u8, + protocol_error: u8, + reason_code: u16, + heartbeat: u16, + vendor_status_len: u8, +} + +impl DeviceStatus { + /// Encoded size of the head in bytes. A vendor status tail follows. + pub const SIZE: usize = core::mem::size_of::(); + + /// The status a device reports before it has decided anything. + pub fn pending() -> Self { + Self { + status: DeviceState::StatusPending as u8, + protocol_error: crate::error::ProtocolError::None as u8, + reason_code: 0, + heartbeat: 0, + vendor_status_len: 0, + } + } + + /// The device status, or `None` if the byte holds a reserved value. + pub fn state(&self) -> Option { + DeviceState::from_byte(self.status) + } + + /// Reports a state and the reason code that belongs with it. + /// + /// States that carry no reason code store 0, so a stale code never + /// reaches the agent. + pub fn set_state(&mut self, state: DeviceState, reason: RecoveryReason) { + self.status = state as u8; + self.reason_code = if state.populates_reason_code() { + (reason as u16).to_le() + } else { + 0 + }; + } + + /// The recovery reason code, as the raw value: vendor codes are legal and + /// [`RecoveryReason`] does not name them. + pub fn reason_code(&self) -> u16 { + u16::from_le(self.reason_code) + } + + /// Latches a protocol error for the agent to read. + /// + /// A second error before the agent reads overwrites the first, which is + /// what the spec's single error byte allows. + pub fn set_protocol_error(&mut self, error: crate::error::ProtocolError) { + self.protocol_error = error as u8; + } + + /// Reads the protocol error and clears it, the clear-on-read the spec + /// defines for byte 1. + pub fn take_protocol_error(&mut self) -> u8 { + let error = self.protocol_error; + self.protocol_error = crate::error::ProtocolError::None as u8; + error + } + + /// Advances the heartbeat counter, which wraps at 4095. + pub fn tick_heartbeat(&mut self) { + const HEARTBEAT_MODULUS: u16 = 4096; + let next = (u16::from_le(self.heartbeat) + 1) % HEARTBEAT_MODULUS; + self.heartbeat = next.to_le(); + } + + /// The heartbeat counter. + pub fn heartbeat(&self) -> u16 { + u16::from_le(self.heartbeat) + } +} + +/// The reset the Recovery Agent commands in `DEVICE_RESET` byte 0. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u8)] +#[non_exhaustive] +pub enum ResetControl { + /// No reset. + None = 0x0, + /// Reset the device, which disrupts the bus. + ResetDevice = 0x1, + /// Reset the management subsystem without disrupting the bus. + ResetManagement = 0x2, +} + +impl ResetControl { + /// Decodes byte 0 of `DEVICE_RESET`, or `None` if the spec reserves the + /// value. + pub fn from_byte(value: u8) -> Option { + match value { + 0x0 => Some(Self::None), + 0x1 => Some(Self::ResetDevice), + 0x2 => Some(Self::ResetManagement), + _ => None, + } + } +} + +/// The mode the Recovery Agent arms in `DEVICE_RESET` byte 1, which the device +/// enters at the next platform reset. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u8)] +#[non_exhaustive] +pub enum ForcedRecovery { + /// Boot normally. + None = 0x0, + /// Boot with no local image and stream one over the recovery interface. + FlashlessBoot = 0xe, + /// Enter recovery mode. + RecoveryMode = 0xf, +} + +impl ForcedRecovery { + /// Decodes byte 1 of `DEVICE_RESET`, or `None` if the spec reserves the + /// value. + pub fn from_byte(value: u8) -> Option { + match value { + 0x0 => Some(Self::None), + 0xe => Some(Self::FlashlessBoot), + 0xf => Some(Self::RecoveryMode), + _ => None, + } + } +} + +/// `DEVICE_RESET`, the reset and forced-recovery control. +#[repr(C, packed)] +#[derive(Debug, Clone, Copy, Default, FromBytes, IntoBytes, Immutable, KnownLayout)] +pub struct DeviceReset { + reset_control: u8, + forced_recovery: u8, + interface_control: u8, +} + +impl DeviceReset { + /// Encoded size in bytes. + pub const SIZE: usize = core::mem::size_of::(); + + /// Checks a write off the wire and hands back the bytes at the width this + /// register takes. + /// + /// This is the one step between the wire and + /// [`DeviceReset::apply_agent_write`]: the length is resolved here, and what + /// comes back is the fixed-size array the write takes, so no later step + /// re-checks it. `transport_max` is the largest payload one access of the + /// transport carries. + pub fn from_wire(bytes: &[u8], transport_max: usize) -> Result<&[u8; Self::SIZE], WireError> { + let command = RecoveryCommand::DeviceReset; + command.check_write(bytes.len(), transport_max)?; + bytes.try_into().ok().ok_or(WireError::LengthMismatch { + command, + got: bytes.len(), + }) + } + + /// Byte 2 value that disables interface mastering, which is what the + /// device powers on with. + pub const INTERFACE_MASTERING_DISABLED: u8 = 0x0; + + /// Byte 2 value that enables interface mastering. + pub const INTERFACE_MASTERING_ENABLED: u8 = 0x1; + + /// Takes a write from the Recovery Agent. + /// + /// The argument type settles the length, which [`Self::from_wire`] + /// resolves where the bytes arrive off the wire. + /// Every byte is validated before any is stored, so a refused write + /// leaves the register as it was. + pub fn apply_agent_write(&mut self, bytes: &[u8; Self::SIZE]) -> Result<(), WireError> { + let command = RecoveryCommand::DeviceReset; + let reset = + ResetControl::from_byte(bytes[0]).ok_or_else(|| unsupported(command, 0, bytes[0]))?; + let forced = + ForcedRecovery::from_byte(bytes[1]).ok_or_else(|| unsupported(command, 1, bytes[1]))?; + if bytes[2] > Self::INTERFACE_MASTERING_ENABLED { + return Err(unsupported(command, 2, bytes[2])); + } + self.reset_control = reset as u8; + self.forced_recovery = forced as u8; + self.interface_control = bytes[2]; + Ok(()) + } + + /// The reset the agent commanded, if the value names one. + pub fn reset_control(&self) -> Option { + ResetControl::from_byte(self.reset_control) + } + + /// The mode the agent armed for the next platform reset. + pub fn forced_recovery(&self) -> Option { + ForcedRecovery::from_byte(self.forced_recovery) + } + + /// Whether the agent enabled interface mastering. + pub fn interface_mastering(&self) -> bool { + self.interface_control == Self::INTERFACE_MASTERING_ENABLED + } + + /// Zeroes byte 0 after the device performed the reset the agent asked + /// for. The forced-recovery and interface bytes keep their values: the + /// spec has the device clear only the reset control. + pub fn clear_reset_control(&mut self) { + self.reset_control = ResetControl::None as u8; + } +} + +/// How the Recovery Agent points the device at an image, in `RECOVERY_CTRL` +/// byte 1. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u8)] +#[non_exhaustive] +pub enum ImageSelection { + /// No operation. + None = 0x0, + /// Use the image the agent pushed into the memory window. + FromMemoryWindow = 0x1, + /// Use the image the device holds. + FromDevice = 0x2, +} + +impl ImageSelection { + /// Decodes byte 1 of `RECOVERY_CTRL`, or `None` if the spec reserves the + /// value. + pub fn from_byte(value: u8) -> Option { + match value { + 0x0 => Some(Self::None), + 0x1 => Some(Self::FromMemoryWindow), + 0x2 => Some(Self::FromDevice), + _ => None, + } + } +} + +/// `RECOVERY_CTRL`, which selects the image and activates it. +#[repr(C, packed)] +#[derive(Debug, Clone, Copy, Default, FromBytes, IntoBytes, Immutable, KnownLayout)] +pub struct RecoveryCtrl { + cms: u8, + image_selection: u8, + activate: u8, +} + +impl RecoveryCtrl { + /// Encoded size in bytes. + pub const SIZE: usize = core::mem::size_of::(); + + /// Checks a write off the wire and hands back the bytes at the width this + /// register takes. + /// + /// This is the one step between the wire and + /// [`RecoveryCtrl::apply_agent_write`]: the length is resolved here, and what + /// comes back is the fixed-size array the write takes, so no later step + /// re-checks it. `transport_max` is the largest payload one access of the + /// transport carries. + pub fn from_wire(bytes: &[u8], transport_max: usize) -> Result<&[u8; Self::SIZE], WireError> { + let command = RecoveryCommand::RecoveryCtrl; + command.check_write(bytes.len(), transport_max)?; + bytes.try_into().ok().ok_or(WireError::LengthMismatch { + command, + got: bytes.len(), + }) + } + + /// Takes a write from the Recovery Agent. + /// + /// The argument type settles the length, which [`Self::from_wire`] + /// resolves where the bytes arrive off the wire. + /// + /// Byte 2 accepts [`ACTIVATE_RECOVERY_IMAGE`] and [`ACTIVATE_IDLE`] and + /// nothing else. A device that treated byte 2 as a bitwise clear would + /// accept 0x1 here and leave 0xe behind, a value the spec does not + /// define, so the write is refused instead. + pub fn apply_agent_write(&mut self, bytes: &[u8; Self::SIZE]) -> Result<(), WireError> { + let command = RecoveryCommand::RecoveryCtrl; + let selection = + ImageSelection::from_byte(bytes[1]).ok_or_else(|| unsupported(command, 1, bytes[1]))?; + if bytes[2] != ACTIVATE_RECOVERY_IMAGE && bytes[2] != ACTIVATE_IDLE { + return Err(unsupported(command, 2, bytes[2])); + } + self.cms = bytes[0]; + self.image_selection = selection as u8; + self.activate = bytes[2]; + Ok(()) + } + + /// The component memory space the agent selected. + pub fn cms(&self) -> u8 { + self.cms + } + + /// Where the agent pointed the device for the image. + pub fn image_selection(&self) -> Option { + ImageSelection::from_byte(self.image_selection) + } + + /// Whether the agent asked for an activation the device has not finished. + pub fn activation_requested(&self) -> bool { + self.activate == ACTIVATE_RECOVERY_IMAGE + } + + /// Zeroes byte 2 after the device activated the image. The agent reads + /// [`ACTIVATE_IDLE`] from then on. + pub fn clear_activation(&mut self) { + self.activate = ACTIVATE_IDLE; + } +} + +/// The recovery states of `RECOVERY_STATUS` byte 0, bits 0 to 3. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u8)] +#[non_exhaustive] +pub enum RecoveryState { + /// The device is not in recovery mode. + NotInRecovery = 0x0, + /// The device waits for the agent to push the image. + AwaitingImage = 0x1, + /// The device is booting the image it received. + BootingImage = 0x2, + /// The image booted. + Successful = 0x3, + /// A stage failed to activate. Distinct from + /// [`RecoveryState::AuthenticationError`], which names why. + Failed = 0xc, + /// The image failed authentication. + AuthenticationError = 0xd, + /// The device could not enter recovery mode, which an administrator may + /// have disabled. + EnterRecoveryError = 0xe, + /// The agent named a component address space the device does not hold. + InvalidComponentAddressSpace = 0xf, +} + +impl RecoveryState { + /// Decodes bits 0 to 3 of `RECOVERY_STATUS` byte 0, or `None` if the spec + /// reserves the value. + pub fn from_bits(value: u8) -> Option { + match value { + 0x0 => Some(Self::NotInRecovery), + 0x1 => Some(Self::AwaitingImage), + 0x2 => Some(Self::BootingImage), + 0x3 => Some(Self::Successful), + 0xc => Some(Self::Failed), + 0xd => Some(Self::AuthenticationError), + 0xe => Some(Self::EnterRecoveryError), + 0xf => Some(Self::InvalidComponentAddressSpace), + _ => None, + } + } +} + +/// Which image a [`RecoveryStatus`] refers to, bounded to the 4-bit field. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct ImageIndex(u8); + +impl ImageIndex { + /// Largest index the field holds. + pub const MAX: u8 = 0xf; + + /// The index of the first image, which the device reports before the + /// Recovery Agent has pushed anything. + pub const FIRST: Self = Self(0); + + /// Names an image, or `None` if the index does not fit the field. + pub const fn new(index: u8) -> Option { + if index > Self::MAX { + return None; + } + Some(Self(index)) + } + + /// The index as the field stores it. + pub const fn get(self) -> u8 { + self.0 + } +} + +/// `RECOVERY_STATUS`, which reports how far the device has come. +/// +/// The register is read-only to the agent. The image index in bits 4 to 7 +/// reports which stage the device is recovering, and the device keeps it set +/// to the stage a status refers to so a failure names the image it belongs to. +#[repr(C, packed)] +#[derive(Debug, Clone, Copy, Default, FromBytes, IntoBytes, Immutable, KnownLayout)] +pub struct RecoveryStatus { + status: u8, + vendor_status: u8, +} + +impl RecoveryStatus { + /// Encoded size in bytes. + pub const SIZE: usize = core::mem::size_of::(); + + const STATE_MASK: u8 = 0x0f; + const INDEX_SHIFT: u8 = 4; + + /// Reports a state for one image. + /// + /// [`ImageIndex`] bounds the index to the 4 bits the field holds, so no + /// index truncates into the state bits and the call cannot fail. + pub fn set(&mut self, state: RecoveryState, image: ImageIndex) { + self.status = (image.get() << Self::INDEX_SHIFT) | (state as u8); + } + + /// The reported state, or `None` if the bits hold a reserved value. + pub fn state(&self) -> Option { + RecoveryState::from_bits(self.status & Self::STATE_MASK) + } + + /// Which image the reported state refers to. + pub fn image(&self) -> ImageIndex { + ImageIndex(self.status >> Self::INDEX_SHIFT) + } +} + +/// Length of the vendor hardware status tail of `HW_STATUS`. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] +pub struct VendorStatusLen(u8); + +impl VendorStatusLen { + /// Longest tail the register carries, which the command table states as + /// 0 to 251 bytes. + pub const MAX: u8 = 251; + + /// No vendor hardware status follows the head. + pub const NONE: Self = Self(0); + + /// Names a tail length, or `None` if it does not fit the register. + pub const fn new(len: u8) -> Option { + if len > Self::MAX { + return None; + } + Some(Self(len)) + } + + /// The length in bytes. + pub const fn get(self) -> u8 { + self.0 + } +} + +/// `HW_STATUS`, the fixed head the vendor hardware status follows. +#[repr(C, packed)] +#[derive(Debug, Clone, Copy, Default, FromBytes, IntoBytes, Immutable, KnownLayout)] +pub struct HwStatus { + hw_status: u8, + vendor_hw_status: u8, + composite_temp: u8, + vendor_status_len: u8, +} + +impl HwStatus { + /// Encoded size of the head in bytes. A vendor status tail follows. + pub const SIZE: usize = core::mem::size_of::(); + + /// Byte 0 bit 0: the device temperature is critical. + pub const TEMPERATURE_CRITICAL: u8 = 1 << 0; + /// Byte 0 bit 1: a hardware soft error, which a reset may clear. + pub const SOFT_ERROR: u8 = 1 << 1; + /// Byte 0 bit 2: a hardware fatal error. + pub const FATAL_ERROR: u8 = 1 << 2; + + /// Byte 2 value that says the device has no temperature reading, or the + /// reading is older than 5 seconds. + pub const TEMPERATURE_UNAVAILABLE: u8 = 0x80; + + /// The hardware status bit mask. + pub fn status_bits(&self) -> u8 { + self.hw_status + } + + /// Sets the hardware status bit mask. + pub fn set_status_bits(&mut self, bits: u8) { + self.hw_status = bits; + } + + /// The composite temperature byte, in the NVMe-MI encoding. + pub fn composite_temperature(&self) -> u8 { + self.composite_temp + } + + /// Sets the composite temperature byte. + pub fn set_composite_temperature(&mut self, temperature: u8) { + self.composite_temp = temperature; + } + + /// How many bytes of vendor hardware status follow the head. + pub fn vendor_status_len(&self) -> VendorStatusLen { + VendorStatusLen(self.vendor_status_len) + } + + /// Declares how many bytes of vendor hardware status follow the head. + pub fn set_vendor_status_len(&mut self, len: VendorStatusLen) { + self.vendor_status_len = len.get(); + } +} + +/// `INDIRECT_FIFO_CTRL`, which selects the FIFO region and sizes the image. +#[repr(C, packed)] +#[derive(Debug, Clone, Copy, Default, FromBytes, IntoBytes, Immutable, KnownLayout)] +pub struct IndirectFifoCtrl { + cms: u8, + reset: u8, + image_size_dwords: u32, +} + +impl IndirectFifoCtrl { + /// Encoded size in bytes. + pub const SIZE: usize = core::mem::size_of::(); + + /// Checks a write off the wire and hands back the bytes at the width this + /// register takes. + /// + /// This is the one step between the wire and + /// [`IndirectFifoCtrl::apply_agent_write`]: the length is resolved here, and what + /// comes back is the fixed-size array the write takes, so no later step + /// re-checks it. `transport_max` is the largest payload one access of the + /// transport carries. + pub fn from_wire(bytes: &[u8], transport_max: usize) -> Result<&[u8; Self::SIZE], WireError> { + let command = RecoveryCommand::IndirectFifoCtrl; + command.check_write(bytes.len(), transport_max)?; + bytes.try_into().ok().ok_or(WireError::LengthMismatch { + command, + got: bytes.len(), + }) + } + + /// Takes a write from the Recovery Agent. + /// + /// The argument type settles the length, which [`Self::from_wire`] + /// resolves where the bytes arrive off the wire. + /// + /// Byte 1 is the reset the agent asks for and the device clears. Only the + /// agent writes this register: a device that reset the FIFO on its own + /// would race an agent that had already programmed the region and the + /// image size for the next image. + pub fn apply_agent_write(&mut self, bytes: &[u8; Self::SIZE]) -> Result<(), WireError> { + let command = RecoveryCommand::IndirectFifoCtrl; + if bytes[1] != FIFO_RESET && bytes[1] != FIFO_IDLE { + return Err(unsupported(command, 1, bytes[1])); + } + let size = u32::from_le_bytes([bytes[2], bytes[3], bytes[4], bytes[5]]); + self.cms = bytes[0]; + self.reset = bytes[1]; + self.image_size_dwords = size.to_le(); + Ok(()) + } + + /// The component memory space the agent selected. + pub fn cms(&self) -> u8 { + self.cms + } + + /// Whether the agent asked for a reset the device has not performed. + pub fn reset_requested(&self) -> bool { + self.reset == FIFO_RESET + } + + /// Zeroes byte 1 after the device reset the FIFO indices. + pub fn clear_reset(&mut self) { + self.reset = FIFO_IDLE; + } + + /// Size of the image the agent announced, in bytes. + /// + /// The register counts 4-byte units, so the byte count is four times the + /// stored value and cannot overflow a `u64`. + pub fn image_size_bytes(&self) -> u64 { + u64::from(u32::from_le(self.image_size_dwords)) * 4 + } +} + +/// `INDIRECT_FIFO_STATUS`, the FIFO indices and sizes. +/// +/// The indices count 4-byte units. For the write-only code region the agent +/// advances the write index and the device advances the read index. +#[repr(C, packed)] +#[derive(Debug, Clone, Copy, Default, FromBytes, IntoBytes, Immutable, KnownLayout)] +pub struct IndirectFifoStatus { + status: u8, + region_type: u8, + reserved: u16, + write_index: u32, + read_index: u32, + fifo_size_dwords: u32, + max_transfer_dwords: u32, +} + +impl IndirectFifoStatus { + /// Encoded size in bytes. + pub const SIZE: usize = core::mem::size_of::(); + + /// Byte 0 bit 0: the FIFO is empty. + pub const EMPTY: u8 = 1 << 0; + /// Byte 0 bit 1: the FIFO is full. + pub const FULL: u8 = 1 << 1; + + /// Byte 1 value for a code region the agent writes the image into. + pub const REGION_CODE: u8 = 0b000; + /// Byte 1 value for a log region the agent reads. + pub const REGION_LOG: u8 = 0b001; + /// Byte 1 value for a vendor-defined region the agent writes. + pub const REGION_VENDOR_WRITE_ONLY: u8 = 0b100; + /// Byte 1 value for a vendor-defined region the agent reads. + pub const REGION_VENDOR_READ_ONLY: u8 = 0b101; + /// Byte 1 value the device reports for an address space it does not hold. + pub const REGION_UNSUPPORTED: u8 = 0b111; + + /// Describes the code region the agent pushes an image into. + /// + /// Sizes are in bytes and the register stores 4-byte units, so both are + /// refused unless they divide by 4. + pub fn code_region(fifo_size_bytes: u32, max_transfer_bytes: u32) -> Option { + const DWORD: u32 = 4; + if fifo_size_bytes % DWORD != 0 || max_transfer_bytes % DWORD != 0 { + return None; + } + Some(Self { + status: Self::EMPTY, + region_type: Self::REGION_CODE, + reserved: 0, + write_index: 0, + read_index: 0, + fifo_size_dwords: (fifo_size_bytes / DWORD).to_le(), + max_transfer_dwords: (max_transfer_bytes / DWORD).to_le(), + }) + } + + /// The status bit mask. + pub fn status_bits(&self) -> u8 { + self.status + } + + /// How many bytes the agent has written. + pub fn written_bytes(&self) -> u64 { + u64::from(u32::from_le(self.write_index)) * 4 + } + + /// How many bytes the device has consumed. + pub fn read_bytes(&self) -> u64 { + u64::from(u32::from_le(self.read_index)) * 4 + } + + /// Largest payload one `INDIRECT_FIFO_DATA` access may carry, in bytes. + pub fn max_transfer_bytes(&self) -> u64 { + u64::from(u32::from_le(self.max_transfer_dwords)) * 4 + } + + /// Resets both indices and reports the FIFO empty, which is what the + /// device does when the agent asks for a reset in `INDIRECT_FIFO_CTRL`. + pub fn reset_indices(&mut self) { + self.write_index = 0; + self.read_index = 0; + self.status = Self::EMPTY; + } + + /// Records one agent write the device consumed on the spot. + /// + /// The eRoT drains each `INDIRECT_FIFO_DATA` payload into the staging + /// region before answering, so both indices advance together and the FIFO + /// reports empty again. The indices count 4-byte units and the spec rounds + /// a shorter transfer up to the next unit, which covers the last chunk of + /// an image whose size does not divide by 4. + pub fn record_drained_write(&mut self, bytes: usize) { + const DWORD: usize = 4; + let dwords = bytes.div_ceil(DWORD) as u32; + let next = u32::from_le(self.write_index).wrapping_add(dwords); + self.write_index = next.to_le(); + self.read_index = next.to_le(); + self.status = Self::EMPTY; + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::command::Length; + use crate::error::ProtocolError; + use zerocopy::IntoBytes; + + /// The encoded size of every fixed-layout register, against the length + /// the command table states. + #[test] + fn register_sizes_match_the_command_table() { + let fixed = [ + (RecoveryCommand::ProtCap, ProtCap::SIZE), + (RecoveryCommand::DeviceReset, DeviceReset::SIZE), + (RecoveryCommand::RecoveryCtrl, RecoveryCtrl::SIZE), + (RecoveryCommand::RecoveryStatus, RecoveryStatus::SIZE), + (RecoveryCommand::IndirectFifoCtrl, IndirectFifoCtrl::SIZE), + ( + RecoveryCommand::IndirectFifoStatus, + IndirectFifoStatus::SIZE, + ), + ]; + for (command, size) in fixed { + assert_eq!(command.length(), Length::Fixed(size), "{command:?}"); + } + + // The variable-length registers start at the head this crate defines. + assert_eq!( + RecoveryCommand::DeviceStatus.length(), + Length::Range { + min: DeviceStatus::SIZE, + max: 255 + } + ); + assert_eq!( + RecoveryCommand::HwStatus.length(), + Length::Range { + min: HwStatus::SIZE, + max: 255 + } + ); + } + + #[test] + fn from_wire_resolves_the_length_once_for_the_register_that_takes_it() { + let wire = [0u8, ImageSelection::FromMemoryWindow as u8, ACTIVATE_IDLE]; + let sized = RecoveryCtrl::from_wire(&wire, crate::SMBUS_MAX_PAYLOAD).unwrap(); + assert_eq!(sized, &wire); + + let short = [0u8, ImageSelection::FromMemoryWindow as u8]; + let err = RecoveryCtrl::from_wire(&short, crate::SMBUS_MAX_PAYLOAD).unwrap_err(); + assert_eq!( + crate::ProtocolError::from(err), + crate::ProtocolError::LengthWriteError + ); + } + + #[test] + fn writing_one_to_the_activate_field_is_refused_and_changes_nothing() { + let mut ctrl = RecoveryCtrl::default(); + ctrl.apply_agent_write(&[0, ImageSelection::FromMemoryWindow as u8, ACTIVATE_IDLE]) + .unwrap(); + + // A device that cleared byte 2 bitwise would accept 0x1 here and hold + // 0xe afterwards, which the spec does not define for the field. + let err = ctrl + .apply_agent_write(&[0, ImageSelection::FromMemoryWindow as u8, 0x1]) + .unwrap_err(); + assert_eq!( + err, + WireError::UnsupportedParameter { + command: RecoveryCommand::RecoveryCtrl, + offset: 2, + value: 0x1, + } + ); + assert_eq!( + ProtocolError::from(err), + ProtocolError::UnsupportedParameter + ); + assert!(!ctrl.activation_requested()); + assert_eq!(ctrl.as_bytes()[2], ACTIVATE_IDLE); + } + + #[test] + fn the_agent_activates_and_the_device_clears_the_field() { + let mut ctrl = RecoveryCtrl::default(); + ctrl.apply_agent_write(&[ + 2, + ImageSelection::FromMemoryWindow as u8, + ACTIVATE_RECOVERY_IMAGE, + ]) + .unwrap(); + assert!(ctrl.activation_requested()); + assert_eq!(ctrl.cms(), 2); + assert_eq!( + ctrl.image_selection(), + Some(ImageSelection::FromMemoryWindow) + ); + + ctrl.clear_activation(); + assert!(!ctrl.activation_requested()); + assert_eq!(ctrl.as_bytes()[2], ACTIVATE_IDLE); + } + + #[test] + fn a_reserved_image_selection_leaves_the_register_as_it_was() { + let mut ctrl = RecoveryCtrl::default(); + ctrl.apply_agent_write(&[7, ImageSelection::FromDevice as u8, ACTIVATE_IDLE]) + .unwrap(); + + let err = ctrl + .apply_agent_write(&[9, 0x3, ACTIVATE_RECOVERY_IMAGE]) + .unwrap_err(); + assert_eq!( + err, + WireError::UnsupportedParameter { + command: RecoveryCommand::RecoveryCtrl, + offset: 1, + value: 0x3, + } + ); + assert_eq!(ctrl.cms(), 7); + assert_eq!(ctrl.image_selection(), Some(ImageSelection::FromDevice)); + assert!(!ctrl.activation_requested()); + } + + #[test] + fn device_reset_clears_only_the_reset_control_byte() { + let mut reset = DeviceReset::default(); + reset + .apply_agent_write(&[ + ResetControl::ResetManagement as u8, + ForcedRecovery::RecoveryMode as u8, + DeviceReset::INTERFACE_MASTERING_DISABLED, + ]) + .unwrap(); + assert_eq!(reset.reset_control(), Some(ResetControl::ResetManagement)); + assert_eq!(reset.forced_recovery(), Some(ForcedRecovery::RecoveryMode)); + + reset.clear_reset_control(); + assert_eq!(reset.reset_control(), Some(ResetControl::None)); + assert_eq!(reset.forced_recovery(), Some(ForcedRecovery::RecoveryMode)); + assert!(!reset.interface_mastering()); + } + + #[test] + fn a_reserved_forced_recovery_value_is_refused() { + let mut reset = DeviceReset::default(); + let err = reset + .apply_agent_write(&[ + ResetControl::None as u8, + 0x5, + DeviceReset::INTERFACE_MASTERING_DISABLED, + ]) + .unwrap_err(); + assert_eq!( + err, + WireError::UnsupportedParameter { + command: RecoveryCommand::DeviceReset, + offset: 1, + value: 0x5, + } + ); + assert_eq!(reset.forced_recovery(), Some(ForcedRecovery::None)); + } + + #[test] + fn prot_cap_opens_with_the_magic_string_and_the_protocol_version() { + let cap = ProtCap::new( + capability::IDENTIFICATION | capability::PUSH_C_IMAGE | capability::FIFO_CMS, + 1, + 0, + 0, + ); + let bytes = cap.as_bytes(); + assert_eq!(bytes.len(), ProtCap::SIZE); + assert_eq!(&bytes[0..8], &PROT_CAP_MAGIC); + assert_eq!(bytes[8], PROT_CAP_VERSION_MAJOR); + assert_eq!(bytes[9], PROT_CAP_VERSION_MINOR); + assert!(cap.advertises(capability::PUSH_C_IMAGE | capability::FIFO_CMS)); + assert!(!cap.advertises(capability::LOCAL_C_IMAGE)); + } + + #[test] + fn reading_the_protocol_error_clears_it() { + let mut status = DeviceStatus::pending(); + status.set_protocol_error(ProtocolError::LengthWriteError); + assert_eq!( + status.take_protocol_error(), + ProtocolError::LengthWriteError as u8 + ); + assert_eq!(status.take_protocol_error(), ProtocolError::None as u8); + } + + #[test] + fn a_state_that_carries_no_reason_code_reports_zero() { + let mut status = DeviceStatus::pending(); + status.set_state( + DeviceState::BootFailure, + RecoveryReason::MainFirmwareAuthFailure, + ); + assert_eq!(status.state(), Some(DeviceState::BootFailure)); + assert_eq!( + status.reason_code(), + RecoveryReason::MainFirmwareAuthFailure as u16 + ); + + // Healthy carries no reason code, so the stale one must not survive. + status.set_state(DeviceState::Healthy, RecoveryReason::NoFailure); + assert_eq!(status.reason_code(), 0); + } + + #[test] + fn the_heartbeat_wraps_at_the_twelve_bit_limit() { + let mut status = DeviceStatus::pending(); + for _ in 0..4095 { + status.tick_heartbeat(); + } + assert_eq!(status.heartbeat(), 4095); + status.tick_heartbeat(); + assert_eq!(status.heartbeat(), 0); + } + + #[test] + fn recovery_status_packs_the_image_index_above_the_state() { + let mut status = RecoveryStatus::default(); + let image = ImageIndex::new(2).unwrap(); + status.set(RecoveryState::AuthenticationError, image); + assert_eq!(status.state(), Some(RecoveryState::AuthenticationError)); + assert_eq!(status.image(), image); + assert_eq!(status.as_bytes()[0], 0x2d); + } + + #[test] + fn an_image_index_wider_than_the_field_has_no_value() { + assert_eq!(ImageIndex::new(ImageIndex::MAX + 1), None); + assert_eq!( + ImageIndex::new(ImageIndex::MAX).map(ImageIndex::get), + Some(ImageIndex::MAX) + ); + } + + #[test] + fn the_largest_image_index_does_not_reach_the_state_bits() { + let mut status = RecoveryStatus::default(); + let last = ImageIndex::new(ImageIndex::MAX).unwrap(); + status.set(RecoveryState::Failed, last); + assert_eq!(status.state(), Some(RecoveryState::Failed)); + assert_eq!(status.image(), last); + } + + #[test] + fn the_fifo_control_counts_the_image_in_four_byte_units() { + let mut ctrl = IndirectFifoCtrl::default(); + let size_bytes: u32 = 0x4000; + let mut write = [0u8; IndirectFifoCtrl::SIZE]; + write[0] = 0; + write[1] = FIFO_RESET; + write[2..].copy_from_slice(&(size_bytes / 4).to_le_bytes()); + ctrl.apply_agent_write(&write).unwrap(); + + assert!(ctrl.reset_requested()); + assert_eq!(ctrl.image_size_bytes(), u64::from(size_bytes)); + ctrl.clear_reset(); + assert!(!ctrl.reset_requested()); + } + + #[test] + fn a_fifo_region_that_does_not_divide_by_four_is_refused() { + assert!(IndirectFifoStatus::code_region(0x4000, 250).is_none()); + assert!(IndirectFifoStatus::code_region(0x4002, 252).is_none()); + + // The SMBus payload cap divides by 4, so a FIFO sized to it is legal. + let region = + IndirectFifoStatus::code_region(0x4000, crate::SMBUS_MAX_PAYLOAD as u32).unwrap(); + assert_eq!(region.status_bits(), IndirectFifoStatus::EMPTY); + assert_eq!(region.max_transfer_bytes(), crate::SMBUS_MAX_PAYLOAD as u64); + assert_eq!(region.as_bytes().len(), IndirectFifoStatus::SIZE); + } + + #[test] + fn a_vendor_hardware_status_longer_than_the_register_has_no_value() { + let mut hw = HwStatus::default(); + hw.set_status_bits(HwStatus::SOFT_ERROR); + hw.set_composite_temperature(HwStatus::TEMPERATURE_UNAVAILABLE); + let tail = VendorStatusLen::new(8).unwrap(); + hw.set_vendor_status_len(tail); + assert_eq!(hw.vendor_status_len(), tail); + assert_eq!(hw.status_bits(), HwStatus::SOFT_ERROR); + + assert_eq!(VendorStatusLen::new(VendorStatusLen::MAX + 1), None); + } + + #[test] + fn resetting_the_fifo_zeroes_both_indices_and_reports_empty() { + let mut region = IndirectFifoStatus::code_region(0x4000, 248).unwrap(); + region.reset_indices(); + assert_eq!(region.written_bytes(), 0); + assert_eq!(region.read_bytes(), 0); + assert_eq!( + region.status_bits() & IndirectFifoStatus::EMPTY, + IndirectFifoStatus::EMPTY + ); + } +} diff --git a/services/orchestrator/adapters/hal/BUILD.bazel b/services/orchestrator/adapters/hal/BUILD.bazel index 95426a4dd..8fa810ee3 100644 --- a/services/orchestrator/adapters/hal/BUILD.bazel +++ b/services/orchestrator/adapters/hal/BUILD.bazel @@ -7,6 +7,8 @@ rust_library( name = "orchestrator_hal_adapters", srcs = [ "src/gpio_boot_monitor.rs", + "src/gpio_ready_monitor.rs", + "src/gpio_reset_control.rs", "src/hal_boot_control.rs", "src/lib.rs", ], @@ -15,6 +17,7 @@ rust_library( deps = [ "//hal/blocking", "//services/orchestrator/capabilities:orchestrator_capabilities", + "@rust_crates//:embedded-hal", ], ) diff --git a/services/orchestrator/adapters/hal/src/gpio_boot_monitor.rs b/services/orchestrator/adapters/hal/src/gpio_boot_monitor.rs index 3591d2b8d..fa195e0df 100644 --- a/services/orchestrator/adapters/hal/src/gpio_boot_monitor.rs +++ b/services/orchestrator/adapters/hal/src/gpio_boot_monitor.rs @@ -89,7 +89,7 @@ impl From for MonitorError { /// device re-enters reset (typically by wiring the latch's clear to the /// device's reset line) — [`BootStatus`] requires that evidence from a /// previous boot never reads as [`BootStatus::Booted`], and this reader only -/// reads the line, it cannot re-arm it. +/// reads the line, it cannot clear the latch. /// /// [`HalBootControl`]: crate::HalBootControl pub struct GpioBootMonitor<'a, P: GpioPort> { diff --git a/services/orchestrator/adapters/hal/src/gpio_ready_monitor.rs b/services/orchestrator/adapters/hal/src/gpio_ready_monitor.rs new file mode 100644 index 000000000..097ab24ae --- /dev/null +++ b/services/orchestrator/adapters/hal/src/gpio_ready_monitor.rs @@ -0,0 +1,168 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! HAL-backed boot-status reader over a single owned GPIO input line. + +use openprot_hal_blocking::gpio_port::ActivePolarity; +use openprot_hal_blocking::InputPin; +use orchestrator_capabilities::BootStatus; + +/// The ready line could not be read. +/// +/// Carries the pin's own error so the implementation's detail survives; the +/// `Display`/`core::error::Error` machinery is what `EvidenceReader` asks of a +/// reader error and what `InputPin::Error` does not supply. +#[derive(Debug)] +pub struct ReadyLineError(pub E); + +impl core::fmt::Display for ReadyLineError { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "ready line unreadable: {:?}", self.0) + } +} + +impl core::error::Error for ReadyLineError {} + +/// Binds one owned GPIO input line to a managed device's boot-complete signal. +/// +/// The sibling of [`GpioBootMonitor`], differing only in how the line is named: +/// that one borrows a `GpioPort` and selects a line by mask, because an SGPIOM +/// bank packs unrelated lines several devices share. A dedicated ready line on +/// a parallel bank is one pin, so owning it is the exclusivity guarantee — the +/// same reasoning that shapes [`GpioResetControl`] on the output side. +/// +/// A single ready line can only answer "up yet?", so this reader reports the +/// [`BootStatus::Booting`]/[`BootStatus::Booted`] subset. +/// +/// [`GpioBootMonitor`]: crate::GpioBootMonitor +/// [`GpioResetControl`]: crate::GpioResetControl +pub struct GpioReadyMonitor

{ + pin: P, + active: ActivePolarity, +} + +impl GpioReadyMonitor

{ + /// Binds `pin`, asserted per `active`, as a device's boot-complete signal. + pub fn new(pin: P, active: ActivePolarity) -> Self { + Self { pin, active } + } + + /// Returns the current liveness of the device. + /// + /// # Errors + /// + /// Propagates any error returned by the pin's level read. + pub fn boot_status(&mut self) -> Result> { + let high = self.pin.is_high().map_err(ReadyLineError)?; + let booted = match self.active { + ActivePolarity::ActiveHigh => high, + ActivePolarity::ActiveLow => !high, + }; + Ok(if booted { + BootStatus::Booted + } else { + BootStatus::Booting + }) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use embedded_hal::digital; + + #[derive(Debug, PartialEq, Eq)] + struct PinFault; + + impl digital::Error for PinFault { + fn kind(&self) -> digital::ErrorKind { + digital::ErrorKind::Other + } + } + + struct MockPin { + high: bool, + fail: bool, + } + + impl MockPin { + fn at(high: bool) -> Self { + Self { high, fail: false } + } + + fn failing() -> Self { + Self { + high: false, + fail: true, + } + } + } + + impl digital::ErrorType for MockPin { + type Error = PinFault; + } + + impl digital::InputPin for MockPin { + fn is_high(&mut self) -> Result { + if self.fail { + return Err(PinFault); + } + Ok(self.high) + } + + fn is_low(&mut self) -> Result { + Ok(!self.is_high()?) + } + } + + #[test] + fn active_high_reads_a_high_line_as_booted() { + let mut bmc = GpioReadyMonitor::new(MockPin::at(true), ActivePolarity::ActiveHigh); + + assert_eq!(bmc.boot_status().expect("read failed"), BootStatus::Booted); + } + + // The fail-safe direction: a line held low by reset, by an unpowered + // device, or by a disconnected wire reads Booting, so the walk times out + // honestly instead of reporting a device that was never there. + #[test] + fn active_high_reads_a_low_line_as_booting() { + let mut bmc = GpioReadyMonitor::new(MockPin::at(false), ActivePolarity::ActiveHigh); + + assert_eq!(bmc.boot_status().expect("read failed"), BootStatus::Booting); + } + + #[test] + fn active_low_inverts_both_levels() { + let mut low = GpioReadyMonitor::new(MockPin::at(false), ActivePolarity::ActiveLow); + let mut high = GpioReadyMonitor::new(MockPin::at(true), ActivePolarity::ActiveLow); + + assert_eq!(low.boot_status().expect("read failed"), BootStatus::Booted); + assert_eq!( + high.boot_status().expect("read failed"), + BootStatus::Booting + ); + } + + #[test] + fn a_pin_fault_surfaces_as_a_reader_error() { + let mut bmc = GpioReadyMonitor::new(MockPin::failing(), ActivePolarity::ActiveHigh); + + let err = bmc + .boot_status() + .expect_err("expected the pin fault to propagate"); + + // Display comes from the core::error::Error bound EvidenceReader wants, + // not a Debug dump. + assert_eq!(err.to_string(), "ready line unreadable: PinFault"); + } + + /// Compile-time fence: the reader error must satisfy what + /// `EvidenceReader::Error` demands of it. + fn _assert_reader_error() {} + + #[test] + fn the_error_satisfies_the_evidence_reader_bound() { + _assert_reader_error::>(); + } +} diff --git a/services/orchestrator/adapters/hal/src/gpio_reset_control.rs b/services/orchestrator/adapters/hal/src/gpio_reset_control.rs new file mode 100644 index 000000000..29d77707a --- /dev/null +++ b/services/orchestrator/adapters/hal/src/gpio_reset_control.rs @@ -0,0 +1,409 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! HAL-backed [`ResetControl`]: drive one device's reset line off a GPIO output. + +use core::time::Duration; +use openprot_hal_blocking::gpio_port::ActivePolarity; +use openprot_hal_blocking::system_control::{ + Error as HalError, ErrorKind, ErrorType, ResetControl, +}; +use openprot_hal_blocking::{DelayNs, OutputPin}; + +/// Why driving a reset line failed. +/// +/// The HAL `Error`/`kind()` pattern over a GPIO-backed line: the pin's own +/// error is carried verbatim so implementation detail survives, while +/// [`kind`](HalError::kind) gives generic code the category it acts on. +#[derive(Debug)] +pub enum ResetLineError { + /// The reset id named a line this controller does not drive. + UnknownLine, + /// The GPIO line could not be driven. + Pin(E), +} + +impl HalError for ResetLineError { + fn kind(&self) -> ErrorKind { + match self { + Self::UnknownLine => ErrorKind::InvalidResetId, + Self::Pin(_) => ErrorKind::HardwareFailure, + } + } +} + +/// Binds one GPIO output line to one managed device's reset signal. +/// +/// The actuation-side counterpart to [`GpioBootMonitor`]: the `(pin, line, +/// active)` binding is made once, in platform configuration, and the +/// orchestrator only ever names the device. +/// +/// Unlike the monitor, this *owns* its pin rather than borrowing a port. A +/// reset is one dedicated line, so ownership is the exclusivity guarantee — +/// nothing else can drive the device into reset behind the orchestrator's +/// back. The monitor borrows because a bank packs many unrelated ready +/// signals; that does not apply here. +/// +/// `active` is the level that *holds the device in reset*, so an active-low +/// line like `RoT_BMC_RESET_L` is configuration rather than an inverted +/// `set_high` the reader has to decode. +/// +/// [`GpioBootMonitor`]: crate::GpioBootMonitor +pub struct GpioResetControl { + pin: P, + delay: D, + line: I, + active: ActivePolarity, + asserted: bool, +} + +impl GpioResetControl { + /// Binds `pin`, asserted per `active`, as the reset line named `line`, and + /// drives the device into reset. + /// + /// Binding actuates rather than merely recording, because + /// [`reset_is_asserted`](ResetControl::reset_is_asserted) answers from the + /// state this type tracks, and a tracked state inherited from an unknown + /// pin would be a guess. Driving the line once at bind time makes it a + /// fact. Reset is the safe end to start from: the orchestrator's own boot + /// sequence begins by holding a device and then releasing it. + /// + /// # Errors + /// + /// Returns an error if the line cannot be driven. + pub fn new( + pin: P, + delay: D, + line: I, + active: ActivePolarity, + ) -> Result> { + let mut this = Self { + pin, + delay, + line, + active, + asserted: false, + }; + this.drive(true)?; + Ok(this) + } + + /// The bound pin, for platform code that must inspect the line directly. + pub fn pin(&self) -> &P { + &self.pin + } + + fn check(&self, reset_id: &I) -> Result<(), ResetLineError> { + if reset_id == &self.line { + Ok(()) + } else { + Err(ResetLineError::UnknownLine) + } + } + + fn drive(&mut self, asserted: bool) -> Result<(), ResetLineError> { + let high = matches!( + (self.active, asserted), + (ActivePolarity::ActiveHigh, true) | (ActivePolarity::ActiveLow, false) + ); + if high { + self.pin.set_high() + } else { + self.pin.set_low() + } + .map_err(ResetLineError::Pin)?; + self.asserted = asserted; + Ok(()) + } +} + +impl ErrorType for GpioResetControl { + type Error = ResetLineError; +} + +impl ResetControl for GpioResetControl { + type ResetId = I; + + fn reset_assert(&mut self, reset_id: &I) -> Result<(), Self::Error> { + self.check(reset_id)?; + self.drive(true) + } + + fn reset_deassert(&mut self, reset_id: &I) -> Result<(), Self::Error> { + self.check(reset_id)?; + self.drive(false) + } + + fn reset_pulse(&mut self, reset_id: &I, duration: Duration) -> Result<(), Self::Error> { + self.check(reset_id)?; + self.drive(true)?; + // Saturating: a pulse longer than a u32 of microseconds (~71 min) is a + // misconfiguration, and clamping holds reset longer rather than shorter. + self.delay + .delay_us(u32::try_from(duration.as_micros()).unwrap_or(u32::MAX)); + self.drive(false) + } + + fn reset_is_asserted(&self, reset_id: &I) -> Result { + self.check(reset_id)?; + // Sound because the pin is owned: no one else can drive this line, so + // the last level we wrote is still the level on it. + Ok(self.asserted) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + // Everything that is config is normally declared in the board device + // table (`target//devices.rs`). + #[derive(Debug, Clone, PartialEq, Eq)] + enum Line { + Bmc, + Cpld, + } + + #[derive(Debug, PartialEq, Eq, Clone, Copy)] + struct PinFault; + + impl embedded_hal::digital::Error for PinFault { + fn kind(&self) -> embedded_hal::digital::ErrorKind { + embedded_hal::digital::ErrorKind::Other + } + } + + /// Mock output pin: records every level it is driven to. + struct MockPin { + levels: Vec, + high: bool, + fail: bool, + } + + impl MockPin { + fn new() -> Self { + Self { + levels: Vec::new(), + high: false, + fail: false, + } + } + + fn failing() -> Self { + Self { + levels: Vec::new(), + high: false, + fail: true, + } + } + + fn levels(&self) -> &[bool] { + &self.levels + } + } + + impl embedded_hal::digital::ErrorType for MockPin { + type Error = PinFault; + } + + impl embedded_hal::digital::OutputPin for MockPin { + fn set_low(&mut self) -> Result<(), PinFault> { + if self.fail { + return Err(PinFault); + } + self.high = false; + self.levels.push(false); + Ok(()) + } + + fn set_high(&mut self) -> Result<(), PinFault> { + if self.fail { + return Err(PinFault); + } + self.high = true; + self.levels.push(true); + Ok(()) + } + } + + impl embedded_hal::digital::StatefulOutputPin for MockPin { + fn is_set_high(&mut self) -> Result { + if self.fail { + return Err(PinFault); + } + Ok(self.high) + } + + fn is_set_low(&mut self) -> Result { + Ok(!self.is_set_high()?) + } + } + + /// Mock delay: records every wait it is asked for, sleeps for none of them. + struct MockDelay { + waits: Vec, + } + + impl MockDelay { + fn new() -> Self { + Self { waits: Vec::new() } + } + } + + impl DelayNs for MockDelay { + fn delay_ns(&mut self, ns: u32) { + self.waits.push(ns); + } + + fn delay_us(&mut self, us: u32) { + self.waits.push(us); + } + } + + fn active_low() -> GpioResetControl { + GpioResetControl::new( + MockPin::new(), + MockDelay::new(), + Line::Bmc, + ActivePolarity::ActiveLow, + ) + .expect("bind failed") + } + + fn active_high() -> GpioResetControl { + GpioResetControl::new( + MockPin::new(), + MockDelay::new(), + Line::Bmc, + ActivePolarity::ActiveHigh, + ) + .expect("bind failed") + } + + /// Levels driven after binding — `new` asserts reset, so every fixture + /// starts with one recorded level that is not part of what a test exercises. + fn after_bind(control: &GpioResetControl) -> &[bool] { + &control.pin().levels()[1..] + } + + #[test] + fn binding_drives_the_device_into_reset() { + let bmc = active_low(); + + assert_eq!(bmc.pin().levels(), &[false]); + assert!(bmc.reset_is_asserted(&Line::Bmc).expect("query failed")); + } + + // An active-low line like `RoT_BMC_RESET_L` holds the device in reset when + // driven low, and releases it high. + #[test] + fn active_low_asserts_by_driving_the_line_low() { + let mut bmc = active_low(); + + bmc.reset_deassert(&Line::Bmc).expect("deassert failed"); + bmc.reset_assert(&Line::Bmc).expect("assert failed"); + + assert_eq!(after_bind(&bmc), &[true, false]); + } + + #[test] + fn active_low_deasserts_by_driving_the_line_high() { + let mut bmc = active_low(); + + bmc.reset_deassert(&Line::Bmc).expect("deassert failed"); + + assert_eq!(after_bind(&bmc), &[true]); + } + + #[test] + fn active_high_inverts_both_levels() { + let mut bmc = active_high(); + + bmc.reset_deassert(&Line::Bmc).expect("deassert failed"); + bmc.reset_assert(&Line::Bmc).expect("assert failed"); + + assert_eq!(after_bind(&bmc), &[false, true]); + } + + #[test] + fn pulse_asserts_waits_then_deasserts() { + let mut bmc = active_low(); + bmc.reset_deassert(&Line::Bmc).expect("deassert failed"); + + bmc.reset_pulse(&Line::Bmc, Duration::from_millis(10)) + .expect("pulse failed"); + + assert_eq!(after_bind(&bmc), &[true, false, true]); + assert_eq!(bmc.delay.waits, &[10_000]); + } + + // Clamping must hold reset longer, never skip the wait entirely. + #[test] + fn an_absurd_pulse_saturates_instead_of_wrapping() { + let mut bmc = active_low(); + + bmc.reset_pulse(&Line::Bmc, Duration::from_secs(u64::from(u32::MAX))) + .expect("pulse failed"); + + assert_eq!(bmc.delay.waits, &[u32::MAX]); + } + + #[test] + fn asserted_state_tracks_every_transition() { + let mut bmc = active_low(); + + assert!(bmc.reset_is_asserted(&Line::Bmc).expect("query failed")); + bmc.reset_deassert(&Line::Bmc).expect("deassert failed"); + assert!(!bmc.reset_is_asserted(&Line::Bmc).expect("query failed")); + bmc.reset_assert(&Line::Bmc).expect("assert failed"); + assert!(bmc.reset_is_asserted(&Line::Bmc).expect("query failed")); + } + + // A pulse leaves the device running, not held. + #[test] + fn asserted_state_is_clear_after_a_pulse() { + let mut bmc = active_low(); + + bmc.reset_pulse(&Line::Bmc, Duration::from_millis(1)) + .expect("pulse failed"); + + assert!(!bmc.reset_is_asserted(&Line::Bmc).expect("query failed")); + } + + // A controller drives exactly one line; a misbinding in platform config + // must be refused rather than silently resetting the wrong device. + #[test] + fn a_foreign_reset_id_is_refused_without_touching_the_pin() { + let mut bmc = active_low(); + + let err = bmc + .reset_assert(&Line::Cpld) + .expect_err("expected the foreign id to be refused"); + + assert_eq!(err.kind(), ErrorKind::InvalidResetId); + assert!(after_bind(&bmc).is_empty()); + } + + #[test] + fn a_pin_fault_surfaces_as_a_hardware_failure() { + let Err(err) = GpioResetControl::new( + MockPin::failing(), + MockDelay::new(), + Line::Bmc, + ActivePolarity::ActiveLow, + ) else { + panic!("expected the pin fault to propagate"); + }; + + assert_eq!(err.kind(), ErrorKind::HardwareFailure); + } + + /// Compile-time fence: the whole point of this adapter is that it satisfies + /// `HalBootControl`'s bound. Fails to compile if the impl drifts. + fn _assert_drives_boot_control() {} + + #[test] + fn the_controller_satisfies_hal_boot_control() { + _assert_drives_boot_control::>(); + } +} diff --git a/services/orchestrator/adapters/hal/src/lib.rs b/services/orchestrator/adapters/hal/src/lib.rs index 3c9d0c590..5b9a6b78a 100644 --- a/services/orchestrator/adapters/hal/src/lib.rs +++ b/services/orchestrator/adapters/hal/src/lib.rs @@ -5,7 +5,9 @@ //! //! Each type here binds an orchestrator-facing seam to a HAL-blocking trait: //! [`HalBootControl`] drives `BootControl` over a `ResetControl` line, and -//! [`GpioBootMonitor`] reads a `GpioPort` input line into a `BootStatus`. +//! [`GpioBootMonitor`] reads a `GpioPort` input line into a `BootStatus`, +//! [`GpioReadyMonitor`] does the same over one owned input pin, and +//! [`GpioResetControl`] implements `ResetControl` over a GPIO output line. //! Adapters live in this crate — not in the leaf //! `orchestrator-capabilities` — so that depending on a capability contract //! never pulls in the HAL. A transport-backed adapter belongs in its own crate @@ -14,7 +16,11 @@ #![cfg_attr(not(test), no_std)] mod gpio_boot_monitor; +mod gpio_ready_monitor; +mod gpio_reset_control; mod hal_boot_control; pub use gpio_boot_monitor::{GpioBootMonitor, GpioCause, MonitorError}; +pub use gpio_ready_monitor::{GpioReadyMonitor, ReadyLineError}; +pub use gpio_reset_control::{GpioResetControl, ResetLineError}; pub use hal_boot_control::{BootError, HalBootControl}; diff --git a/services/orchestrator/adapters/pldm/src/lib.rs b/services/orchestrator/adapters/pldm/src/lib.rs index 3b8304514..9c6bd89e2 100644 --- a/services/orchestrator/adapters/pldm/src/lib.rs +++ b/services/orchestrator/adapters/pldm/src/lib.rs @@ -16,7 +16,7 @@ #![forbid(unsafe_code)] #![warn(missing_docs)] -use openprot_orchestrator_sm::Event; +use openprot_orchestrator_sm::{ComponentId, Event}; use openprot_pldm_service::firmware_device::{FdEvent, FdEventSink}; /// Latches an accepted PLDM `RequestUpdate` until the orchestrator run loop @@ -29,15 +29,20 @@ use openprot_pldm_service::firmware_device::{FdEvent, FdEventSink}; /// is drained, the two coalesce into one [`Event::UpdateRequest`] — which is /// what the state machine would do anyway (an update already being handled /// defers further requests). -#[derive(Default)] pub struct UpdateRequestLatch { + /// The component this Firmware Device updates. Board wiring: `FdEvent` + /// does not say which component was requested, and this FD serves one. + target: ComponentId, pending: bool, } impl UpdateRequestLatch { - /// A latch with nothing pending. - pub const fn new() -> Self { - Self { pending: false } + /// A latch with nothing pending, for the component this FD updates. + pub const fn new(target: ComponentId) -> Self { + Self { + target, + pending: false, + } } /// Drain the latch: [`Event::UpdateRequest`] if a `RequestUpdate` was @@ -45,7 +50,7 @@ impl UpdateRequestLatch { pub fn take(&mut self) -> Option { self.pending.then(|| { self.pending = false; - Event::UpdateRequest + Event::UpdateRequest(self.target) }) } } @@ -64,25 +69,27 @@ impl FdEventSink for UpdateRequestLatch { mod tests { use super::*; + const C0: ComponentId = ComponentId::new(0); + #[test] fn empty_latch_yields_nothing() { - assert_eq!(UpdateRequestLatch::new().take(), None); + assert_eq!(UpdateRequestLatch::new(C0).take(), None); } #[test] fn accepted_request_yields_one_event() { - let mut latch = UpdateRequestLatch::new(); + let mut latch = UpdateRequestLatch::new(C0); latch.notify(FdEvent::UpdateRequested); - assert_eq!(latch.take(), Some(Event::UpdateRequest)); + assert_eq!(latch.take(), Some(Event::UpdateRequest(C0))); assert_eq!(latch.take(), None, "a drained latch must not re-fire"); } #[test] fn undrained_notifications_coalesce() { - let mut latch = UpdateRequestLatch::new(); + let mut latch = UpdateRequestLatch::new(C0); latch.notify(FdEvent::UpdateRequested); latch.notify(FdEvent::UpdateRequested); - assert_eq!(latch.take(), Some(Event::UpdateRequest)); + assert_eq!(latch.take(), Some(Event::UpdateRequest(C0))); assert_eq!(latch.take(), None); } } diff --git a/services/orchestrator/adapters/walk/BUILD.bazel b/services/orchestrator/adapters/walk/BUILD.bazel new file mode 100644 index 000000000..919bff503 --- /dev/null +++ b/services/orchestrator/adapters/walk/BUILD.bazel @@ -0,0 +1,25 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") + +rust_library( + name = "orchestrator_checkpoint_walk", + srcs = [ + "src/lib.rs", + "src/walk.rs", + ], + edition = "2024", + visibility = ["//visibility:public"], + deps = [ + "//services/orchestrator/capabilities:orchestrator_capabilities", + "//services/orchestrator/config:orchestrator_config", + "//services/orchestrator/sm:orchestrator_sm", + ], +) + +# Host tests: build on the host platform, no kernel/QEMU. +rust_test( + name = "orchestrator_checkpoint_walk_test", + crate = ":orchestrator_checkpoint_walk", +) diff --git a/services/orchestrator/adapters/walk/src/lib.rs b/services/orchestrator/adapters/walk/src/lib.rs new file mode 100644 index 000000000..2eefd3c69 --- /dev/null +++ b/services/orchestrator/adapters/walk/src/lib.rs @@ -0,0 +1,17 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Concrete [`BootWatch`] that walks a device's boot checkpoints in order, +//! polling an [`EvidenceReader`] for each one and judging the per-checkpoint +//! windows against the caller-injected `now_millis`. +//! +//! Generic over the reader (`R`) and probe vocabulary (`P`), so the same +//! walker serves GPIO-backed boards, register-backed SoCs, and test +//! doubles. Board wiring constructs one per component and hands them to +//! the platform driver as `Board::boot_watches`. + +#![cfg_attr(not(test), no_std)] + +mod walk; + +pub use walk::CheckpointWalk; diff --git a/services/orchestrator/adapters/walk/src/walk.rs b/services/orchestrator/adapters/walk/src/walk.rs new file mode 100644 index 000000000..d55a9df8e --- /dev/null +++ b/services/orchestrator/adapters/walk/src/walk.rs @@ -0,0 +1,517 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +use orchestrator_capabilities::{BootStatus, BootWatch, EvidenceReader, FailureCause, WalkVerdict}; +use orchestrator_config::{BootCheckpoint, DeviceConfig}; + +/// Walks a device's [`BootCheckpoint`]s in declaration order, reading +/// evidence from an [`EvidenceReader`] at each poll. The checkpoint list +/// comes from a [`DeviceConfig`], which validates non-empty and unique +/// names at build time; lifetimes match the board config (`&'static`). +/// +/// A read error is treated as silence +/// (`Booting`), so a transient bus glitch does not kill a healthy boot. +/// A lapsed window is a timeout with no final read: a device that has not +/// reported cannot be judged on a race. Each checkpoint's deadline +/// starts from the first poll after the start call, not from the call +/// itself, so time between starting and polling does not count against +/// the window. +/// An unarmed or post-terminal poll +/// returns `Waiting { deadline_millis: u64::MAX }` (no deadline). +pub struct CheckpointWalk { + reader: R, + checkpoints: &'static [BootCheckpoint

], + phase: Phase, +} + +enum Phase { + Idle, + Started, + Walking { cursor: usize, deadline_millis: u64 }, +} + +impl CheckpointWalk { + /// Binds a reader and a device's checkpoints into a walk. The + /// checkpoints were already checked non-empty and uniquely named at + /// build time by `DeviceConfig::new`. + pub fn new(reader: R, device: &'static DeviceConfig) -> Self { + Self { + reader, + checkpoints: device.checkpoints(), + phase: Phase::Idle, + } + } + + /// Mutable access to the reader. + pub fn reader_mut(&mut self) -> &mut R { + &mut self.reader + } +} + +impl, P> BootWatch for CheckpointWalk { + fn start(&mut self) { + self.phase = Phase::Started; + } + + fn poll(&mut self, now_millis: u64) -> WalkVerdict { + if let Phase::Started = self.phase { + let timeout_millis = self.checkpoints[0].timeout().as_millis() as u64; + let deadline = now_millis.saturating_add(timeout_millis); + self.phase = Phase::Walking { + cursor: 0, + deadline_millis: deadline, + }; + } + + let (cursor, deadline) = match self.phase { + Phase::Walking { + cursor, + deadline_millis, + } => (cursor, deadline_millis), + _ => { + return WalkVerdict::Waiting { + deadline_millis: u64::MAX, + } + } + }; + + if now_millis >= deadline { + self.phase = Phase::Idle; + return WalkVerdict::Failed { + checkpoint: self.checkpoints[cursor].name(), + cause: FailureCause::TimedOut, + }; + } + + let status = self + .reader + .read(self.checkpoints[cursor].probe()) + .unwrap_or(BootStatus::Booting); + + match status { + BootStatus::Booting => WalkVerdict::Waiting { + deadline_millis: deadline, + }, + BootStatus::Booted => { + let next = cursor + 1; + if next == self.checkpoints.len() { + self.phase = Phase::Idle; + WalkVerdict::Complete + } else { + let timeout_millis = self.checkpoints[next].timeout().as_millis() as u64; + let new_deadline = now_millis.saturating_add(timeout_millis); + self.phase = Phase::Walking { + cursor: next, + deadline_millis: new_deadline, + }; + WalkVerdict::Waiting { + deadline_millis: new_deadline, + } + } + } + BootStatus::FailedRetriable => { + self.phase = Phase::Idle; + WalkVerdict::Failed { + checkpoint: self.checkpoints[cursor].name(), + cause: FailureCause::DeviceRetriable, + } + } + BootStatus::FailedFatal => { + self.phase = Phase::Idle; + WalkVerdict::Failed { + checkpoint: self.checkpoints[cursor].name(), + cause: FailureCause::DeviceFatal, + } + } + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use core::time::Duration; + use openprot_orchestrator_sm::ComponentAttrs; + use orchestrator_config::DeviceConfig; + + const ATTRS: ComponentAttrs = ComponentAttrs::passive_required(); + + const BL1: BootCheckpoint = BootCheckpoint::new("bl1", 1, Duration::from_millis(100)); + const KERNEL: BootCheckpoint = BootCheckpoint::new("kernel", 2, Duration::from_millis(200)); + const CHECKPOINTS: &[BootCheckpoint] = &[BL1, KERNEL]; + + static DEVICE: DeviceConfig = + DeviceConfig::new("test-dev", 0, CHECKPOINTS, None, ATTRS); + static ONE_CP_DEVICE: DeviceConfig = + DeviceConfig::new("one-cp-dev", 0, &[BL1], None, ATTRS); + + // A progress-register reader: probe N is Booted once progress >= N. + // Mirrors the SocReader archetype in the evidence tests. + struct ProgressReader { + level: u8, + fault: Option, + fail_read: bool, + } + + impl ProgressReader { + fn new() -> Self { + Self { + level: 0, + fault: None, + fail_read: false, + } + } + } + + #[derive(Debug)] + struct ReadFault; + + impl core::fmt::Display for ReadFault { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.write_str("read fault") + } + } + + impl core::error::Error for ReadFault {} + + impl EvidenceReader for ProgressReader { + type Error = ReadFault; + + fn read(&mut self, probe: &u8) -> Result { + if self.fail_read { + return Err(ReadFault); + } + if let Some(fault) = self.fault { + return Ok(fault); + } + Ok(if self.level >= *probe { + BootStatus::Booted + } else { + BootStatus::Booting + }) + } + } + + fn walk() -> CheckpointWalk { + CheckpointWalk::new(ProgressReader::new(), &DEVICE) + } + + // ── Happy path ────────────────────────────────────────────────────── + + #[test] + fn two_checkpoint_walk_completes_when_both_pass() { + let mut w = walk(); + w.reader_mut().level = 2; + w.start(); + + let v = w.poll(0); + assert_eq!( + v, + WalkVerdict::Waiting { + deadline_millis: 200 + }, + "bl1 passed, now waiting on kernel" + ); + + let v = w.poll(0); + assert_eq!(v, WalkVerdict::Complete); + } + + #[test] + fn single_checkpoint_walk_completes_in_one_poll() { + let mut w = CheckpointWalk::new(ProgressReader::new(), &ONE_CP_DEVICE); + w.reader_mut().level = 1; + w.start(); + + assert_eq!(w.poll(0), WalkVerdict::Complete); + } + + #[test] + fn progress_between_polls_advances_the_walk() { + let mut w = walk(); + w.start(); + + let v = w.poll(0); + assert_eq!( + v, + WalkVerdict::Waiting { + deadline_millis: 100 + } + ); + + w.reader_mut().level = 1; + let v = w.poll(50); + assert_eq!( + v, + WalkVerdict::Waiting { + deadline_millis: 250 + }, + "bl1 passed at t=50, kernel deadline = 50 + 200" + ); + + w.reader_mut().level = 2; + let v = w.poll(100); + assert_eq!(v, WalkVerdict::Complete); + } + + // ── Timeout ───────────────────────────────────────────────────────── + + #[test] + fn first_checkpoint_times_out_when_device_is_silent() { + let mut w = walk(); + w.start(); + + let v = w.poll(0); + assert_eq!( + v, + WalkVerdict::Waiting { + deadline_millis: 100 + } + ); + + let v = w.poll(100); + assert_eq!( + v, + WalkVerdict::Failed { + checkpoint: "bl1", + cause: FailureCause::TimedOut, + } + ); + } + + #[test] + fn second_checkpoint_times_out_after_first_passes() { + let mut w = walk(); + w.start(); + + w.reader_mut().level = 1; + let v = w.poll(0); + assert_eq!( + v, + WalkVerdict::Waiting { + deadline_millis: 200 + } + ); + + let v = w.poll(200); + assert_eq!( + v, + WalkVerdict::Failed { + checkpoint: "kernel", + cause: FailureCause::TimedOut, + } + ); + } + + // ── Device-reported failures ──────────────────────────────────────── + + #[test] + fn retriable_failure_ends_the_walk_early() { + let mut w = walk(); + w.start(); + w.reader_mut().fault = Some(BootStatus::FailedRetriable); + + let v = w.poll(0); + assert_eq!( + v, + WalkVerdict::Failed { + checkpoint: "bl1", + cause: FailureCause::DeviceRetriable, + } + ); + } + + #[test] + fn fatal_failure_ends_the_walk_early() { + let mut w = walk(); + w.start(); + w.reader_mut().fault = Some(BootStatus::FailedFatal); + + let v = w.poll(0); + assert_eq!( + v, + WalkVerdict::Failed { + checkpoint: "bl1", + cause: FailureCause::DeviceFatal, + } + ); + } + + // ── Read errors ───────────────────────────────────────────────────── + + #[test] + fn read_error_treated_as_silence() { + let mut w = walk(); + w.start(); + w.reader_mut().fail_read = true; + + let v = w.poll(0); + assert_eq!( + v, + WalkVerdict::Waiting { + deadline_millis: 100 + }, + "bus glitch does not kill a healthy boot" + ); + + // Clear the fault and advance: the walk continues. + w.reader_mut().fail_read = false; + w.reader_mut().level = 2; + let v = w.poll(10); + assert_eq!( + v, + WalkVerdict::Waiting { + deadline_millis: 210 + } + ); + assert_eq!(w.poll(10), WalkVerdict::Complete); + } + + // ── start() rewinds ───────────────────────────────────────────────── + + #[test] + fn arm_rewinds_to_the_first_checkpoint() { + let mut w = walk(); + w.reader_mut().level = 2; + w.start(); + assert_eq!( + w.poll(0), + WalkVerdict::Waiting { + deadline_millis: 200 + } + ); + assert_eq!(w.poll(0), WalkVerdict::Complete); + + // Started again: back to checkpoint 0. + w.reader_mut().level = 0; + w.start(); + let v = w.poll(1000); + assert_eq!( + v, + WalkVerdict::Waiting { + deadline_millis: 1100 + }, + "fresh deadline from the restart" + ); + } + + #[test] + fn arm_mid_walk_restarts_from_the_beginning() { + let mut w = walk(); + w.reader_mut().level = 1; + w.start(); + w.poll(0); // passes bl1, now at kernel + + w.start(); // from the top + w.reader_mut().level = 0; + let v = w.poll(500); + assert_eq!( + v, + WalkVerdict::Waiting { + deadline_millis: 600 + }, + "restarted at bl1 with a fresh deadline" + ); + } + + // ── Unarmed / idle ───────────────────────────────────────────────── + + #[test] + fn unarmed_walk_waits_indefinitely() { + let mut w = walk(); + assert_eq!( + w.poll(0), + WalkVerdict::Waiting { + deadline_millis: u64::MAX + } + ); + } + + #[test] + fn idle_after_terminal_waits_indefinitely() { + let mut w = walk(); + w.start(); + w.poll(0); // Started -> Walking, deadline = 100 + let v = w.poll(100); // now >= deadline -> TimedOut + assert!(matches!(v, WalkVerdict::Failed { .. })); + + assert_eq!( + w.poll(200), + WalkVerdict::Waiting { + deadline_millis: u64::MAX + } + ); + } + + // ── Deadline arithmetic ───────────────────────────────────────────── + + #[test] + fn deadline_is_relative_to_first_poll_not_arm() { + let mut w = walk(); + w.start(); + // First poll at t=1000: deadline should be 1000 + 100, not 0 + 100. + let v = w.poll(1000); + assert_eq!( + v, + WalkVerdict::Waiting { + deadline_millis: 1100 + } + ); + } + + #[test] + fn next_checkpoint_deadline_is_relative_to_the_passing_poll() { + let mut w = walk(); + w.reader_mut().level = 1; + w.start(); + + // bl1 passes at t=50, kernel deadline = 50 + 200. + let v = w.poll(50); + assert_eq!( + v, + WalkVerdict::Waiting { + deadline_millis: 250 + } + ); + } + + // ── Lapsed window = timeout, no last-chance read ──────────────────── + + #[test] + fn booted_at_expiry_is_still_timeout() { + let mut w = walk(); + w.start(); + w.poll(0); // Started -> Walking, deadline = 100 + + w.reader_mut().level = 1; + let v = w.poll(100); // device ready, but window already lapsed + assert_eq!( + v, + WalkVerdict::Failed { + checkpoint: "bl1", + cause: FailureCause::TimedOut, + }, + "timeout checked before reading: a lapsed window is final" + ); + } + + // ── Fault at a later checkpoint names it correctly ──────────────── + + #[test] + fn device_fault_at_second_checkpoint_names_it() { + let mut w = walk(); + w.reader_mut().level = 1; + w.start(); + w.poll(0); // bl1 passes, now at kernel + + w.reader_mut().fault = Some(BootStatus::FailedFatal); + let v = w.poll(10); + assert_eq!( + v, + WalkVerdict::Failed { + checkpoint: "kernel", + cause: FailureCause::DeviceFatal, + } + ); + } +} diff --git a/services/orchestrator/capabilities/BUILD.bazel b/services/orchestrator/capabilities/BUILD.bazel index 29f69d1f0..791a81ef4 100644 --- a/services/orchestrator/capabilities/BUILD.bazel +++ b/services/orchestrator/capabilities/BUILD.bazel @@ -6,16 +6,25 @@ load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") rust_library( name = "orchestrator_capabilities", srcs = [ + "src/authenticated_image.rs", "src/boot_control.rs", "src/boot_watch.rs", + "src/device_trial_boot.rs", "src/evidence.rs", + "src/incremental_verifier.rs", "src/lib.rs", "src/lockdown_latch.rs", + "src/measurer.rs", + "src/progress.rs", + "src/recovery.rs", + "src/self_reset.rs", + "src/self_update.rs", "src/svn_floor.rs", "src/updatable.rs", ], edition = "2024", visibility = ["//visibility:public"], + deps = ["//util/io"], ) # Host tests: build on the host platform, no kernel/QEMU. diff --git a/services/orchestrator/capabilities/src/authenticated_image.rs b/services/orchestrator/capabilities/src/authenticated_image.rs new file mode 100644 index 000000000..2b652c6ef --- /dev/null +++ b/services/orchestrator/capabilities/src/authenticated_image.rs @@ -0,0 +1,47 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! What an authenticating pass learned about the image it checked. + +use crate::{Measurement, Svn}; + +/// What a verifier read out of an image it authenticated, apart from the +/// pass or fail itself. +/// +/// One type for both passes. The boot walk checks an image at rest in one +/// call and the update path checks a candidate in bounded steps, but what +/// either learns about the image is the same, and two spellings of it in +/// two crates would drift. +/// +/// `Copy` and lifetime-free, like every capability vocabulary type. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct AuthenticatedImage { + /// The image's manifest SVN, or `None` from a verifier that + /// authenticates without reading a manifest. + /// + /// The authenticated pass is the only reading of the manifest a + /// caller may act on, so an implementor that reads one reports it + /// here and the caller never goes back to the image. The alternative + /// is `None` rather than a stand-in value, because the anti-rollback + /// commit takes this number and a stand-in would move the floor to + /// something no signature check covered. + /// + /// `None` is an ordinary answer, not a fault: DSP0267's component + /// comparison stamp is optional and a plain signed image has no + /// manifest at all. A commit behind one holds the floor where it is + /// and reports that, rather than failing. + /// + /// `None` and `Some(Svn(0))` are different answers. `None` means the + /// verifier read no manifest, so there is no version to speak of. + /// `Some(Svn(0))` is a version it read, including the zero DSP0267 + /// uses for an unused comparison stamp, and the commit takes it; the + /// floor is monotonic, so advancing to zero is a no-op. An + /// implementor that would rather a zero stamp held the floor than + /// committed it reports `None` for that image. + pub svn: Option, + /// SHA-256 digest of the image, or `None` when no hash engine is + /// wired up. Optional because measuring is a separate capability a + /// board may not have, while an SVN comes from the manifest the + /// check already read. + pub measurement: Option, +} diff --git a/services/orchestrator/capabilities/src/boot_watch.rs b/services/orchestrator/capabilities/src/boot_watch.rs index 66c703c91..9e86933b3 100644 --- a/services/orchestrator/capabilities/src/boot_watch.rs +++ b/services/orchestrator/capabilities/src/boot_watch.rs @@ -17,7 +17,7 @@ pub trait BootWatch { /// every reset release, retries included. Takes no timestamp — reset /// actuation has no clock; the attempt starts at the next /// [`poll`](BootWatch::poll)'s `now_millis`. - fn arm(&mut self); + fn start(&mut self); /// Judges the walk at `now_millis` (monotonic). Never sleeps — time is /// injected, so every decision is host-testable. @@ -93,7 +93,7 @@ mod tests { } impl BootWatch for ScriptedWalk { - fn arm(&mut self) { + fn start(&mut self) { self.next = 0; } diff --git a/services/orchestrator/capabilities/src/device_trial_boot.rs b/services/orchestrator/capabilities/src/device_trial_boot.rs new file mode 100644 index 000000000..046d710fe --- /dev/null +++ b/services/orchestrator/capabilities/src/device_trial_boot.rs @@ -0,0 +1,397 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The [`DeviceTrialBoot`] commit capability contract. +//! +//! This is the gate for the downstream devices, the ones the eRoT watches +//! from outside. [`BootWatch`] checks a device's checkpoints and answers with +//! a [`WalkVerdict`], read through an [`EvidenceReader`] over the board's +//! ready lines. `Complete` means confirm, `Failed` means revert, whether the +//! device reported the failure or a checkpoint's window ran out with no +//! report at all. The eRoT stays alive across the whole flow, so nothing has +//! to persist beyond the device's own slot metadata: an orchestrator that +//! rebooted mid-update re-walks the chain from the start. +//! +//! The eRoT's own image is the same gate under a different lifetime, and it +//! is [`SelfUpdate`] instead. There the judging outlives the judge: the eRoT +//! resets into the candidate, so the verdict is reached by a later boot that +//! has to read what the previous one left behind. That needs durable state +//! this trait deliberately does not carry, and the verdict is the +//! orchestrator's own supervised boot coming up, not a call from the image +//! that set the trial pending. +//! +//! A board that wants one gate for both can implement this trait over its +//! [`SelfUpdate`] session; nothing here forbids it. What does not work is one +//! trait for both via a supertrait bound: `confirm` with no trial open +//! succeeds here and is an error on a session, and `is_pending` cannot say +//! "confirmed, but the anti-rollback floor has not moved yet". +//! +//! [`BootWatch`]: crate::BootWatch +//! [`WalkVerdict`]: crate::WalkVerdict +//! [`EvidenceReader`]: crate::EvidenceReader +//! [`SelfUpdate`]: crate::SelfUpdate + +/// Commit capability: confirm or revert an image that was activated but not +/// committed, once its boot has been judged. +/// +/// Activating an update picks the staged image as the next thing to boot and +/// stops there, whether the eRoT does that itself through +/// [`Updatable::activate`](crate::Updatable::activate) or a PLDM firmware +/// device does it for the eRoT. This trait is the other half: keep that image +/// if its boot was good, or throw it away. +/// +/// Implemented for the downstream devices whose slot choice the eRoT drives, +/// behind interposed flash or over PLDM. A device that commits on its own, +/// a PLDM Firmware Device picking its own slot, has no +/// `DeviceTrialBoot` on the eRoT side, the same split as +/// [`SvnFloor`](crate::SvnFloor). The eRoT's own +/// image has [`SelfUpdate`](crate::SelfUpdate), which holds the same gate +/// plus the state a verdict reached after a reset needs. +/// +/// The boards in this tree bind `()` here, apart from the `full_update` +/// integration scenario, whose record counts confirm and revert calls. +/// They leave each device its own slot metadata, which the driver binds as +/// `SvnFloorBinding::SelfManaged`. +/// The architecture expects devices whose slots the eRoT does hold: the +/// eRoT is meant to poll the integrity of firmware in the non-volatile +/// memory of a managed device, across active and inactive slots alike, and +/// can only do so for slots it reaches. +/// +/// `confirm` and `revert` take no arguments. A device has at most one trial +/// open at a time, the one the last activation set pending, so there is nothing to +/// name. Which slot is which stays behind the seam, as it does in +/// `Updatable`. +/// +/// The record counts for the next boot only, but the trial +/// outlives it. An image that hangs, or an eRoT that loses power during the +/// trial, boots the confirmed slot again without anyone calling anything. +/// What makes that happen (a boot-select register the boot ROM clears, or +/// something like it) is the implementation's business. The record stays +/// [`is_pending`](Self::is_pending) until `confirm` or `revert`, so an +/// orchestrator that rebooted in the middle of an update finds the trial +/// again instead of losing it. +/// +/// Once `confirm` returns `Ok`, the image stays confirmed across a power +/// loss. A call cut short by power loss never returns, so the next boot still +/// finds the trial open and the caller confirms again. A half-written record +/// must never leave the device booting an image nobody confirmed. +/// +/// Both calls are safe to repeat: with no trial open they succeed and do +/// nothing. A caller that needs to tell a repeat from a trial that was never +/// there checks `is_pending` first, the same shape as +/// [`SvnFloor::advance`](crate::SvnFloor::advance). Neither call boots +/// anything; they only move slot metadata. Restarting the device is +/// [`BootControl`](crate::BootControl). +/// +/// `is_pending` is a yes or no. It does not say whether the pending image has +/// booted, and this trait cannot tell a `confirm` that came after a watched +/// boot from one that did not. Nothing needs that difference: a half-done +/// update is rerun from the start, not picked up where it left off. +/// Confirming only what was actually watched is up to the caller, the same +/// way [`BootControl`](crate::BootControl)'s caller keeps a device in reset +/// until it has been checked. Which slot the running image booted from is not +/// visible here. +pub trait DeviceTrialBoot { + /// The error type this device's trial record reports. + /// + /// Bounded by [`core::error::Error`] so the caller gets `Display` and a + /// `source()` cause chain, not just a `Debug` dump. Which errors exist is + /// up to the implementation. + type Error: core::error::Error; + + /// Whether an activated image is still waiting for its verdict. + /// + /// Answered from stored state, because an orchestrator that rebooted + /// mid-update has no memory of a device's open trial. + fn is_pending(&self) -> Result; + + /// Keeps the activated image as the confirmed one and closes the trial. + /// + /// Only moves slot metadata. Raising the anti-rollback floor is + /// [`SvnFloor::advance`](crate::SvnFloor::advance) and happens later, so + /// [`revert`](Self::revert) always has an image it can go back to. + fn confirm(&mut self) -> Result<(), Self::Error>; + + /// Closes the trial without keeping the image; the confirmed slot stays + /// as it was. + /// + /// Also clears the pending marker: once `revert` returns, the next + /// boot runs the confirmed slot, whether or not the test image ever + /// booted. An orchestrator that drops an activation before resetting + /// the device relies on the marker being clear. + fn revert(&mut self) -> Result<(), Self::Error>; +} + +/// The device tracks its own slots, so confirm and revert write nothing. +/// +/// The usual case when a downstream device keeps its own slot metadata. +/// When the eRoT keeps the slots of a device, wiring `()` loses the +/// update: confirm +/// moves no slot metadata, so the device boots the old image at the next +/// reset. +impl DeviceTrialBoot for () { + type Error = core::convert::Infallible; + + fn is_pending(&self) -> Result { + Ok(false) + } + + fn confirm(&mut self) -> Result<(), Self::Error> { + Ok(()) + } + + fn revert(&mut self) -> Result<(), Self::Error> { + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[derive(Debug, PartialEq, Eq)] + struct MockFault; + + impl core::fmt::Display for MockFault { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.write_str("mock trial record fault") + } + } + + impl core::error::Error for MockFault {} + + /// The verdict the caller reached for the boot it judged. + #[derive(Copy, Clone)] + enum Verdict { + Healthy, + Bad, + } + + /// The one flow both implementations go through: apply the verdict to + /// whatever the last activation set pending, then check the record came out + /// clear. A record left open means a later boot finds a trial nobody + /// owns. Generic over `DeviceTrialBoot`, so every device runs the same code + /// whether the orchestrator held the instance all along or built it + /// afresh. + fn apply_verdict(trial: &mut T, verdict: Verdict) -> Result<(), T::Error> { + match verdict { + Verdict::Healthy => trial.confirm()?, + Verdict::Bad => trial.revert()?, + } + assert!( + !trial.is_pending()?, + "confirm or revert must close the trial" + ); + Ok(()) + } + + /// A slot-selection record that counts for the next boot only, + /// the way a device's eRoT-held store behaves. + struct SlotRecord { + confirmed_slot: u8, + trial_slot: Option, + next_boot_armed: bool, + } + + impl SlotRecord { + fn new(confirmed_slot: u8) -> Self { + Self { + confirmed_slot, + trial_slot: None, + next_boot_armed: false, + } + } + + /// What `Updatable::activate` maps onto for this device. + fn activate(&mut self, slot: u8) { + self.trial_slot = Some(slot); + self.next_boot_armed = true; + } + + /// Boots the device and returns the slot it ran: the trial slot if + /// the next boot is still pending, the confirmed slot otherwise. + fn boot(&mut self) -> u8 { + match self.trial_slot { + Some(slot) if self.next_boot_armed => { + self.next_boot_armed = false; + slot + } + _ => self.confirmed_slot, + } + } + } + + /// One `DeviceTrialBoot` over a record the caller owns. The two cases + /// differ only in how long the instance lives: the orchestrator holds it + /// for the + /// whole flow and judges the boot over the device's boot-complete line, + /// or, having rebooted mid-update, builds a fresh one over the record the + /// device kept. + /// + /// Tied to no HAL: the contract has to work from any stack (mock, IPC + /// proxy, simulator), and a HAL-bound `Error` type would stop this + /// compiling. + struct TrialRecord<'a> { + record: &'a mut SlotRecord, + fail: bool, + } + + impl<'a> From<&'a mut SlotRecord> for TrialRecord<'a> { + fn from(record: &'a mut SlotRecord) -> Self { + Self { + record, + fail: false, + } + } + } + + impl<'a> TrialRecord<'a> { + /// Every call fails, for the error test. Not a second `From`, since + /// only one conversion from `&mut SlotRecord` can exist. + fn faulty(record: &'a mut SlotRecord) -> Self { + Self { record, fail: true } + } + } + + impl DeviceTrialBoot for TrialRecord<'_> { + type Error = MockFault; + + fn is_pending(&self) -> Result { + if self.fail { + return Err(MockFault); + } + Ok(self.record.trial_slot.is_some()) + } + + fn confirm(&mut self) -> Result<(), MockFault> { + if self.fail { + return Err(MockFault); + } + if let Some(slot) = self.record.trial_slot.take() { + self.record.confirmed_slot = slot; + } + Ok(()) + } + + fn revert(&mut self) -> Result<(), MockFault> { + if self.fail { + return Err(MockFault); + } + self.record.trial_slot = None; + Ok(()) + } + } + + #[test] + fn a_healthy_trial_becomes_the_confirmed_slot_of_a_passive_device() { + let mut record = SlotRecord::new(0); + let mut device = TrialRecord::from(&mut record); + device.record.activate(1); + + assert_eq!(device.record.boot(), 1, "the trial slot runs first"); + apply_verdict(&mut device, Verdict::Healthy).unwrap(); + assert_eq!(device.record.boot(), 1, "and stays the default"); + } + + #[test] + fn a_device_trial_nobody_confirms_falls_back_but_stays_open() { + let mut record = SlotRecord::new(0); + let mut device = TrialRecord::from(&mut record); + device.record.activate(1); + + assert_eq!(device.record.boot(), 1); + assert_eq!( + device.record.boot(), + 0, + "the record is one-shot: no confirm, no second trial boot" + ); + assert_eq!( + device.is_pending(), + Ok(true), + "the record outlives the fallback, so a rebooted caller finds it" + ); + apply_verdict(&mut device, Verdict::Bad).unwrap(); + assert_eq!(device.record.boot(), 0); + } + + #[test] + fn a_caller_that_lost_its_instance_confirms_from_stored_state() { + let mut record = SlotRecord::new(0); + record.activate(1); + + // The boot the record triggered. The pending image is now running, + // and the orchestrator that set it has since restarted. + assert_eq!(record.boot(), 1); + + let mut trial = TrialRecord::from(&mut record); + assert_eq!( + trial.is_pending(), + Ok(true), + "the fresh instance learns of the trial from stored state alone" + ); + apply_verdict(&mut trial, Verdict::Healthy).unwrap(); + + assert_eq!(record.confirmed_slot, 1); + assert_eq!(record.boot(), 1); + } + + #[test] + fn a_trial_that_never_confirms_falls_back_on_the_next_reset() { + let mut record = SlotRecord::new(0); + record.activate(1); + + assert_eq!(record.boot(), 1, "the trial image runs and hangs"); + assert_eq!( + record.boot(), + 0, + "the next reset runs the confirmed image, with no call from us" + ); + + let mut trial = TrialRecord::from(&mut record); + assert_eq!(trial.is_pending(), Ok(true)); + apply_verdict(&mut trial, Verdict::Bad).unwrap(); + } + + #[test] + fn revert_before_the_trial_boots_clears_the_pending_marker() { + let mut record = SlotRecord::new(0); + let mut device = TrialRecord::from(&mut record); + device.record.activate(1); + + // No boot yet: the orchestrator dropped the activation instead of + // resetting the device. + device.revert().unwrap(); + + assert_eq!( + device.record.boot(), + 0, + "revert clears the marker, so the dropped image never gets a boot" + ); + } + + #[test] + fn a_replayed_resolution_is_a_noop() { + let mut record = SlotRecord::new(0); + record.activate(1); + record.boot(); + + let mut trial = TrialRecord::from(&mut record); + apply_verdict(&mut trial, Verdict::Healthy).unwrap(); + apply_verdict(&mut trial, Verdict::Healthy).expect("confirm with nothing pending succeeds"); + apply_verdict(&mut trial, Verdict::Bad).expect("and so does revert"); + + assert_eq!( + record.confirmed_slot, 1, + "neither replay moved the slot back" + ); + } + + #[test] + fn errors_surface_through_the_generic_seam() { + let mut record = SlotRecord::new(0); + let mut device = TrialRecord::faulty(&mut record); + + assert_eq!(apply_verdict(&mut device, Verdict::Healthy), Err(MockFault)); + assert_eq!(apply_verdict(&mut device, Verdict::Bad), Err(MockFault)); + } +} diff --git a/services/orchestrator/capabilities/src/evidence.rs b/services/orchestrator/capabilities/src/evidence.rs index be3e85e0a..52c120ce4 100644 --- a/services/orchestrator/capabilities/src/evidence.rs +++ b/services/orchestrator/capabilities/src/evidence.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 //! Evidence reading: the boot-liveness vocabulary and the reader that -//! resolves a board-defined signal id to it. +//! resolves a board-defined probe to it. /// Liveness of a managed device's boot: Boot Confirmation only — whether /// the device came up, never what booted (that is attestation). @@ -30,63 +30,62 @@ pub enum BootStatus { FailedFatal, } -/// Reads a device's boot evidence, one signal at a time. +/// Reads a device's boot evidence, one probe at a time. /// -/// Implemented by board wiring — typically once per managed device, so -/// each device's boot walk borrows only its own reader. `G` is the -/// board's signal vocabulary; an exhaustive `match` on it keeps dispatch -/// direct and makes a forgotten signal a compile error, not a runtime +/// Implemented by board wiring, typically once per managed device, so +/// each device's boot walk borrows only its own reader. `P` is the +/// board's probe vocabulary; an exhaustive `match` on it keeps dispatch +/// direct and makes a forgotten probe a compile error, not a runtime /// hole. /// -/// The status must describe the **current** boot cycle — see +/// The status must describe the *current* boot cycle, see /// [`BootStatus`] for the latching contract (evidence is cleared by the /// reset path, never by the reader). /// /// # Wiring a concrete reader /// /// Concrete readers (e.g. `GpioBootMonitor` in `orchestrator-hal-adapters`) -/// stay signal-agnostic — an adapter crate cannot know a board's `G`. +/// stay probe-agnostic, an adapter crate cannot know a board's `P`. /// The board impl owns the match; the hardware binding is made once, at -/// construction, and the signal id just proves the right reader was -/// wired: +/// construction, and the probe just proves the right reader was wired: /// /// ```ignore -/// /// bmc wiring: one ready line behind the board's signal vocabulary. -/// struct BmcReader<'a, P: GpioPort> { +/// /// bmc wiring: one ready line behind the board's probe vocabulary. +/// struct BmcReader<'a, Port: GpioPort> { /// // (port, pin, polarity) bound at bring-up from the table's Gpio(12). -/// ready: GpioBootMonitor<'a, P>, +/// ready: GpioBootMonitor<'a, Port>, /// } /// -/// impl EvidenceReader for BmcReader<'_, P> +/// impl EvidenceReader for BmcReader<'_, Port> /// where -/// P::Error: 'static, +/// Port::Error: 'static, /// { -/// type Error = MonitorError; +/// type Error = MonitorError; /// -/// fn read(&mut self, signal: &MockSignal) -> Result { -/// match signal { -/// MockSignal::Gpio(_) => self.ready.boot_status(), +/// fn read(&mut self, probe: &MockProbe) -> Result { +/// match probe { +/// MockProbe::Gpio(_) => self.ready.boot_status(), /// other => unreachable!("bmc reader wired to {other:?}"), /// } /// } /// } /// ``` -pub trait EvidenceReader { +pub trait EvidenceReader

{ /// The error type reported by this reader. /// /// Requires [`core::error::Error`] (in `core` since Rust 1.81) so the /// orchestrator gets `Display` and a `source()` cause chain, not just - /// a `Debug` dump. Error categories stay implementation-defined — + /// a `Debug` dump. Error categories stay implementation-defined, /// this crate names no error vocabulary of its own. type Error: core::error::Error; - /// Returns the current liveness evidence for `signal`. + /// Returns the current liveness evidence for `probe`. /// /// # Errors /// - /// Returns an error if the evidence channel behind `signal` cannot be + /// Returns an error if the evidence channel behind `probe` cannot be /// read. - fn read(&mut self, signal: &G) -> Result; + fn read(&mut self, probe: &P) -> Result; } #[cfg(test)] @@ -99,9 +98,6 @@ mod tests { // board is expected to use); fault codes in the same register carry // the device's own judgment, fatal or retriable, for every signal. - const POISON: u8 = 0xFF; - const TRANSIENT: u8 = 0xEE; - #[derive(Debug, Clone, Copy, PartialEq, Eq)] enum TestSignal { /// Booted once the progress register reaches this level @@ -109,8 +105,9 @@ mod tests { Progress(u8), } - struct SocReader { + struct ProgressReader { level: u8, + fault: Option, fail: bool, } @@ -125,19 +122,21 @@ mod tests { impl core::error::Error for RegFault {} - impl EvidenceReader for SocReader { + impl EvidenceReader for ProgressReader { type Error = RegFault; - fn read(&mut self, signal: &TestSignal) -> Result { + fn read(&mut self, probe: &TestSignal) -> Result { if self.fail { return Err(RegFault); } - let TestSignal::Progress(threshold) = *signal; - Ok(match self.level { - POISON => BootStatus::FailedFatal, - TRANSIENT => BootStatus::FailedRetriable, - l if l >= threshold => BootStatus::Booted, - _ => BootStatus::Booting, + if let Some(fault) = self.fault { + return Ok(fault); + } + let TestSignal::Progress(threshold) = *probe; + Ok(if self.level >= threshold { + BootStatus::Booted + } else { + BootStatus::Booting }) } } @@ -147,12 +146,14 @@ mod tests { // late ones. #[test] fn one_reader_serves_a_staged_boot() { - let mut soc = SocReader { + let mut reader = ProgressReader { level: 2, + fault: None, fail: false, }; let mut read = |threshold| { - soc.read(&TestSignal::Progress(threshold)) + reader + .read(&TestSignal::Progress(threshold)) .expect("read failed") }; @@ -167,14 +168,16 @@ mod tests { // retriability judgment. #[test] fn a_poisoned_register_fails_every_signal_fatally() { - let mut soc = SocReader { - level: POISON, + let mut reader = ProgressReader { + level: 0, + fault: Some(BootStatus::FailedFatal), fail: false, }; for threshold in 1..=4 { assert_eq!( - soc.read(&TestSignal::Progress(threshold)) + reader + .read(&TestSignal::Progress(threshold)) .expect("read failed"), BootStatus::FailedFatal ); @@ -183,14 +186,16 @@ mod tests { #[test] fn a_transient_fault_reads_retriable_for_every_signal() { - let mut soc = SocReader { - level: TRANSIENT, + let mut reader = ProgressReader { + level: 0, + fault: Some(BootStatus::FailedRetriable), fail: false, }; for threshold in 1..=4 { assert_eq!( - soc.read(&TestSignal::Progress(threshold)) + reader + .read(&TestSignal::Progress(threshold)) .expect("read failed"), BootStatus::FailedRetriable ); @@ -199,12 +204,13 @@ mod tests { #[test] fn errors_surface_through_the_reader() { - let mut soc = SocReader { + let mut reader = ProgressReader { level: 0, + fault: None, fail: true, }; - let err = soc + let err = reader .read(&TestSignal::Progress(1)) .expect_err("expected the register fault"); @@ -269,11 +275,11 @@ mod tests { impl EvidenceReader for MockNicEndpoint { type Error = MctpFault; - fn read(&mut self, signal: &NicSignal) -> Result { + fn read(&mut self, probe: &NicSignal) -> Result { if self.bus_fault { return Err(MctpFault); } - match signal { + match probe { NicSignal::MctpReady => { if let Some(code) = self.fault_code { return Ok(match code { diff --git a/services/orchestrator/capabilities/src/incremental_verifier.rs b/services/orchestrator/capabilities/src/incremental_verifier.rs new file mode 100644 index 000000000..c7d9d9ccf --- /dev/null +++ b/services/orchestrator/capabilities/src/incremental_verifier.rs @@ -0,0 +1,441 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The [`IncrementalVerifier`] update-verification capability contract. + +use crate::{AuthenticatedImage, Progress}; +use util_io::ByteSource; + +/// Factory for incremental verification sessions. Call [`start`] to +/// begin hashing a candidate image; the returned [`VerifySession`] does +/// the actual work one bounded step at a time. +/// +/// `start` consumes the verifier. Terminal outcomes +/// ([`Authenticated`](PollOutcome::Authenticated), +/// [`Rejected`](PollOutcome::Rejected), +/// [`Fault`](PollOutcome::Fault)) and [`abandon`](VerifySession::abandon) +/// return it, so the caller can start another session. Polling after a +/// verdict is unrepresentable: the session is gone. +/// +/// The boot-time synchronous `Verifier` (in the driver crate) is +/// unaffected: it stays one-shot for the chain walk, where the image is +/// small and local. +/// +/// [`start`]: IncrementalVerifier::start +pub trait IncrementalVerifier: Sized { + /// The error reported when the check itself cannot run: crypto fault + /// or unreadable payload. A bad image is + /// [`Rejected`](PollOutcome::Rejected), not an error. + type Error: core::error::Error; + + /// The session type returned by [`start`](IncrementalVerifier::start). + type Session: VerifySession; + + /// Begins a new verification session. The verifier's internal state + /// (crypto context, scratch buffers) moves into the session. + fn start(self) -> Self::Session; +} + +/// A live verification session. Each [`poll`] call does at most one +/// read from the payload and one hash update, then returns. The chunk +/// size is implementor-chosen, sized so each poll fits the caller's +/// per-poll time budget. +/// +/// The caller watches `written` in the +/// [`Processing`](PollOutcome::Processing) progress and abandons a +/// session that stalls, on its own budget; the session never judges +/// liveness. +/// +/// `poll` consumes the session and returns a [`PollOutcome`]. On +/// [`Processing`](PollOutcome::Processing) the session comes back +/// inside the variant; on any terminal outcome the verifier comes back +/// instead, ready for a new [`start`](IncrementalVerifier::start). +/// +/// [`poll`]: VerifySession::poll +pub trait VerifySession: Sized { + /// The verifier this session was created from. + type Verifier; + + /// The error type, matching the verifier's. + type Error: core::error::Error; + + /// Processes one bounded step. Never waits on device progress, never + /// sleeps. An empty payload is a fault, never a vacuous + /// `Authenticated`. + fn poll(self, payload: &dyn ByteSource) -> PollOutcome; + + /// Discards the session and returns the verifier. + /// Infallible: a half-finished hash state is simply dropped. + fn abandon(self) -> Self::Verifier; +} + +/// Result of one [`VerifySession::poll`] call. Terminal variants return +/// the verifier, ready for a new [`start`](IncrementalVerifier::start). +#[derive(Debug)] +pub enum PollOutcome { + /// One chunk processed. The session is inside, ready for the next + /// poll. + Processing { session: S, progress: Progress }, + /// The complete image authenticated (signature and policy checks + /// passed). + Authenticated { + /// The verifier, back for a new session. + verifier: S::Verifier, + /// What the pass learned about the candidate. The same type the + /// boot walk's verdict carries, so a candidate and an image at + /// rest are described one way. + image: AuthenticatedImage, + }, + /// The complete image was checked and found invalid. + Rejected(S::Verifier), + /// The check could not run (unreadable payload, crypto engine + /// error). + Fault(S::Verifier, S::Error), +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::Svn; + use util_io::{ByteReadError, ByteSource}; + + // A ByteSource over a plain byte slice. + struct SlicePayload(&'static [u8]); + + impl ByteSource for SlicePayload { + fn len(&self) -> u64 { + self.0.len() as u64 + } + + fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<(), ByteReadError> { + let start = usize::try_from(offset).map_err(|_| ByteReadError::OutOfRange)?; + let end = start + .checked_add(buf.len()) + .ok_or(ByteReadError::OutOfRange)?; + buf.copy_from_slice(self.0.get(start..end).ok_or(ByteReadError::OutOfRange)?); + Ok(()) + } + } + + // The SVN this fixture reports for an image it accepts. A real + // verifier reads it from the candidate's manifest; this one has no + // manifest, so the value only has to be recognisable. + const FIXTURE_SVN: Svn = Svn(9); + + // Hashes 4 bytes per poll, accepts images whose first byte is nonzero. + struct ChunkedVerifier; + + struct ChunkedSession { + offset: u64, + total: u64, + } + + #[derive(Debug, PartialEq)] + struct VerifierFault; + + impl core::fmt::Display for VerifierFault { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.write_str("verifier fault") + } + } + + impl core::error::Error for VerifierFault {} + + impl IncrementalVerifier for ChunkedVerifier { + type Error = VerifierFault; + type Session = ChunkedSession; + + fn start(self) -> ChunkedSession { + ChunkedSession { + offset: 0, + total: 0, + } + } + } + + impl VerifySession for ChunkedSession { + type Verifier = ChunkedVerifier; + type Error = VerifierFault; + + fn poll(mut self, payload: &dyn ByteSource) -> PollOutcome { + if self.total == 0 { + self.total = payload.len(); + } + if self.offset >= self.total { + let mut first = [0u8; 1]; + if payload.read_at(0, &mut first).is_err() { + return PollOutcome::Fault(ChunkedVerifier, VerifierFault); + } + return if first[0] != 0 { + PollOutcome::Authenticated { + verifier: ChunkedVerifier, + image: AuthenticatedImage { + svn: Some(FIXTURE_SVN), + // No hash engine in a fixture that only looks + // at the first byte. + measurement: None, + }, + } + } else { + PollOutcome::Rejected(ChunkedVerifier) + }; + } + let chunk = core::cmp::min(4, (self.total - self.offset) as usize); + let mut buf = [0u8; 4]; + if payload.read_at(self.offset, &mut buf[..chunk]).is_err() { + return PollOutcome::Fault(ChunkedVerifier, VerifierFault); + } + self.offset += chunk as u64; + let written = self.offset; + let total = self.total; + PollOutcome::Processing { + session: self, + progress: Progress { written, total }, + } + } + + fn abandon(self) -> ChunkedVerifier { + ChunkedVerifier + } + } + + // Helper: drive a session to completion in a loop, the way the + // update pump would. Returns the terminal outcome's verifier and + // whether it authenticated. + fn drive( + mut session: ChunkedSession, + payload: &dyn ByteSource, + ) -> (ChunkedVerifier, Option) { + loop { + match session.poll(payload) { + PollOutcome::Processing { session: s, .. } => session = s, + PollOutcome::Authenticated { verifier, .. } => return (verifier, Some(true)), + PollOutcome::Rejected(v) => return (v, Some(false)), + PollOutcome::Fault(v, _) => return (v, None), + } + } + } + + #[test] + fn multi_poll_until_authenticated() { + let payload = SlicePayload(&[0xAA; 10]); + let session = ChunkedVerifier.start(); + + // 4 bytes, 4 bytes, 2 bytes = 3 Processing steps, then verdict. + let PollOutcome::Processing { + session, + progress: + Progress { + written: 4, + total: 10, + }, + } = session.poll(&payload) + else { + panic!("expected Processing"); + }; + let PollOutcome::Processing { + session, + progress: + Progress { + written: 8, + total: 10, + }, + } = session.poll(&payload) + else { + panic!("expected Processing"); + }; + let PollOutcome::Processing { + session, + progress: + Progress { + written: 10, + total: 10, + }, + } = session.poll(&payload) + else { + panic!("expected Processing"); + }; + assert!(matches!( + session.poll(&payload), + PollOutcome::Authenticated { .. } + )); + } + + // The authenticated pass is the only reading of the candidate's SVN + // anything may act on, so the outcome carries it rather than leaving + // the caller to go back to the image for it. + #[test] + fn an_authenticated_image_reports_the_svn_the_pass_read() { + let payload = SlicePayload(&[0xAA; 8]); + let mut session = ChunkedVerifier.start(); + loop { + match session.poll(&payload) { + PollOutcome::Processing { session: s, .. } => session = s, + PollOutcome::Authenticated { image, .. } => { + assert_eq!(image.svn, Some(FIXTURE_SVN)); + return; + } + PollOutcome::Rejected(_) => panic!("expected authenticated, got rejected"), + PollOutcome::Fault(_, e) => panic!("unexpected fault: {e}"), + } + } + } + + #[test] + fn rejected_image() { + let payload = SlicePayload(&[0x00; 8]); + let (_, verdict) = drive(ChunkedVerifier.start(), &payload); + assert_eq!(verdict, Some(false)); + } + + #[test] + fn abandon_returns_verifier_for_reuse() { + let payload = SlicePayload(&[0xFF; 12]); + let session = ChunkedVerifier.start(); + + let PollOutcome::Processing { session, .. } = session.poll(&payload) else { + panic!("expected Processing"); + }; + + // Abandon mid-session, get verifier back, start fresh. + let verifier = session.abandon(); + let (_, verdict) = drive(verifier.start(), &payload); + assert_eq!(verdict, Some(true)); + } + + #[test] + fn verifier_reusable_after_fault() { + let session = ChunkedVerifier.start(); + let PollOutcome::Fault(verifier, _) = session.poll(&Lying) else { + panic!("expected Fault"); + }; + + let payload = SlicePayload(&[0xFF; 4]); + let (_, verdict) = drive(verifier.start(), &payload); + assert_eq!(verdict, Some(true)); + } + + #[test] + fn verifier_reusable_after_verdict() { + let payload = SlicePayload(&[0xFF; 4]); + let (verifier, _) = drive(ChunkedVerifier.start(), &payload); + + let (_, verdict) = drive(verifier.start(), &payload); + assert_eq!(verdict, Some(true)); + } + + #[test] + fn empty_payload_is_fault() { + let payload = SlicePayload(&[]); + let session = ChunkedVerifier.start(); + assert!( + matches!(session.poll(&payload), PollOutcome::Fault(..)), + "empty payload must fault, never vacuously authenticate" + ); + } + + #[test] + fn fault_after_partial_progress() { + // Reads succeed for the first chunk, fail after. + struct FailsAfterFirstChunk; + + impl ByteSource for FailsAfterFirstChunk { + fn len(&self) -> u64 { + 12 + } + + fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<(), ByteReadError> { + if offset >= 4 { + return Err(ByteReadError::Storage); + } + buf.fill(0xFF); + Ok(()) + } + } + + let session = ChunkedVerifier.start(); + let PollOutcome::Processing { + session, + progress: + Progress { + written: 4, + total: 12, + }, + } = session.poll(&FailsAfterFirstChunk) + else { + panic!("expected Processing"); + }; + let PollOutcome::Fault(verifier, _) = session.poll(&FailsAfterFirstChunk) else { + panic!("expected Fault"); + }; + + let payload = SlicePayload(&[0xFF; 4]); + let (_, verdict) = drive(verifier.start(), &payload); + assert_eq!(verdict, Some(true)); + } + + #[test] + fn verifier_reusable_after_rejection() { + let bad = SlicePayload(&[0x00; 4]); + let (verifier, verdict) = drive(ChunkedVerifier.start(), &bad); + assert_eq!(verdict, Some(false)); + + let good = SlicePayload(&[0xFF; 4]); + let (_, verdict) = drive(verifier.start(), &good); + assert_eq!(verdict, Some(true)); + } + + #[test] + fn abandon_before_first_poll() { + let verifier = ChunkedVerifier.start().abandon(); + let payload = SlicePayload(&[0xFF; 4]); + let (_, verdict) = drive(verifier.start(), &payload); + assert_eq!(verdict, Some(true)); + } + + // A ByteSource whose read_at always fails. + struct Lying; + + impl ByteSource for Lying { + fn len(&self) -> u64 { + 64 + } + + fn read_at(&self, _offset: u64, _buf: &mut [u8]) -> Result<(), ByteReadError> { + Err(ByteReadError::Storage) + } + } + + // Pump-shaped test: stores the session state across iterations the + // way the update pump would, using an enum to hold either the idle + // verifier or the active session. + #[test] + fn pump_loop_with_state_enum() { + enum State { + Idle(ChunkedVerifier), + Verifying(ChunkedSession), + } + + let payload = SlicePayload(&[0xFF; 10]); + let mut state = State::Idle(ChunkedVerifier); + let mut polls = 0; + + loop { + state = match state { + State::Idle(v) => State::Verifying(v.start()), + State::Verifying(s) => match s.poll(&payload) { + PollOutcome::Processing { session, .. } => { + polls += 1; + State::Verifying(session) + } + PollOutcome::Authenticated { .. } => { + assert!(polls > 0); + return; + } + PollOutcome::Rejected(_) => panic!("expected authenticated"), + PollOutcome::Fault(_, e) => panic!("unexpected fault: {e}"), + }, + }; + } + } +} diff --git a/services/orchestrator/capabilities/src/lib.rs b/services/orchestrator/capabilities/src/lib.rs index a7a479f1e..f0b119405 100644 --- a/services/orchestrator/capabilities/src/lib.rs +++ b/services/orchestrator/capabilities/src/lib.rs @@ -17,14 +17,53 @@ //! board's reader gives the ids meaning. //! //! `Updatable` is the update capability: stage a payload on one device -//! (polled, one bounded step at a time) and mark it the boot candidate — -//! always tentatively; the commit gate lives elsewhere. `PayloadSource` is -//! the chunked read seam staging pulls from — transports and slot -//! bookkeeping stay behind the adapter. +//! (polled, one bounded step at a time) and mark it the boot candidate, +//! always tentatively; the commit gate lives elsewhere. The bytes come +//! through `util_io::ByteSource`; transports and slot bookkeeping stay +//! behind the adapter. +//! +//! `DeviceTrialBoot` is the commit gate activation leaves open, whether +//! `Updatable` did the activating or a PLDM Firmware Device did it for the +//! eRoT: keep the +//! activated image once its boot was judged, or drop it. It sits on the +//! downstream devices whose slots the eRoT drives, where the eRoT watches the +//! boot and decides within one of its own lifetimes. +//! +//! `SelfUpdate` is the same gate for the eRoT's own image, where the judging +//! outlives the judge: the eRoT resets into the candidate, so the verdict is +//! reached by a boot that has to read what the previous one left behind. It is +//! one durable session, one at a time, carrying the state and the verified SVN +//! together, so the next boot can tell a session whose trial never started +//! from a confirmed trial whose floor advance had not run yet. Downstream devices +//! need no session: a reset loses the observation that would judge them, so +//! abandoning at boot gets the same result with no storage. +//! +//! `SelfReset` is the reset that boots the eRoT's trial image. The eRoT +//! resets itself, so the call does not come back and has nothing to +//! return. Separate from `BootControl`, whose hold-then-release pair +//! needs a caller still running for the second call. +//! +//! `Progress` is the byte count every polled seam reports: staging and +//! verification both answer with `written` out of `total`, so one stall +//! rule covers both, and it matches the intake seam's wire form field +//! for field. +//! +//! `IncrementalVerifier` is the polled verification seam: `start` +//! consumes the verifier into a `VerifySession` whose `poll` does one +//! bounded hash step per call. See the trait docs for the full lifecycle. +//! +//! `Measurer` is the polled firmware measurement seam: same +//! factory-session-poll pattern as `IncrementalVerifier`, but the +//! terminal outcome is a SHA-256 digest, not a signature verdict. The +//! implementation reads directly from the image source. //! //! `BootWatch` is the seam the orchestrator polls: one device's boot walk, //! erased of every device-specific type, answering with a `WalkVerdict`. //! +//! `Recovery` is the restore capability: rewrite one device's active image +//! from its board-configured recovery source, mechanism unnamed, source +//! chosen per attempt. +//! //! `LockdownLatch` is the terminal capability: latch the platform into its safe //! state, one-way, at the top of the escalation ladder. //! @@ -38,16 +77,34 @@ #![cfg_attr(not(test), no_std)] +mod authenticated_image; mod boot_control; mod boot_watch; +mod device_trial_boot; mod evidence; +mod incremental_verifier; mod lockdown_latch; +mod measurer; +mod progress; +mod recovery; +mod self_reset; +mod self_update; mod svn_floor; mod updatable; +pub use authenticated_image::AuthenticatedImage; pub use boot_control::BootControl; pub use boot_watch::{BootWatch, FailureCause, WalkVerdict}; +pub use device_trial_boot::DeviceTrialBoot; pub use evidence::{BootStatus, EvidenceReader}; +pub use incremental_verifier::{IncrementalVerifier, PollOutcome, VerifySession}; pub use lockdown_latch::LockdownLatch; +pub use measurer::{MeasureOutcome, MeasureSession, Measurement, Measurer}; +pub use progress::Progress; +pub use recovery::{Recovery, RestoreOutcome}; +pub use self_reset::{NoReset, SelfReset}; +pub use self_update::{ + trial_outcome, NoSession, RunningImage, SelfUpdate, SelfUpdateState, TrialOutcome, +}; pub use svn_floor::{Svn, SvnFloor}; -pub use updatable::{PayloadReadError, PayloadSource, StageProgress, Updatable, UpdateError}; +pub use updatable::{StageProgress, Updatable, UpdateError}; diff --git a/services/orchestrator/capabilities/src/measurer.rs b/services/orchestrator/capabilities/src/measurer.rs new file mode 100644 index 000000000..8d001c587 --- /dev/null +++ b/services/orchestrator/capabilities/src/measurer.rs @@ -0,0 +1,345 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Firmware measurement trait. + +use crate::Progress; +use util_io::ByteSource; + +/// SHA-256 digest of a component's firmware image. Newtype so a bare +/// `[u8; 32]` can't be confused for one. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct Measurement(pub [u8; Self::LEN]); + +impl Measurement { + /// Bytes in one measurement (SHA-256 = 32). A crypto service that + /// reports SHA-384 for SPDM needs this widened or made generic. + pub const LEN: usize = 32; +} + +/// Hashes a firmware image in bounded steps. [`start`] begins a session; +/// the returned [`MeasureSession`] does one chunk per [`poll`] call, +/// reading straight from the image source. +/// +/// `start` consumes the measurer. Terminal outcomes +/// ([`Complete`](MeasureOutcome::Complete), +/// [`Fault`](MeasureOutcome::Fault)) and +/// [`abandon`](MeasureSession::abandon) return it, so the caller can +/// start another session. +/// +/// [`start`]: Measurer::start +pub trait Measurer: Sized { + /// A fault in the hash engine or an unreadable source. A completed + /// hash is [`Complete`](MeasureOutcome::Complete), never an error. + type Error: core::error::Error; + + /// The session type returned by [`start`](Measurer::start). + type Session: MeasureSession; + + /// Begins a new measurement session. + fn start(self) -> Self::Session; +} + +/// A live measurement session. Each [`poll`] call does one read and one +/// hash update, then returns. Chunk size is up to the implementation. +/// +/// [`poll`]: MeasureSession::poll +pub trait MeasureSession: Sized { + /// The measurer this session was created from. + type Measurer; + + /// The error type, matching the capability's. + type Error: core::error::Error; + + /// Processes one bounded step. Never waits, never sleeps. An empty + /// source is a fault, not a zero-length hash. + fn poll(self, payload: &dyn ByteSource) -> MeasureOutcome; + + /// Discards the session and returns the measurer. + /// Infallible: a half-finished hash state is simply dropped. + fn abandon(self) -> Self::Measurer; +} + +/// Result of one [`MeasureSession::poll`] call. +#[derive(Debug)] +pub enum MeasureOutcome { + /// One chunk hashed. The session is inside, ready for the next poll. + Processing { session: S, progress: Progress }, + /// The complete image has been hashed. + Complete(S::Measurer, Measurement), + /// The hash could not run (unreadable source, engine fault). + Fault(S::Measurer, S::Error), +} + +#[cfg(test)] +mod tests { + use super::*; + use util_io::{ByteReadError, ByteSource}; + + struct SlicePayload(&'static [u8]); + + impl ByteSource for SlicePayload { + fn len(&self) -> u64 { + self.0.len() as u64 + } + + fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<(), ByteReadError> { + let start = usize::try_from(offset).map_err(|_| ByteReadError::OutOfRange)?; + let end = start + .checked_add(buf.len()) + .ok_or(ByteReadError::OutOfRange)?; + buf.copy_from_slice(self.0.get(start..end).ok_or(ByteReadError::OutOfRange)?); + Ok(()) + } + } + + // Hashes 4 bytes per poll, XORs all bytes into the first byte of + // the digest (enough to prove the trait contract without pulling a + // real SHA-256). + struct XorMeasurer; + + struct XorSession { + offset: u64, + total: u64, + accum: u8, + } + + #[derive(Debug, PartialEq)] + struct MeasureFault; + + impl core::fmt::Display for MeasureFault { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.write_str("measure fault") + } + } + + impl core::error::Error for MeasureFault {} + + impl Measurer for XorMeasurer { + type Error = MeasureFault; + type Session = XorSession; + + fn start(self) -> XorSession { + XorSession { + offset: 0, + total: 0, + accum: 0, + } + } + } + + impl MeasureSession for XorSession { + type Measurer = XorMeasurer; + type Error = MeasureFault; + + fn poll(mut self, payload: &dyn ByteSource) -> MeasureOutcome { + if self.total == 0 { + let len = payload.len(); + if len == 0 { + return MeasureOutcome::Fault(XorMeasurer, MeasureFault); + } + self.total = len; + } + if self.offset >= self.total { + let mut digest = Measurement([0u8; Measurement::LEN]); + digest.0[0] = self.accum; + return MeasureOutcome::Complete(XorMeasurer, digest); + } + let chunk = core::cmp::min(4, (self.total - self.offset) as usize); + let mut buf = [0u8; 4]; + if payload.read_at(self.offset, &mut buf[..chunk]).is_err() { + return MeasureOutcome::Fault(XorMeasurer, MeasureFault); + } + for &b in &buf[..chunk] { + self.accum ^= b; + } + self.offset += chunk as u64; + let written = self.offset; + let total = self.total; + MeasureOutcome::Processing { + session: self, + progress: Progress { written, total }, + } + } + + fn abandon(self) -> XorMeasurer { + XorMeasurer + } + } + + fn drive( + mut session: XorSession, + payload: &dyn ByteSource, + ) -> (XorMeasurer, Option) { + loop { + match session.poll(payload) { + MeasureOutcome::Processing { session: s, .. } => session = s, + MeasureOutcome::Complete(m, digest) => return (m, Some(digest)), + MeasureOutcome::Fault(m, _) => return (m, None), + } + } + } + + #[test] + fn multi_poll_until_complete() { + let payload = SlicePayload(&[0xAA; 10]); + let session = XorMeasurer.start(); + + let MeasureOutcome::Processing { + session, + progress: + Progress { + written: 4, + total: 10, + }, + } = session.poll(&payload) + else { + panic!("expected Processing"); + }; + let MeasureOutcome::Processing { + session, + progress: + Progress { + written: 8, + total: 10, + }, + } = session.poll(&payload) + else { + panic!("expected Processing"); + }; + let MeasureOutcome::Processing { + session, + progress: + Progress { + written: 10, + total: 10, + }, + } = session.poll(&payload) + else { + panic!("expected Processing"); + }; + assert!(matches!( + session.poll(&payload), + MeasureOutcome::Complete(..) + )); + } + + #[test] + fn digest_reflects_content() { + let payload = SlicePayload(&[0xFF; 8]); + let (_, digest) = drive(XorMeasurer.start(), &payload); + let d = digest.unwrap(); + // 8 bytes of 0xFF XORed: 0xFF ^ 0xFF = 0x00 per pair, so 0x00. + assert_eq!(d.0[0], 0x00); + assert_eq!(d.0[1..], [0u8; Measurement::LEN - 1]); + } + + #[test] + fn different_content_different_digest() { + let a = SlicePayload(&[0x01, 0x02, 0x03, 0x04]); + let b = SlicePayload(&[0x05, 0x06, 0x07, 0x08]); + let (_, da) = drive(XorMeasurer.start(), &a); + let (_, db) = drive(XorMeasurer.start(), &b); + assert_ne!(da.unwrap().0[0], db.unwrap().0[0]); + } + + #[test] + fn empty_payload_is_fault() { + let payload = SlicePayload(&[]); + let session = XorMeasurer.start(); + assert!(matches!(session.poll(&payload), MeasureOutcome::Fault(..))); + } + + #[test] + fn abandon_before_first_poll() { + let session = XorMeasurer.start(); + let m = session.abandon(); + let payload = SlicePayload(&[0xFF; 4]); + let (_, digest) = drive(m.start(), &payload); + assert!(digest.is_some()); + } + + #[test] + fn abandon_returns_capability_for_reuse() { + let payload = SlicePayload(&[0xFF; 12]); + let session = XorMeasurer.start(); + + let MeasureOutcome::Processing { session, .. } = session.poll(&payload) else { + panic!("expected Processing"); + }; + + let m = session.abandon(); + let (_, digest) = drive(m.start(), &payload); + assert!(digest.is_some()); + } + + #[test] + fn reusable_after_complete() { + let payload = SlicePayload(&[0xFF; 4]); + let (m, _) = drive(XorMeasurer.start(), &payload); + let (_, digest) = drive(m.start(), &payload); + assert!(digest.is_some()); + } + + #[test] + fn reusable_after_fault() { + let session = XorMeasurer.start(); + let MeasureOutcome::Fault(m, _) = session.poll(&Failing) else { + panic!("expected Fault"); + }; + let payload = SlicePayload(&[0xFF; 4]); + let (_, digest) = drive(m.start(), &payload); + assert!(digest.is_some()); + } + + #[test] + fn fault_after_partial_progress() { + struct FailsAfterFirstChunk; + + impl ByteSource for FailsAfterFirstChunk { + fn len(&self) -> u64 { + 12 + } + + fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<(), ByteReadError> { + if offset >= 4 { + return Err(ByteReadError::Storage); + } + buf.fill(0xFF); + Ok(()) + } + } + + let session = XorMeasurer.start(); + let MeasureOutcome::Processing { + session, + progress: + Progress { + written: 4, + total: 12, + }, + } = session.poll(&FailsAfterFirstChunk) + else { + panic!("expected Processing"); + }; + let MeasureOutcome::Fault(m, _) = session.poll(&FailsAfterFirstChunk) else { + panic!("expected Fault"); + }; + + let payload = SlicePayload(&[0xFF; 4]); + let (_, digest) = drive(m.start(), &payload); + assert!(digest.is_some()); + } + + struct Failing; + + impl ByteSource for Failing { + fn len(&self) -> u64 { + 64 + } + + fn read_at(&self, _offset: u64, _buf: &mut [u8]) -> Result<(), ByteReadError> { + Err(ByteReadError::Storage) + } + } +} diff --git a/services/orchestrator/capabilities/src/progress.rs b/services/orchestrator/capabilities/src/progress.rs new file mode 100644 index 000000000..d937d944f --- /dev/null +++ b/services/orchestrator/capabilities/src/progress.rs @@ -0,0 +1,69 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! How far a polled step has come. + +/// Bytes processed so far out of the total. +/// +/// Shared by every polled seam that works through a payload: +/// [`StageProgress::Transferring`](crate::StageProgress::Transferring) +/// counts bytes written to a device, +/// [`PollOutcome::Processing`](crate::PollOutcome::Processing) counts bytes +/// hashed. `written` is what a caller watching for a stall keys on, so the +/// two seams answer the same question the same way. +/// +/// `written` is monotonic within one job and may hold still across calls: a +/// busy device or a retransmit makes no progress and is not an error. It +/// never exceeds `total`. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct Progress { + /// Bytes the step has got through so far, at or below `total`. A + /// verify session writes nothing, so read the name that way. + pub written: u64, + /// Total payload bytes. + pub total: u64, +} + +impl Progress { + /// A job at its starting position. + pub const fn start(total: u64) -> Self { + Self { written: 0, total } + } + + /// True once every byte has been processed. + pub const fn is_complete(&self) -> bool { + self.written >= self.total + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn a_fresh_job_has_processed_nothing() { + let p = Progress::start(4096); + assert_eq!(p.written, 0); + assert_eq!(p.total, 4096); + assert!(!p.is_complete()); + } + + #[test] + fn a_job_is_complete_when_written_reaches_total() { + assert!(Progress { + written: 10, + total: 10 + } + .is_complete()); + assert!(!Progress { + written: 9, + total: 10 + } + .is_complete()); + } + + #[test] + fn an_empty_payload_is_complete_from_the_start() { + assert!(Progress::start(0).is_complete()); + } +} diff --git a/services/orchestrator/capabilities/src/recovery.rs b/services/orchestrator/capabilities/src/recovery.rs new file mode 100644 index 000000000..3564964a5 --- /dev/null +++ b/services/orchestrator/capabilities/src/recovery.rs @@ -0,0 +1,216 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The [`Recovery`] restore capability contract. + +/// The outcome of a single restore attempt. +/// +/// Carried on the `Ok` side of [`Recovery::restore`] so the orchestrator can +/// distinguish "the mechanism ran" from "there is nothing left to try" +/// without pattern-matching an opaque error type it cannot inspect. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum RestoreOutcome { + /// The recovery source was written to the device's active region. + /// Whether the image is good is not judged here; the re-walk verifies. + Restored, + /// The device's configured recovery sources are exhausted (no untried + /// image/slot remains). The orchestrator gates the component per its + /// failure policy immediately, without waiting for the retry cap. + SourceExhausted, +} + +/// Restore capability: rewrite one managed device's active image from its +/// configured recovery source. +/// +/// What the recovery source is (a golden image in protected flash, a mux +/// flip to a known-good part, a fetch over a sideband) is board wiring and +/// never leaks through this seam. The orchestrator only asks for the +/// mechanism to run; it holds the device in reset before asking and +/// re-verifies the image on the walk that follows. +/// +/// `Ok(Restored)` says the mechanism completed, not that the image is good. +/// The verifier judges the restored image on the re-walk, so a restore must +/// not check it here. `Ok(SourceExhausted)` says no untried source remains, +/// and the orchestrator gates the component per its failure policy right +/// away instead of waiting for the retry cap. Errors are actuation faults +/// only, such as an unreachable source or a failed write, and the +/// orchestrator treats them fail-secure. Source exhaustion travels on the +/// `Ok` side because it is a known condition: the orchestrator applies +/// per-component policy to it instead of locking unconditionally. +/// +/// Every recovery attempt calls `restore` again with the next `attempt`, so +/// a partial earlier restore must not stop a later call from producing a +/// complete image. The attempt count comes from the core's retry counter, +/// the same value the retry cap is measured against. A count kept by the +/// device would drift, because it never sees which attempt succeeded. +pub trait Recovery { + /// The error type of this device's restore mechanism. + /// + /// Bounded by [`core::error::Error`] so the orchestrator gets `Display` + /// and a `source()` cause chain, not just a `Debug` dump. Error + /// categories are implementation-defined. + type Error: core::error::Error; + + /// Rewrites the device's active image from the recovery source. + /// + /// `attempt` is this device's consecutive-recovery count, `0` on the + /// first try of a recovery cycle. Implementors that hold more than one + /// source pick per attempt (slot A on `0`, slot B on `1`, golden on + /// `2`); implementors with a single source ignore it and return + /// [`RestoreOutcome::SourceExhausted`] once their only source has been + /// tried. + fn restore(&mut self, attempt: u8) -> Result; +} + +/// Reports source exhaustion on every attempt, for a board whose +/// components have no alternate image to fall back to. The orchestrator +/// gates the component per its failure policy on the first try instead +/// of retrying through a source list that does not exist. +impl Recovery for () { + type Error = core::convert::Infallible; + + fn restore(&mut self, _attempt: u8) -> Result { + Ok(RestoreOutcome::SourceExhausted) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + // Implements Recovery with no HAL dependency, because the contract must + // be satisfiable from any stack (mock, IPC proxy, simulator). A HAL-bound + // `Error` type would stop this compiling. + struct MockRecovery { + attempts: [u8; 4], + restores: usize, + /// Number of distinct sources this device holds. + sources: u8, + /// Attempt number the source faults on, so a test can make one + /// restore fail and the next one succeed. + fail_on: Option, + } + + impl MockRecovery { + fn healthy() -> Self { + MockRecovery { + attempts: [0; 4], + restores: 0, + sources: u8::MAX, + fail_on: None, + } + } + + fn with_sources(sources: u8) -> Self { + MockRecovery { + attempts: [0; 4], + restores: 0, + sources, + fail_on: None, + } + } + + fn faulting_on(attempt: u8) -> Self { + MockRecovery { + attempts: [0; 4], + restores: 0, + sources: u8::MAX, + fail_on: Some(attempt), + } + } + } + + #[derive(Debug, PartialEq, Eq)] + struct MockFault; + + impl core::fmt::Display for MockFault { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.write_str("mock restore fault") + } + } + + impl core::error::Error for MockFault {} + + impl Recovery for MockRecovery { + type Error = MockFault; + + fn restore(&mut self, attempt: u8) -> Result { + if self.fail_on == Some(attempt) { + return Err(MockFault); + } + if attempt >= self.sources { + return Ok(RestoreOutcome::SourceExhausted); + } + self.attempts[self.restores] = attempt; + self.restores += 1; + Ok(RestoreOutcome::Restored) + } + } + + /// Calls the mechanism the way the orchestrator does: run it, judge + /// nothing here. `attempt` comes from `Effect::RecoverComponent`, never + /// from a count the device keeps. + fn recover(dev: &mut R, attempt: u8) -> Result { + dev.restore(attempt) + } + + #[test] + fn contract_is_implementable_without_the_hal() { + let mut dev = MockRecovery::healthy(); + + assert_eq!(recover(&mut dev, 0).unwrap(), RestoreOutcome::Restored); + assert_eq!(recover(&mut dev, 1).unwrap(), RestoreOutcome::Restored); + + assert_eq!(dev.restores, 2); + } + + #[test] + fn each_attempt_reaches_the_implementor() { + let mut dev = MockRecovery::healthy(); + + // Out of order and with a gap, so a device that recorded its own + // call count instead of the argument fails here. + for attempt in [2, 0, 7] { + assert_eq!( + recover(&mut dev, attempt).unwrap(), + RestoreOutcome::Restored + ); + } + + assert_eq!(&dev.attempts[..3], &[2, 0, 7]); + } + + #[test] + fn a_failed_restore_does_not_block_the_next_attempt() { + let mut dev = MockRecovery::faulting_on(0); + + recover(&mut dev, 0).expect_err("expected the first attempt to fault"); + assert_eq!(recover(&mut dev, 1).unwrap(), RestoreOutcome::Restored); + + assert_eq!(dev.restores, 1); + } + + #[test] + fn errors_surface_through_the_generic_seam() { + let mut dev = MockRecovery::faulting_on(0); + + let err = recover(&mut dev, 0).expect_err("expected the restore fault"); + + // Display comes from the core::error::Error bound, not a Debug dump. + assert_eq!(err.to_string(), "mock restore fault"); + } + + #[test] + fn source_exhaustion_is_a_verdict_not_an_error() { + let mut dev = MockRecovery::with_sources(2); + + assert_eq!(recover(&mut dev, 0).unwrap(), RestoreOutcome::Restored); + assert_eq!(recover(&mut dev, 1).unwrap(), RestoreOutcome::Restored); + assert_eq!( + recover(&mut dev, 2).unwrap(), + RestoreOutcome::SourceExhausted + ); + + assert_eq!(dev.restores, 2, "exhaustion does not count as a restore"); + } +} diff --git a/services/orchestrator/capabilities/src/self_reset.rs b/services/orchestrator/capabilities/src/self_reset.rs new file mode 100644 index 000000000..87ea05c2f --- /dev/null +++ b/services/orchestrator/capabilities/src/self_reset.rs @@ -0,0 +1,71 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The [`SelfReset`] actuation capability contract. + +/// Actuation capability: reset the eRoT itself. +/// +/// Activating the eRoT's own update ends here: record the session, mark +/// the trial pending, reset. The boot selector then runs the trial image +/// and [`settle_self_update`](crate::SelfUpdate) judges it on the way up. +/// +/// Not [`BootControl`](crate::BootControl), whose `hold_in_reset` and +/// `release` are two calls: the caller has to survive the first to make +/// the second. This caller does not survive `reset`. The receiver is +/// `&mut self` like the other capabilities, which also lets an +/// implementation record the attempt, as the driver tests' mock does. +/// +/// # Errors +/// +/// `reset` returns only when the reset did not happen. +/// [`Infallible`](core::convert::Infallible) enforces it: with no success +/// value, an implementation that returns at all returns an error. `Err` +/// means the old image still runs with the trial marked, so the next +/// reset from any source boots the trial. +pub trait SelfReset { + /// Why the reset did not happen. Each platform defines its own + /// failures. + /// + /// [`core::error::Error`] so it can be displayed and chained. + type Error: core::error::Error; + + /// Resets the eRoT. Returns only on failure. + fn reset(&mut self) -> Result; +} + +/// The reset for a board that cannot reset itself: it fails instead of +/// pretending. A board that does update itself implements `SelfReset` +/// properly. Boards that never update themselves keep `()` rather than +/// naming a type they never call, like the `()` impls of `SelfUpdate` +/// and `Recovery`. +impl SelfReset for () { + type Error = NoReset; + + fn reset(&mut self) -> Result { + Err(NoReset) + } +} + +/// This board cannot reset the eRoT. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct NoReset; + +impl core::fmt::Display for NoReset { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.write_str("this board cannot reset the eRoT") + } +} + +impl core::error::Error for NoReset {} + +#[cfg(test)] +mod tests { + use super::*; + + // `()` is the reset type a board that cannot reset itself names. + // The QEMU scenarios run this impl. + #[test] + fn a_board_with_no_way_to_reset_says_so() { + assert_eq!(().reset().unwrap_err(), NoReset); + } +} diff --git a/services/orchestrator/capabilities/src/self_update.rs b/services/orchestrator/capabilities/src/self_update.rs new file mode 100644 index 000000000..25738b22e --- /dev/null +++ b/services/orchestrator/capabilities/src/self_update.rs @@ -0,0 +1,623 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The [`SelfUpdate`] persistent session contract for the eRoT's own image. +//! +//! An update that activates a new image and self-resets has to survive the +//! reboot: the running code is gone, and with it every RAM fact about what was +//! staged and why. This trait is what the next boot reads. It holds one +//! session at a time, because the eRoT updates itself one image at a time. +//! +//! Downstream devices need no persistent session. A reset loses the boot +//! observation that would decide the trial, so the only safe action for a +//! downstream device after a reset is abandon, and +//! [`Updatable::abandon`](crate::Updatable::abandon) is infallible and +//! unconditional: calling it on every device at boot gets the same result with +//! no storage. This trait exists for the eRoT's own image only, one per +//! platform. +//! +//! The session carries the state, not only the verified SVN, because the state +//! is what tells two crashes apart. A session that knew only the SVN would read +//! the same after a crash before the trial was marked pending and after a +//! confirmed trial whose floor advance had not run yet, and those need opposite +//! actions: +//! the first has to be dropped, the second has to advance the anti-rollback +//! floor. Advancing it on the first would push the floor past the image that is +//! running. +//! +//! [`trial_outcome`] reads the session and the image the eRoT booted and says +//! what happened to the trial. What to do about it is the state machine's, the +//! same split [`BootWatch`](crate::BootWatch) and [`Recovery`](crate::Recovery) +//! already use: the seam answers with a verdict, the machine decides. + +use crate::Svn; + +/// Which image the eRoT is running, as durable storage records it. +/// +/// This, not whether the pending mark is still set, is what tells a trial boot +/// from a fallback. Platforms differ on the mark: a boot selector that consumes +/// it leaves nothing set by the time the trial image runs, while one that holds +/// it until the trial is decided still does. Which image booted reads the same +/// on both. +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub enum RunningImage { + /// The image the pending mark selects. This boot is the trial. + Trial, + /// The image the last confirmed update left in place. + Confirmed, +} + +/// Where the eRoT's own update session stands, as held in durable storage. +/// +/// `Copy` and lifetime-free, like every capability vocabulary type. +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub enum SelfUpdateState { + /// No update in flight. + Idle, + /// An image was authenticated with this SVN and written to the inactive + /// slot. Nothing is marked pending yet, so the next reset boots the running + /// image. + Prepared { + /// The SVN the verifier read from the image's manifest before + /// activation. The only authenticated reading of it, so the only + /// value the anti-rollback commit may trust. + svn: Svn, + }, + /// The trial is pending: the next reset boots the prepared image once. + TrialPending { + /// The SVN recorded by [`prepare`](SelfUpdate::prepare). + svn: Svn, + }, + /// The trial was confirmed. The anti-rollback floor has not + /// necessarily taken the SVN yet, which is what + /// [`TrialOutcome::ConfirmedUncommitted`] covers. + Committed { + /// The SVN to advance the floor to. + svn: Svn, + }, +} + +/// What became of a self-update trial, as the boot after it finds things. +/// +/// A verdict, not an instruction: it says what happened, and the state machine +/// decides what that costs. Total over [`SelfUpdateState`] and +/// [`RunningImage`] (see [`trial_outcome`]), so no caller has to read the +/// storage states for itself. +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub enum TrialOutcome { + /// No update was in flight and the confirmed image is running. + NoSession, + /// A session exists that nothing will confirm: the trial booted and fell + /// back, or it was never marked pending, or an image is running that the + /// session does not claim. All of them leave an update that has to be + /// dropped before another can start. + /// + /// When the unclaimed trial is the image running right now, reverting + /// only moves slot metadata: the part keeps running it until the next + /// reset. + Unconfirmed, + /// This boot is the trial. Nothing has judged it yet. + InProgress, + /// The trial was confirmed, and the anti-rollback floor has not + /// necessarily taken the SVN yet. + ConfirmedUncommitted { + /// The verified SVN the session recorded. + svn: Svn, + }, +} + +/// Persistent session for the eRoT's own update, surviving power loss and the +/// self-reset that activation needs. +/// +/// Where the session lives (protected flash, a reserved region, a mock in +/// tests) is the implementor's concern, as is how the platform marks the boot +/// selector. A platform whose boot selector reads a record the eRoT writes +/// folds the pending mark into the session's own write, and its +/// [`set_trial_pending`](Self::set_trial_pending) does nothing beyond moving +/// the state. A platform whose boot selector is a register or a ROM-defined +/// table writes twice behind the seam. Neither shows here. +/// +/// # Transitions +/// +/// [`prepare`](Self::prepare) records a new session from any state, +/// [`set_trial_pending`](Self::set_trial_pending) moves `Prepared` to +/// `TrialPending`, +/// [`confirm`](Self::confirm) moves `TrialPending` to `Committed`, +/// [`complete`](Self::complete) ends a committed session, and +/// [`revert`](Self::revert) drops whatever is in flight. Both endings land on +/// `Idle`; they are separate calls because the caller reaching them is +/// different, the commit path and the abandon path. +/// +/// Every call is idempotent: repeating a transition that already happened +/// succeeds and changes nothing, the same shape +/// [`SvnFloor::advance`](crate::SvnFloor::advance) uses. A caller that needs +/// to tell a repeat from a session that was never there reads +/// [`state`](Self::state) first. +/// +/// # Durability +/// +/// A transition that returns `Ok` survives power loss, and a transition cut +/// short by power loss leaves the state before the call or the state the call +/// wrote, never a mix. Storage that cannot write a state atomically gets there +/// the usual way, two copies with a sequence number and a checksum, writing +/// the stale copy and reading the newest valid one. +/// +/// # Boot bound +/// +/// A boot selector that holds the pending mark across resets boots the trial +/// again +/// after every reset, so a trial image that dies before anything confirms it +/// loops forever unless something counts attempts. A selector that consumes +/// the mark does not have this problem: the second boot runs the confirmed +/// image. Platforms in the first category need a ROM-side boot counter or +/// equivalent bound on how many boots a trial gets. +/// +/// # Ordering +/// +/// Record first, then mark pending. A crash between the two leaves +/// `TrialPending` with +/// the confirmed image still running, which [`trial_outcome`] already reads as +/// a trial nothing confirmed, so the window needs no further distinction. +/// Marking pending first would boot a trial with no session to judge it. +pub trait SelfUpdate { + /// The error type of this session's storage. + /// + /// Bounded by [`core::error::Error`] so the orchestrator gets `Display` + /// and a `source()` cause chain, not just a `Debug` dump. Error + /// categories are implementation-defined. + type Error: core::error::Error; + + /// The session as durable storage holds it. + fn state(&self) -> Result; + + /// Which image this boot is running. + /// + /// [`Confirmed`](RunningImage::Confirmed) whenever no trial is in flight, + /// an `Idle` session included: with nothing pending there is nothing else + /// to be running. + /// + /// Read together with [`state`](Self::state) once at boot, as one + /// snapshot. Nothing moves the pair in between: the eRoT is the only + /// writer and it is not running its own update while deciding the last + /// one. + fn running(&self) -> Result; + + /// Records a new session with the verified SVN, leaving the state + /// `Prepared`. Overwrites any earlier session, so a retry after a crash + /// records the same SVN again. + fn prepare(&mut self, svn: Svn) -> Result<(), Self::Error>; + + /// Marks the trial pending, leaving the state `TrialPending`. Called after + /// the image is in the inactive slot and before the reset that boots it. + /// + /// # Errors + /// + /// When the session is not `Prepared` or `TrialPending`: there is nothing + /// to mark, and marking a boot pending with no session behind it is what + /// the ordering rule exists to prevent. + fn set_trial_pending(&mut self) -> Result<(), Self::Error>; + + /// Records that the trial was judged good, leaving the state + /// `Committed`. The anti-rollback floor is advanced by the caller + /// afterwards, not here: this trait holds the session, it does not own + /// the floor. + /// + /// # Errors + /// + /// When no trial is pending and the session is not already `Committed`. + fn confirm(&mut self) -> Result<(), Self::Error>; + + /// Ends a committed session, leaving the state `Idle`. Called once the + /// floor has taken the SVN. + /// + /// # Errors + /// + /// When the session is neither `Committed` nor already `Idle`. A session + /// still in flight is dropped with [`revert`](Self::revert), so that a + /// mistaken `complete` cannot silently discard a pending trial. + fn complete(&mut self) -> Result<(), Self::Error>; + + /// Drops whatever is in flight, leaving the state `Idle`. Succeeds from + /// any state, `Idle` included. + /// + /// Clearing the pending mark is the implementor's, when the platform holds + /// it outside the session. + fn revert(&mut self) -> Result<(), Self::Error>; +} + +/// What became of the trial, from the session and the image that booted. +/// +/// A session and a running image that disagree are not an error: they are the +/// crash windows this function exists to name. +#[must_use] +pub const fn trial_outcome(state: SelfUpdateState, running: RunningImage) -> TrialOutcome { + match (state, running) { + // Nothing in flight. + (SelfUpdateState::Idle, RunningImage::Confirmed) => TrialOutcome::NoSession, + // A trial image running with no session behind it: nothing records + // what it was for, so nothing can confirm it. + (SelfUpdateState::Idle, RunningImage::Trial) => TrialOutcome::Unconfirmed, + // Prepared, and the reset that would have started the trial never + // came. + (SelfUpdateState::Prepared { .. }, RunningImage::Confirmed) => TrialOutcome::Unconfirmed, + // A trial booted while the session still reads Prepared: the mark + // ran ahead of the record, the ordering rule's other side. + (SelfUpdateState::Prepared { .. }, RunningImage::Trial) => TrialOutcome::Unconfirmed, + // The trial is what is running now. + (SelfUpdateState::TrialPending { .. }, RunningImage::Trial) => TrialOutcome::InProgress, + // The trial booted and the platform fell back, so the image either + // failed or never reached the point that confirms it. + (SelfUpdateState::TrialPending { .. }, RunningImage::Confirmed) => { + TrialOutcome::Unconfirmed + } + // Confirmed. The floor advance is the only step that may still be + // missing, and repeating it is harmless. + (SelfUpdateState::Committed { svn }, _) => TrialOutcome::ConfirmedUncommitted { svn }, + } +} + +/// The self-update session for a board that never updates its own eRoT. +/// +/// It reports `Idle` and `Confirmed`, which is what having no session looks +/// like, and returns `NoSession` from every write instead of pretending to +/// store one. A board that does update itself provides a real implementation +/// and a `Board::self_update`. This impl is here so the other boards do not +/// have to name a session type they never use. +impl SelfUpdate for () { + type Error = NoSession; + + fn state(&self) -> Result { + Ok(SelfUpdateState::Idle) + } + + fn running(&self) -> Result { + Ok(RunningImage::Confirmed) + } + + fn prepare(&mut self, _svn: Svn) -> Result<(), Self::Error> { + Err(NoSession) + } + + fn set_trial_pending(&mut self) -> Result<(), Self::Error> { + Err(NoSession) + } + + fn confirm(&mut self) -> Result<(), Self::Error> { + Err(NoSession) + } + + fn complete(&mut self) -> Result<(), Self::Error> { + Err(NoSession) + } + + fn revert(&mut self) -> Result<(), Self::Error> { + // There is nothing to drop, so this succeeds. `revert` is allowed + // to run from `Idle`, and `()` is always `Idle`. + Ok(()) + } +} + +/// Returned when something tries to write a self-update session on a board +/// that does not keep one. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct NoSession; + +impl core::fmt::Display for NoSession { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.write_str("this board keeps no self-update session") + } +} + +impl core::error::Error for NoSession {} + +#[cfg(test)] +mod tests { + use super::*; + use core::cell::Cell; + + #[derive(Debug, PartialEq, Eq)] + struct MockFault; + + impl core::fmt::Display for MockFault { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.write_str("mock session fault") + } + } + + impl core::error::Error for MockFault {} + + /// Implements SelfUpdate with no HAL dependency: the contract must be + /// satisfiable from any stack (mock, IPC proxy, simulator). The state + /// stands in for durable storage, and `fail` for a store that is not + /// answering. + struct MockSession { + state: Cell, + running: Cell, + fail: bool, + } + + impl MockSession { + fn idle() -> Self { + Self { + state: Cell::new(SelfUpdateState::Idle), + running: Cell::new(RunningImage::Confirmed), + fail: false, + } + } + + fn faulty() -> Self { + Self { + state: Cell::new(SelfUpdateState::Idle), + running: Cell::new(RunningImage::Confirmed), + fail: true, + } + } + + /// Stands in for the reset that boots what `set_trial_pending` marked. + fn reboot_into_the_trial(&self) { + self.running.set(RunningImage::Trial); + } + } + + impl SelfUpdate for MockSession { + type Error = MockFault; + + fn state(&self) -> Result { + if self.fail { + return Err(MockFault); + } + Ok(self.state.get()) + } + + fn running(&self) -> Result { + if self.fail { + return Err(MockFault); + } + Ok(self.running.get()) + } + + fn prepare(&mut self, svn: Svn) -> Result<(), MockFault> { + if self.fail { + return Err(MockFault); + } + self.state.set(SelfUpdateState::Prepared { svn }); + Ok(()) + } + + fn set_trial_pending(&mut self) -> Result<(), MockFault> { + if self.fail { + return Err(MockFault); + } + match self.state.get() { + SelfUpdateState::Prepared { svn } | SelfUpdateState::TrialPending { svn } => { + self.state.set(SelfUpdateState::TrialPending { svn }); + Ok(()) + } + _ => Err(MockFault), + } + } + + fn confirm(&mut self) -> Result<(), MockFault> { + if self.fail { + return Err(MockFault); + } + match self.state.get() { + SelfUpdateState::TrialPending { svn } | SelfUpdateState::Committed { svn } => { + self.state.set(SelfUpdateState::Committed { svn }); + Ok(()) + } + _ => Err(MockFault), + } + } + + fn complete(&mut self) -> Result<(), MockFault> { + if self.fail { + return Err(MockFault); + } + match self.state.get() { + SelfUpdateState::Committed { .. } | SelfUpdateState::Idle => { + self.state.set(SelfUpdateState::Idle); + Ok(()) + } + _ => Err(MockFault), + } + } + + fn revert(&mut self) -> Result<(), MockFault> { + if self.fail { + return Err(MockFault); + } + self.state.set(SelfUpdateState::Idle); + Ok(()) + } + } + + const SVN: Svn = Svn(7); + const NEWER: Svn = Svn(9); + + #[test] + fn walks_a_whole_update() { + let mut session = MockSession::idle(); + session.prepare(SVN).expect("store answers"); + assert_eq!(session.state(), Ok(SelfUpdateState::Prepared { svn: SVN })); + session.set_trial_pending().expect("prepared"); + assert_eq!( + session.state(), + Ok(SelfUpdateState::TrialPending { svn: SVN }) + ); + session.reboot_into_the_trial(); + assert_eq!( + trial_outcome( + session.state().expect("store answers"), + session.running().expect("store answers") + ), + TrialOutcome::InProgress + ); + session.confirm().expect("trial pending"); + assert_eq!(session.state(), Ok(SelfUpdateState::Committed { svn: SVN })); + session.complete().expect("committed"); + assert_eq!(session.state(), Ok(SelfUpdateState::Idle)); + } + + /// A retry after a crash records the new SVN over the old session. + #[test] + fn preparing_again_replaces_the_session() { + let mut session = MockSession::idle(); + session.prepare(SVN).expect("store answers"); + session.prepare(NEWER).expect("store answers"); + assert_eq!( + session.state(), + Ok(SelfUpdateState::Prepared { svn: NEWER }) + ); + } + + /// Repeating a transition that already landed is how a caller retries + /// after a crash, so it must not fail. + #[test] + fn repeating_a_transition_changes_nothing() { + let mut session = MockSession::idle(); + session.prepare(SVN).expect("store answers"); + session.set_trial_pending().expect("prepared"); + session.set_trial_pending().expect("already pending"); + assert_eq!( + session.state(), + Ok(SelfUpdateState::TrialPending { svn: SVN }) + ); + session.confirm().expect("trial pending"); + session.confirm().expect("already committed"); + assert_eq!(session.state(), Ok(SelfUpdateState::Committed { svn: SVN })); + } + + /// Dropping an update is allowed wherever it stands, including when + /// there is nothing to drop. + #[test] + fn reverting_succeeds_from_any_state() { + let mut session = MockSession::idle(); + session.revert().expect("idle"); + session.prepare(SVN).expect("store answers"); + session.revert().expect("prepared"); + assert_eq!(session.state(), Ok(SelfUpdateState::Idle)); + } + + /// `complete` is the commit path's ending and must not double as the + /// abandon path's, or a mistaken call would discard a pending trial. + #[test] + fn completing_a_pending_trial_fails() { + let mut session = MockSession::idle(); + session.prepare(SVN).expect("store answers"); + session.set_trial_pending().expect("prepared"); + assert_eq!(session.complete(), Err(MockFault)); + assert_eq!( + session.state(), + Ok(SelfUpdateState::TrialPending { svn: SVN }) + ); + } + + #[test] + fn arming_with_no_session_fails() { + let mut session = MockSession::idle(); + assert_eq!(session.set_trial_pending(), Err(MockFault)); + assert_eq!(session.state(), Ok(SelfUpdateState::Idle)); + } + + #[test] + fn confirming_without_a_trial_fails() { + let mut session = MockSession::idle(); + assert_eq!(session.confirm(), Err(MockFault)); + + session.prepare(SVN).expect("store answers"); + assert_eq!(session.confirm(), Err(MockFault)); + assert_eq!(session.state(), Ok(SelfUpdateState::Prepared { svn: SVN })); + } + + #[test] + fn a_store_that_faults_surfaces_the_error() { + let mut session = MockSession::faulty(); + assert_eq!(session.state(), Err(MockFault)); + assert_eq!(session.running(), Err(MockFault)); + assert_eq!(session.prepare(SVN), Err(MockFault)); + assert_eq!(session.set_trial_pending(), Err(MockFault)); + assert_eq!(session.confirm(), Err(MockFault)); + assert_eq!(session.complete(), Err(MockFault)); + assert_eq!(session.revert(), Err(MockFault)); + } + + #[test] + fn reports_no_session_when_nothing_is_in_flight() { + assert_eq!( + trial_outcome(SelfUpdateState::Idle, RunningImage::Confirmed), + TrialOutcome::NoSession + ); + } + + /// The session was dropped while a trial image is the one running, so + /// nothing records what it was for. + #[test] + fn reports_a_trial_image_with_no_session_unconfirmed() { + assert_eq!( + trial_outcome(SelfUpdateState::Idle, RunningImage::Trial), + TrialOutcome::Unconfirmed + ); + } + + /// Crashed after writing the session, before the reset that would have + /// started the trial. + #[test] + fn reports_a_session_that_never_booted_unconfirmed() { + assert_eq!( + trial_outcome( + SelfUpdateState::Prepared { svn: SVN }, + RunningImage::Confirmed + ), + TrialOutcome::Unconfirmed + ); + } + + /// A trial booted while the session still reads Prepared, the other side + /// of the record-then-mark rule. + #[test] + fn reports_a_trial_ahead_of_its_session_unconfirmed() { + assert_eq!( + trial_outcome(SelfUpdateState::Prepared { svn: SVN }, RunningImage::Trial), + TrialOutcome::Unconfirmed + ); + } + + /// The boot that is running is the trial itself, on a selector that + /// consumes the pending mark and on one that holds it alike. + #[test] + fn reports_the_running_trial_in_progress() { + assert_eq!( + trial_outcome( + SelfUpdateState::TrialPending { svn: SVN }, + RunningImage::Trial + ), + TrialOutcome::InProgress + ); + } + + /// The trial booted and the platform fell back, so nothing confirmed it. + #[test] + fn reports_a_trial_that_fell_back_unconfirmed() { + assert_eq!( + trial_outcome( + SelfUpdateState::TrialPending { svn: SVN }, + RunningImage::Confirmed + ), + TrialOutcome::Unconfirmed + ); + } + + /// Crashed between `confirm` and the floor advance: the one case that + /// commits rather than drops, and the reason the session carries a state + /// and not only an SVN. + #[test] + fn reports_a_confirmed_trial_whose_floor_is_unmoved() { + for running in [RunningImage::Trial, RunningImage::Confirmed] { + assert_eq!( + trial_outcome(SelfUpdateState::Committed { svn: SVN }, running), + TrialOutcome::ConfirmedUncommitted { svn: SVN } + ); + } + } +} diff --git a/services/orchestrator/capabilities/src/svn_floor.rs b/services/orchestrator/capabilities/src/svn_floor.rs index 233d59f73..168e920a7 100644 --- a/services/orchestrator/capabilities/src/svn_floor.rs +++ b/services/orchestrator/capabilities/src/svn_floor.rs @@ -14,7 +14,7 @@ pub struct Svn(pub u32); /// fuse counters, a monotonic counter in protected flash, a mock in tests — /// is the implementor's concern; its encoding (e.g. unary fuse bits) never /// leaks through this seam. Devices that keep their own floor (a PLDM -/// firmware device commits internally) have no `SvnFloor` on the eRoT side. +/// Firmware Device commits internally) have no `SvnFloor` on the eRoT side. /// /// The orchestrator advances the floor only after an activated image proved /// itself at runtime (`BootConfirmed`), never on activation alone, so a bad diff --git a/services/orchestrator/capabilities/src/updatable.rs b/services/orchestrator/capabilities/src/updatable.rs index b68693e6c..7cd788db6 100644 --- a/services/orchestrator/capabilities/src/updatable.rs +++ b/services/orchestrator/capabilities/src/updatable.rs @@ -3,6 +3,9 @@ //! The [`Updatable`] update capability contract. +use crate::Progress; +use util_io::{ByteReadError, ByteSource}; + /// Update capability: stage a payload on one managed device and mark the /// staged image as its boot candidate. /// @@ -19,22 +22,25 @@ /// that an update runs; the driver owns the adapter, polls the transfer /// on its own clock, and reports the outcome back as an event. The /// update source that delivered the payload fills what backs -/// [`PayloadSource`] and never drives the device. +/// [`ByteSource`] and never drives the device. +/// +/// What this trait does not claim: +/// +/// Verification belongs to the crypto service: the orchestrator +/// commands it to start, but never reads flash or runs hash steps. +/// Post-write readback is no capability either: it is the +/// implementor's staging discipline (see `Ready` below). /// -/// What this trait deliberately does not claim: +/// Activation is always tentative: it proposes the staged image as +/// the preferred boot target, never commits it. The commit gate is +/// the orchestrator's confirmed-boot flow (`BootConfirmed` gating +/// `SvnFloor::advance`, or the device committing internally); there +/// is no second slot-selection owner. /// -/// - **Verification** runs on the candidate before staging as -/// orchestrator policy. Post-write readback is no capability either: -/// it is the implementor's staging discipline (see `Ready` below). -/// - **Commit.** Activation is always tentative: it proposes the staged -/// image as the preferred boot target, never commits it. The commit -/// gate is the orchestrator's confirmed-boot flow (`BootConfirmed` -/// gating `SvnFloor::advance`, or the device committing internally); -/// there is no second slot-selection owner. -/// - **Booting.** Resetting the device into the candidate is -/// [`BootControl`](crate::BootControl). When activation takes effect -/// (next reset, or a device-internal restart on self-activating -/// devices) is device-defined; sequencing belongs to the flows. +/// Resetting the device into the candidate is +/// [`BootControl`](crate::BootControl). When activation takes effect +/// (next reset, or a device-internal restart on self-activating +/// devices) is device-defined; sequencing belongs to the flows. /// /// # Contract /// @@ -57,7 +63,7 @@ /// verified to its archetype's discipline: a direct-flash adapter /// reads written data back and re-verifies before reporting `Ready`, /// a PLDM device runs its own verify step after the transfer: -/// `FdOps::verify` in pldm-lib, reported to the update agent as +/// `FdOps::verify` in pldm-lib, reported to the Update Agent as /// `VerifyComplete`. A mismatch fails the step as /// [`ReadbackMismatch`](UpdateError::ReadbackMismatch), kept apart /// from [`Device`](UpdateError::Device) so a caller can retire a slot @@ -91,7 +97,7 @@ pub trait Updatable { /// `BootWatch`. /// /// [`Ready`]: StageProgress::Ready - fn poll_stage(&mut self, payload: &dyn PayloadSource) -> Result; + fn poll_stage(&mut self, payload: &dyn ByteSource) -> Result; /// Discards the in-progress transfer or staged, unactivated payload. /// @@ -117,17 +123,11 @@ pub trait Updatable { /// breaking change, so every consumer handles it explicitly. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum StageProgress { - /// Transfer ongoing; poll again. `written`/`total` bytes feed the Update - /// Source's progress report. - Transferring { - /// Bytes written to the device so far. Monotonic and below `total`, - /// but free to hold still across calls (busy device, - /// retransmit); a caller deciding when a transfer has stalled - /// keys on this value. - written: u64, - /// Total payload bytes. - total: u64, - }, + /// Transfer ongoing; poll again. The byte counts feed the Update + /// Source's progress report. `written` is bytes written to the device, + /// free to hold still across calls (busy device, retransmit); a + /// caller deciding when a transfer has stalled keys on that value. + Transferring { progress: Progress }, /// The device holds the complete, verified payload; `activate` may /// be called. Ready, @@ -145,7 +145,7 @@ pub enum UpdateError { /// A payload read failed. Carries the read fault, so out-of-range /// (a bug on the pulling side) stays distinct from storage (maybe /// transient). - Payload(PayloadReadError), + Payload(ByteReadError), /// The device failed or refused the step; staging anew may succeed. Device, /// Written data did not read back as written. Distinct from @@ -186,77 +186,32 @@ impl core::error::Error for UpdateError { } } -/// Chunked, random-access read seam [`Updatable::poll_stage`] pulls from. -/// -/// The candidate payload is streamed and never RAM-resident; -/// this is the window a device adapter reads it through. Where the bytes -/// live — frontend staging flash, a mapped blob, a test slice — stays -/// behind the source. -pub trait PayloadSource { - /// Total payload length in bytes, constant for the lifetime of the - /// source: adapters allocate staging buffers from it and treat the - /// transfer as complete once this many bytes are written. - fn len(&self) -> u64; - - /// True if the payload is empty. - fn is_empty(&self) -> bool { - self.len() == 0 - } - - /// Fills `buf` from `offset`. The read is exact: short fills are a - /// fault, and `offset + buf.len()` beyond [`len`](Self::len) is out - /// of range. There are no partial reads: the length is known up - /// front, so a short read can only mean the source cannot serve - /// what `len` promised, and a partial-read API would put a retry - /// loop into every adapter. - fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<(), PayloadReadError>; -} - -/// Why a payload read failed — the one distinction retry policy needs. -/// -/// No further detail crosses the seam (mirroring `BootWatch`): the source -/// logs the concrete cause while it is still in scope. -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum PayloadReadError { - /// The requested range is outside the payload — a caller bug, never - /// retriable. - OutOfRange, - /// The backing storage failed the read — possibly transient; staging - /// anew may succeed. - Storage, -} - -impl core::fmt::Display for PayloadReadError { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.write_str(match self { - PayloadReadError::OutOfRange => "payload read out of range", - PayloadReadError::Storage => "payload storage fault", - }) +impl From for UpdateError { + fn from(e: ByteReadError) -> Self { + Self::Payload(e) } } -impl core::error::Error for PayloadReadError {} - #[cfg(test)] mod tests { use super::*; use core::error::Error as _; - // A PayloadSource over a plain slice — the seam must be satisfiable + // A ByteSource over a plain slice — the seam must be satisfiable // with no storage stack at all. struct SliceSource(&'static [u8]); - impl PayloadSource for SliceSource { + impl ByteSource for SliceSource { fn len(&self) -> u64 { self.0.len() as u64 } - fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<(), PayloadReadError> { - let start = usize::try_from(offset).map_err(|_| PayloadReadError::OutOfRange)?; + fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<(), ByteReadError> { + let start = usize::try_from(offset).map_err(|_| ByteReadError::OutOfRange)?; let end = start .checked_add(buf.len()) - .ok_or(PayloadReadError::OutOfRange)?; - buf.copy_from_slice(self.0.get(start..end).ok_or(PayloadReadError::OutOfRange)?); + .ok_or(ByteReadError::OutOfRange)?; + buf.copy_from_slice(self.0.get(start..end).ok_or(ByteReadError::OutOfRange)?); Ok(()) } } @@ -286,10 +241,7 @@ mod tests { } impl Updatable for MockDevice { - fn poll_stage( - &mut self, - payload: &dyn PayloadSource, - ) -> Result { + fn poll_stage(&mut self, payload: &dyn ByteSource) -> Result { if payload.is_empty() { return Err(UpdateError::EmptyPayload); } @@ -313,8 +265,10 @@ mod tests { Ok(StageProgress::Ready) } else { Ok(StageProgress::Transferring { - written: self.count as u64, - total: total as u64, + progress: Progress { + written: self.count as u64, + total: total as u64, + }, }) } } @@ -336,7 +290,7 @@ mod tests { /// Polls to completion — the orchestrator's staging loop shape, /// written against the erased seam. - fn stage_all(dev: &mut dyn Updatable, payload: &dyn PayloadSource) -> Result<(), UpdateError> { + fn stage_all(dev: &mut dyn Updatable, payload: &dyn ByteSource) -> Result<(), UpdateError> { loop { if let StageProgress::Ready = dev.poll_stage(payload)? { return Ok(()); @@ -365,8 +319,10 @@ mod tests { assert_eq!( dev.poll_stage(&payload), Ok(StageProgress::Transferring { - written: pulled, - total: payload.len(), + progress: Progress { + written: pulled, + total: payload.len() + } }) ); pulled += MOCK_STEP as u64; @@ -380,12 +336,12 @@ mod tests { // Claims more bytes than it can serve — the adapter's pull runs // past the real end and must surface the fault. - impl PayloadSource for Lying { + impl ByteSource for Lying { fn len(&self) -> u64 { 8 } - fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<(), PayloadReadError> { + fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<(), ByteReadError> { SliceSource(b"shrt").read_at(offset, buf) } } @@ -394,7 +350,7 @@ mod tests { let err = stage_all(&mut dev, &Lying).expect_err("expected the pull fault"); - assert_eq!(err, UpdateError::Payload(PayloadReadError::OutOfRange)); + assert_eq!(err, UpdateError::Payload(ByteReadError::OutOfRange)); // The cause chain carries the fault, per the UpdateError impl. assert!(err.source().is_some()); @@ -416,8 +372,10 @@ mod tests { assert_eq!( dev.poll_stage(&payload), Ok(StageProgress::Transferring { - written: MOCK_STEP as u64, - total: payload.len(), + progress: Progress { + written: MOCK_STEP as u64, + total: payload.len() + } }) ); } @@ -447,13 +405,15 @@ mod tests { impl Updatable for BusyDevice { fn poll_stage( &mut self, - payload: &dyn PayloadSource, + payload: &dyn ByteSource, ) -> Result { self.busy = !self.busy; if self.busy { return Ok(StageProgress::Transferring { - written: self.inner.count as u64, - total: payload.len(), + progress: Progress { + written: self.inner.count as u64, + total: payload.len(), + }, }); } self.inner.poll_stage(payload) @@ -481,7 +441,9 @@ mod tests { loop { match dev.poll_stage(&payload).expect("staging failed") { StageProgress::Ready => break, - StageProgress::Transferring { written, .. } => { + StageProgress::Transferring { + progress: Progress { written, .. }, + } => { if written > last_written { last_written = written; stalled_polls = 0; @@ -502,7 +464,7 @@ mod tests { // picks, including a retransmit. Out-of-range reads are a fault, so // the adapter clamps the device's last request to the payload end. // A finished transfer does not mean `Ready`: the device runs its own - // verify first, one further step, the way a PLDM firmware device + // verify first, one further step, the way a PLDM Firmware Device // enters VERIFY and reports the outcome in `VerifyComplete`. const PLDM_CHUNK: usize = 3; @@ -530,10 +492,7 @@ mod tests { } impl Updatable for MockPldmDevice { - fn poll_stage( - &mut self, - payload: &dyn PayloadSource, - ) -> Result { + fn poll_stage(&mut self, payload: &dyn ByteSource) -> Result { if payload.is_empty() { return Err(UpdateError::EmptyPayload); } @@ -559,9 +518,7 @@ mod tests { self.offset }; let len = PLDM_CHUNK.min(total - request); - payload - .read_at(request as u64, &mut self.staged[request..request + len]) - .map_err(UpdateError::Payload)?; + payload.read_at(request as u64, &mut self.staged[request..request + len])?; if request == self.offset { self.offset += len; } @@ -569,8 +526,10 @@ mod tests { self.verifying = true; } Ok(StageProgress::Transferring { - written: self.offset as u64, - total: total as u64, + progress: Progress { + written: self.offset as u64, + total: total as u64, + }, }) } @@ -602,23 +561,29 @@ mod tests { assert_eq!( dev.poll_stage(&payload), Ok(StageProgress::Transferring { - written: chunk, - total + progress: Progress { + written: chunk, + total + } }) ); assert_eq!( dev.poll_stage(&payload), Ok(StageProgress::Transferring { - written: 2 * chunk, - total, + progress: Progress { + written: 2 * chunk, + total + } }) ); // The retransmit step pulls again but holds `written` still. assert_eq!( dev.poll_stage(&payload), Ok(StageProgress::Transferring { - written: 2 * chunk, - total, + progress: Progress { + written: 2 * chunk, + total + } }) ); // The short last chunk completes the transfer. Still not `Ready`: @@ -626,8 +591,10 @@ mod tests { assert_eq!( dev.poll_stage(&payload), Ok(StageProgress::Transferring { - written: total, - total + progress: Progress { + written: total, + total + } }) ); // The verify step earns `Ready`. @@ -679,10 +646,7 @@ mod tests { } impl Updatable for MockFlashDevice { - fn poll_stage( - &mut self, - payload: &dyn PayloadSource, - ) -> Result { + fn poll_stage(&mut self, payload: &dyn ByteSource) -> Result { if payload.is_empty() { return Err(UpdateError::EmptyPayload); } @@ -708,8 +672,10 @@ mod tests { Ok(StageProgress::Ready) } else { Ok(StageProgress::Transferring { - written: self.count as u64, - total: total as u64, + progress: Progress { + written: self.count as u64, + total: total as u64, + }, }) }; } @@ -718,15 +684,15 @@ mod tests { self.slot[sector * FLASH_SECTOR..(sector + 1) * FLASH_SECTOR].fill(0xff); self.erased[sector] = true; return Ok(StageProgress::Transferring { - written: self.count as u64, - total: total as u64, + progress: Progress { + written: self.count as u64, + total: total as u64, + }, }); } let end = (self.count + FLASH_PAGE).min(total); let mut page = vec![0; end - self.count]; - payload - .read_at(self.count as u64, &mut page) - .map_err(UpdateError::Payload)?; + payload.read_at(self.count as u64, &mut page)?; self.slot[self.count..end].copy_from_slice(&page); if self.corrupt_next_write { self.corrupt_next_write = false; @@ -737,8 +703,10 @@ mod tests { expected: page, }); Ok(StageProgress::Transferring { - written: self.count as u64, - total: total as u64, + progress: Progress { + written: self.count as u64, + total: total as u64, + }, }) } @@ -783,7 +751,9 @@ mod tests { for written in expected { assert_eq!( dev.poll_stage(&payload), - Ok(StageProgress::Transferring { written, total }) + Ok(StageProgress::Transferring { + progress: Progress { written, total } + }) ); } // The final readback completes staging. @@ -803,7 +773,7 @@ mod tests { let flash_payload = SliceSource(b"8 bytes!"); let pldm_payload = SliceSource(b"chunked"); - let fleet: [(&mut dyn Updatable, &dyn PayloadSource); 2] = + let fleet: [(&mut dyn Updatable, &dyn ByteSource); 2] = [(&mut flash, &flash_payload), (&mut pldm, &pldm_payload)]; for (dev, payload) in fleet { stage_all(dev, payload).expect("staging failed"); diff --git a/services/orchestrator/config/BUILD.bazel b/services/orchestrator/config/BUILD.bazel index 55ad6b8d6..830a5040a 100644 --- a/services/orchestrator/config/BUILD.bazel +++ b/services/orchestrator/config/BUILD.bazel @@ -5,13 +5,26 @@ load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") rust_library( name = "orchestrator_config", - srcs = ["src/lib.rs"], + srcs = [ + "src/chain.rs", + "src/checkpoint.rs", + "src/device.rs", + "src/layout.rs", + "src/lib.rs", + "src/record.rs", + ], edition = "2024", visibility = ["//visibility:public"], + deps = [ + "//services/orchestrator/sm:orchestrator_sm", + ], ) # Host tests: build on the host platform, no kernel/QEMU. rust_test( name = "orchestrator_config_test", crate = ":orchestrator_config", + deps = [ + "@rust_crates//:heapless", + ], ) diff --git a/services/orchestrator/config/src/chain.rs b/services/orchestrator/config/src/chain.rs new file mode 100644 index 000000000..e4388d727 --- /dev/null +++ b/services/orchestrator/config/src/chain.rs @@ -0,0 +1,185 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The views the orchestrator and the platform driver take of the device +//! table. Both are derived here, so the table is the only place a board +//! states what its components are. + +use crate::device::DeviceConfig; +use openprot_orchestrator_sm::{ComponentAttrs, ComponentId, ComponentKind}; + +/// The entries `chain_of` validated. The field is private, so the only +/// constructor is the const-validated path and holders can trust the +/// invariants without rechecking. +pub struct ChainEntries([(ComponentId, ComponentAttrs); N]); + +impl ChainEntries { + /// The validated entries, one per device in table order. + pub const fn entries(&self) -> &[(ComponentId, ComponentAttrs); N] { + &self.0 + } +} + +/// Table order assigns the ids: `devices[i]` is `ComponentId::new(i)`. The +/// board's per-component arrays are indexed the same way, so the table is +/// also what keeps those arrays lined up with the chain. +/// +/// The first entry has to be the eRoT, and no other entry may be one. The +/// walk steps past an `Erot` component, so the skipped index is the one the +/// board's arrays reserve for the eRoT. A table that puts the eRoT anywhere +/// else, or leaves it out, lines those arrays up against the wrong +/// components, and nothing downstream would catch it. +/// +/// # Panics +/// +/// Panics, a build error in const context, if the table is empty or holds +/// more than `u8::MAX` devices (`Chain` takes neither), if a `depends_on` +/// names anything other than an earlier device in the table, if +/// `devices[0]` is not the eRoT, or if a later entry is also an eRoT. +#[must_use] +pub const fn chain_of(devices: &[DeviceConfig; N]) -> ChainEntries { + assert!(N > 0, "a device table needs at least one device"); + assert!( + N <= u8::MAX as usize, + "a device table holds at most u8::MAX devices" + ); + assert!( + matches!(devices[0].attrs().kind, ComponentKind::Erot), + "the first device in the table must be the eRoT" + ); + let mut i = 1; + while i < N { + assert!( + !matches!(devices[i].attrs().kind, ComponentKind::Erot), + "only the first device in the table may be the eRoT" + ); + i += 1; + } + + let mut i = 0; + while i < N { + if let Some(on) = devices[i].attrs().depends_on { + let on = on.get() as usize; + assert!( + on < i, + "depends_on must name an earlier device in the table" + ); + } + i += 1; + } + + // Const arrays need a default; the loop below overwrites every element. + let mut chain = [(ComponentId::new(0), ComponentAttrs::passive_required()); N]; + let mut i = 0; + while i < N { + chain[i] = (ComponentId::new(i as u8), devices[i].attrs()); + i += 1; + } + ChainEntries(chain) +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::checkpoint::BootCheckpoint; + use core::time::Duration; + use openprot_orchestrator_sm::{Chain, FailurePolicy}; + + const C0: ComponentId = ComponentId::new(0); + const C1: ComponentId = ComponentId::new(1); + const C2: ComponentId = ComponentId::new(2); + const C4: ComponentId = ComponentId::new(4); + + const CP: BootCheckpoint = BootCheckpoint::new("up", 1, Duration::from_millis(10)); + + const fn dev(attrs: ComponentAttrs) -> DeviceConfig { + DeviceConfig::new("dev", 0, &[CP], None, attrs) + } + + /// Every valid table starts with the eRoT, so the tests below prepend + /// this to whatever they are actually checking. + const fn erot() -> DeviceConfig { + DeviceConfig::erot("erot", None) + } + + #[test] + fn ids_come_from_table_order() { + let table = [ + erot(), + dev(ComponentAttrs::passive_required()), + dev(ComponentAttrs::active_isolable()), + ]; + let validated = chain_of(&table); + let entries = validated.entries(); + + assert_eq!(entries[0].0, C0); + assert_eq!(entries[0].1.kind, ComponentKind::Erot); + assert_eq!(entries[1].0, C1); + assert_eq!(entries[2].0, C2); + assert_eq!(entries[2].1.failure_policy, FailurePolicy::Isolable); + } + + #[test] + #[should_panic(expected = "the first device in the table must be the eRoT")] + fn rejects_a_table_that_does_not_start_with_the_erot() { + let _ = chain_of(&[dev(ComponentAttrs::passive_required()), erot()]); + } + + #[test] + #[should_panic(expected = "only the first device in the table may be the eRoT")] + fn rejects_a_second_erot() { + let _ = chain_of(&[erot(), erot()]); + } + + #[test] + fn the_derived_chain_is_one_the_machine_accepts() { + let table = [ + erot(), + dev(ComponentAttrs::passive_required()), + dev(ComponentAttrs::active_isolable()), + ]; + let validated = chain_of(&table); + let entries: heapless::Vec<_, 3> = + heapless::Vec::from_slice(validated.entries()).expect("same length as the table"); + + assert!(Chain::<3>::try_from(entries).is_ok()); + } + + #[test] + #[should_panic(expected = "at least one device")] + fn rejects_an_empty_table() { + let table: [DeviceConfig; 0] = []; + let _ = chain_of(&table); + } + + #[test] + #[should_panic(expected = "at most u8::MAX")] + fn rejects_a_table_longer_than_the_chain_takes() { + let table = [dev(ComponentAttrs::passive_required()); 256]; + let _ = chain_of(&table); + } + + #[test] + #[should_panic(expected = "depends_on must name an earlier device")] + fn rejects_a_dependency_outside_the_table() { + let mut attrs = ComponentAttrs::passive_required(); + attrs.depends_on = Some(C4); + let _ = chain_of(&[erot(), dev(attrs)]); + } + + #[test] + #[should_panic(expected = "depends_on must name an earlier device")] + fn rejects_a_self_dependency() { + let mut attrs = ComponentAttrs::passive_required(); + attrs.depends_on = Some(C1); + let _ = chain_of(&[erot(), dev(attrs)]); + } + + #[test] + #[should_panic(expected = "depends_on must name an earlier device")] + fn rejects_a_forward_dependency() { + let mut first = ComponentAttrs::passive_required(); + first.depends_on = Some(C2); + let _ = chain_of(&[erot(), dev(first), dev(ComponentAttrs::passive_required())]); + } +} diff --git a/services/orchestrator/config/src/checkpoint.rs b/services/orchestrator/config/src/checkpoint.rs new file mode 100644 index 000000000..08cd132d4 --- /dev/null +++ b/services/orchestrator/config/src/checkpoint.rs @@ -0,0 +1,157 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Boot checkpoints: what the orchestrator probes, and how long it waits. + +/// One boot checkpoint: a probe the orchestrator evaluates, and how long +/// it waits. Retry policy is deliberately not table data: a retry +/// re-resets the device and re-runs the whole walk, so budgets are +/// per boot attempt and owned by the orchestrator state machine. +/// +/// The probe is board-defined, the schema attaches no meaning to it and +/// names no probe kinds. Each board defines its own vocabulary (a small +/// enum: a GPIO line, a progress-register threshold, a message-path +/// readiness) and gives it meaning in its `EvidenceReader`. The probe is +/// a defunctionalized evidence check: data in the table instead of a +/// function, so the table stays printable, comparable, const-checkable, +/// and could one day be generated instead of written. +/// +/// Fields are private so a checkpoint that violates the schema is +/// unrepresentable: [`new`](Self::new) is the only way in, and it checks. +/// +/// # Example: three GPIO checkpoints +/// +/// A BMC behind three GPIO ready lines (bl1 on pin 4, kernel on pin 5, +/// service on pin 6), all on the same SGPIOM bank. Each probe variant +/// maps to one `GpioBootMonitor` in the board's `EvidenceReader`, and +/// the walker (`CheckpointWalk`) walks them in declaration order. +/// +/// ```ignore +/// #[derive(Debug, Clone, Copy)] +/// enum BmcProbe { Bl1, Kernel, Service } +/// +/// const BMC: DeviceConfig = DeviceConfig::new( +/// "bmc", 0, +/// &[ +/// BootCheckpoint::new("bl1", BmcProbe::Bl1, Duration::from_millis(500)), +/// BootCheckpoint::new("kernel", BmcProbe::Kernel, Duration::from_secs(5)), +/// BootCheckpoint::new("service", BmcProbe::Service, Duration::from_secs(30)), +/// ], +/// None, +/// ); +/// +/// // Pin binding at bring-up: one GpioBootMonitor per probe. +/// let bl1 = GpioBootMonitor::new(&sgpiom, Mask(1 << 4), ActivePolarity::ActiveHigh); +/// let kernel = GpioBootMonitor::new(&sgpiom, Mask(1 << 5), ActivePolarity::ActiveHigh); +/// let service = GpioBootMonitor::new(&sgpiom, Mask(1 << 6), ActivePolarity::ActiveHigh); +/// +/// // The board's EvidenceReader dispatches probe to monitor. +/// // See EvidenceReader's docs for the full impl pattern. +/// let bmc_walk = CheckpointWalk::new(bmc_reader, &BMC); +/// ``` +/// +/// The GPIO wiring above is illustrative only (`ignore`d: this crate is +/// deliberately dependency-free, so it can't compile against +/// `GpioBootMonitor`/`CheckpointWalk`, which live downstream). The part of +/// the shape this crate *can* check — declaring a checkpoint list and +/// building a table from it — is a real, compiled example: +/// +/// ```rust +/// use orchestrator_config::{BootCheckpoint, DeviceConfig}; +/// use core::time::Duration; +/// +/// const CHECKPOINTS: &[BootCheckpoint] = &[ +/// BootCheckpoint::new("bl1", 0, Duration::from_millis(500)), +/// BootCheckpoint::new("kernel", 1, Duration::from_secs(5)), +/// ]; +/// const BMC: DeviceConfig = DeviceConfig::new("bmc", 0, CHECKPOINTS, None); +/// +/// assert_eq!(BMC.checkpoints().len(), 2); +/// assert_eq!(BMC.checkpoints()[0].name(), "bl1"); +/// ``` +#[derive(Debug, Clone, Copy)] +pub struct BootCheckpoint

{ + name: &'static str, + probe: P, + timeout: core::time::Duration, +} + +impl

BootCheckpoint

{ + /// Declares a checkpoint. `const`, so board tables run the checks at + /// build time. + /// + /// # Panics + /// + /// Panics, a build error in const context, if `name` is empty or + /// `timeout` is shorter than 1 ms (the walk rounds to whole + /// milliseconds, so a sub-millisecond window would silently become + /// zero). + #[must_use] + pub const fn new(name: &'static str, probe: P, timeout: core::time::Duration) -> Self { + assert!(!name.is_empty(), "checkpoint name must not be empty"); + assert!( + timeout.as_millis() >= 1, + "checkpoint timeout must be at least 1 ms" + ); + Self { + name, + probe, + timeout, + } + } + + /// Names the checkpoint in failure reports ("bl1", "kernel", ...). + /// Unique within a device's checkpoint list. + #[must_use] + pub const fn name(&self) -> &'static str { + self.name + } + + /// Board-defined probe, resolved by the board's `EvidenceReader` + /// (in `orchestrator-capabilities`). Data rather than a function, so + /// the table stays pure data, the type-level docs say why. + #[must_use] + pub const fn probe(&self) -> &P { + &self.probe + } + + /// Window for one attempt at this checkpoint. Expiry is the boot + /// walk's own judgment; hung devices report nothing. + /// + /// The orchestrator state machine never sees this value, it is + /// clockless. The walk consumes the windows and reports expiry as a + /// failed attempt; a component's whole boot timeout is nothing more + /// than its walk over these windows, in order. + #[must_use] + pub const fn timeout(&self) -> core::time::Duration { + self.timeout + } +} + +#[cfg(test)] +mod tests { + use super::*; + use core::time::Duration; + + // Board tables run the constructors at compile time, where a + // rejection is a build error nobody can assert on. These tests call + // them at runtime to prove the reject paths actually fire. + + #[test] + #[should_panic(expected = "checkpoint name must not be empty")] + fn rejects_an_empty_checkpoint_name() { + let _ = BootCheckpoint::new("", 0u8, Duration::from_secs(1)); + } + + #[test] + #[should_panic(expected = "checkpoint timeout must be at least 1 ms")] + fn rejects_a_zero_checkpoint_timeout() { + let _ = BootCheckpoint::new("boot-complete", 0u8, Duration::ZERO); + } + + #[test] + #[should_panic(expected = "checkpoint timeout must be at least 1 ms")] + fn rejects_a_sub_millisecond_checkpoint_timeout() { + let _ = BootCheckpoint::new("boot-complete", 0u8, Duration::from_micros(999)); + } +} diff --git a/services/orchestrator/config/src/device.rs b/services/orchestrator/config/src/device.rs new file mode 100644 index 000000000..31f53ed3e --- /dev/null +++ b/services/orchestrator/config/src/device.rs @@ -0,0 +1,316 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! One managed device: its checkpoints, its images, and its retry budget. + +use crate::checkpoint::BootCheckpoint; +use crate::layout::ImageLayout; +use openprot_orchestrator_sm::{ComponentAttrs, ComponentKind}; + +/// Fails the build if `max_retry` is too small for a device to boot every +/// image. Recovery restores one image per attempt, and the orchestrator +/// counts the restore before it decides whether to boot, so the last +/// restore it allows is never booted. A device with two slots and a golden +/// image therefore needs four attempts for the golden image to run, not +/// three. +/// +/// This is a floor, not the exact number. A board whose driver retries the +/// same image before stepping to the next one needs more attempts than +/// this. Devices with no layout are skipped, because the eRoT has no images +/// to step through for them. +/// +/// Boards call it from a const fence, so a budget that is too small fails +/// the build: +/// +/// ```ignore +/// const _: () = assert_retry_reaches_every_image(MAX_RETRY, DEVICES); +/// ``` +/// +/// # Panics +/// +/// Panics if `max_retry` is not greater than a device's image count. +pub const fn assert_retry_reaches_every_image(max_retry: u8, devices: &[DeviceConfig]) { + let mut i = 0; + while i < devices.len() { + // The eRoT is never recovered, so no retry budget has to reach its + // images. Counting it would let its slot count set MAX_RETRY for + // components recovery does visit. + if matches!(devices[i].attrs().kind, ComponentKind::Erot) { + i += 1; + continue; + } + if let Some(layout) = devices[i].layout() { + assert!( + max_retry as usize > layout.image_count(), + "max_retry is too small to boot every image of a device" + ); + } + i += 1; + } +} + +/// One managed downstream device, as declared by the board config. +/// +/// Generic over the board's reset signal type `R` (which must match the +/// `ResetId` of the reset controller behind the board's `BootControl` +/// implementation) and its boot-probe vocabulary `P`, for the same +/// reason: probes are board-specific. +/// +/// Says nothing about attestation or commit requirements: those follow from +/// what kind of device this is, which `attrs` carries, not from a second +/// table setting that could disagree with it. +/// +/// Fields are private so a device entry that violates the schema is +/// unrepresentable: [`new`](Self::new) is the only way in, and it checks. +#[derive(Debug, Clone, Copy)] +pub struct DeviceConfig { + name: &'static str, + /// `None` for a device the orchestrator never resets. Today that is + /// only the eRoT, which drives the reset lines and has none pointing + /// back at it. + reset_signal: Option, + checkpoints: &'static [BootCheckpoint

], + layout: Option, + attrs: ComponentAttrs, +} + +impl DeviceConfig { + /// Declares a managed device. `const`, so board tables run the checks + /// at build time. + /// + /// # Panics + /// + /// Panics — a build error in const context — if `name` is empty, if + /// `checkpoints` is empty, if two checkpoints share a name (failure + /// reports identify a checkpoint by name; a duplicate would make them + /// ambiguous). Layout rules are checked by [`ImageLayout::new`]. + #[must_use] + pub const fn new( + name: &'static str, + reset_signal: R, + checkpoints: &'static [BootCheckpoint

], + layout: Option, + attrs: ComponentAttrs, + ) -> Self { + assert!(!name.is_empty(), "device name must not be empty"); + assert!( + !checkpoints.is_empty(), + "device must declare at least one boot checkpoint" + ); + let mut c = 0; + while c < checkpoints.len() { + let mut d = c + 1; + while d < checkpoints.len() { + assert!( + !str_eq(checkpoints[c].name(), checkpoints[d].name()), + "checkpoint names must be unique per device" + ); + d += 1; + } + c += 1; + } + Self { + name, + reset_signal: Some(reset_signal), + checkpoints, + layout, + attrs, + } + } + + /// The eRoT itself, which goes at chain position 0. + /// + /// It gets no reset signal and no boot checkpoints, because the + /// orchestrator never releases or walks the component it is running on. + /// It does get a layout, because a self-update stages the new image + /// into the eRoT's own slots. + pub const fn erot(name: &'static str, layout: Option) -> Self { + assert!(!name.is_empty(), "device name must not be empty"); + Self { + name, + reset_signal: None, + checkpoints: &[], + layout, + attrs: ComponentAttrs::erot(), + } + } + + /// The orchestrator's per-component policy for this device. + #[must_use] + pub const fn attrs(&self) -> ComponentAttrs { + self.attrs + } + + /// The device's name in reports and logs. + #[must_use] + pub const fn name(&self) -> &'static str { + self.name + } + + /// Reset signal id, passed to HalBootControl::new. + #[must_use] + pub const fn reset_signal(&self) -> Option<&R> { + self.reset_signal.as_ref() + } + + /// Boot checkpoints, in the order the device passes them. The device + /// counts as booted when the last one is reached; a checkpoint whose + /// window expires fails the attempt — whether to retry or recover is + /// the orchestrator's decision, not table data. + /// + /// Empty for an eRoT entry, which [`erot`](Self::erot) builds without + /// the at-least-one checkpoint [`new`](Self::new) requires: nothing + /// walks the component the orchestrator runs on. + #[must_use] + pub const fn checkpoints(&self) -> &'static [BootCheckpoint

] { + self.checkpoints + } + + /// This device's images, when the eRoT owns its flash. `None` when the + /// device takes its own updates, where the eRoT never addresses a byte + /// range. + #[must_use] + pub const fn layout(&self) -> Option { + self.layout + } +} + +// `==` on `&str` is not const; compare bytes by hand. +const fn str_eq(a: &str, b: &str) -> bool { + let (a, b) = (a.as_bytes(), b.as_bytes()); + if a.len() != b.len() { + return false; + } + let mut i = 0; + while i < a.len() { + if a[i] != b[i] { + return false; + } + i += 1; + } + true +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::layout::{Golden, ImageLayout, Region, Slot, SlotId}; + use core::time::Duration; + + // Board tables run the constructors at compile time, where a + // rejection is a build error nobody can assert on. These tests call + // them at runtime to prove the reject paths actually fire. + + const BOOT_COMPLETE: BootCheckpoint = + BootCheckpoint::new("boot-complete", 0, Duration::from_secs(1)); + + // Same name, different signal: each checkpoint is individually valid, + // so the pair only trips the device-level duplicate check. + const BOOT_COMPLETE_DUPLICATE_NAME: BootCheckpoint = + BootCheckpoint::new("boot-complete", 1, Duration::from_secs(1)); + + /// Slots are one megabyte each; the values only have to be distinct + /// and non-overlapping. + const SLOT_LEN: u32 = 0x10_0000; + + /// An ordinary slot, placed by id so two of them never overlap by + /// accident. + const fn slot(id: u8) -> Slot { + Slot::new(SlotId(id), Region::new(id as u32 * SLOT_LEN, SLOT_LEN)) + } + + /// The golden image, above every slot `slot` can place. + const GOLDEN: Golden = Golden::new(Region::new(0xF000_0000, SLOT_LEN)); + + const ATTRS: ComponentAttrs = ComponentAttrs::passive_required(); + const LAYOUT: ImageLayout = ImageLayout::new(const { &[slot(0), slot(1)] }, Some(GOLDEN)); + + #[test] + #[should_panic(expected = "checkpoint names must be unique")] + fn rejects_duplicate_checkpoint_names() { + let _ = DeviceConfig::new( + "dev", + 0u8, + &[BOOT_COMPLETE, BOOT_COMPLETE_DUPLICATE_NAME], + None, + ATTRS, + ); + } + + #[test] + fn accepts_a_valid_table() { + let device = DeviceConfig::new("dev", 0u8, &[BOOT_COMPLETE], Some(LAYOUT), ATTRS); + assert_eq!(device.name(), "dev"); + assert_eq!(device.reset_signal(), Some(&0)); + assert_eq!(device.checkpoints().len(), 1); + assert_eq!(device.checkpoints()[0].name(), "boot-complete"); + assert_eq!(*device.checkpoints()[0].probe(), 0); + assert_eq!(device.checkpoints()[0].timeout(), Duration::from_secs(1)); + + let layout = device.layout().expect("declared above"); + assert_eq!(layout.slots().len(), 2); + assert_eq!(layout.slots()[1].region().base(), SLOT_LEN); + assert_eq!(layout.slots()[1].region().end(), 2 * SLOT_LEN); + assert_eq!( + layout.golden().expect("declared above").region().base(), + 0xF000_0000 + ); + } + + /// A device that owns its own images declares no layout at all, golden + /// included: the eRoT never addresses a byte range for it. + #[test] + fn accepts_a_device_without_a_layout() { + let device = DeviceConfig::new("dev", 0u8, &[BOOT_COMPLETE], None, ATTRS); + assert!(device.layout().is_none()); + } + + #[test] + #[should_panic(expected = "device name must not be empty")] + fn rejects_an_empty_device_name() { + let _ = DeviceConfig::new("", 0u8, &[BOOT_COMPLETE], None, ATTRS); + } + + #[test] + #[should_panic(expected = "at least one boot checkpoint")] + fn rejects_an_empty_checkpoint_list() { + let _ = DeviceConfig::new("dev", 0u8, &[] as &[BootCheckpoint], None, ATTRS); + } + + /// Two slots and a golden image need four attempts: three restores + /// plus the one the last restore would otherwise never get. + #[test] + fn accepts_a_retry_budget_that_boots_the_golden_image() { + const DEVICES: &[DeviceConfig] = &[DeviceConfig::new( + "dev", + 0, + &[BOOT_COMPLETE], + Some(LAYOUT), + ATTRS, + )]; + assert_retry_reaches_every_image(4, DEVICES); + } + + /// A device with no layout has no images to step through, so any + /// budget covers it. + #[test] + fn accepts_any_retry_budget_for_a_device_without_a_layout() { + const DEVICES: &[DeviceConfig] = + &[DeviceConfig::new("dev", 0, &[BOOT_COMPLETE], None, ATTRS)]; + assert_retry_reaches_every_image(0, DEVICES); + } + + #[test] + /// Three attempts restore the golden image and stop before booting it. + #[should_panic(expected = "max_retry is too small")] + fn rejects_a_retry_budget_that_never_boots_the_golden_image() { + const DEVICES: &[DeviceConfig] = &[DeviceConfig::new( + "dev", + 0, + &[BOOT_COMPLETE], + Some(LAYOUT), + ATTRS, + )]; + assert_retry_reaches_every_image(3, DEVICES); + } +} diff --git a/services/orchestrator/config/src/layout.rs b/services/orchestrator/config/src/layout.rs new file mode 100644 index 000000000..82aed96be --- /dev/null +++ b/services/orchestrator/config/src/layout.rs @@ -0,0 +1,347 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Where a device's images live: slots, the golden image, and the byte +//! ranges that hold them. + +/// Names one slot in one device's layout. The value is a name, not an +/// index: ids only have to be unique inside one layout, which +/// [`ImageLayout::new`] checks. They do not have to be in order, next to +/// each other, or start at zero, and slot 0 on the BMC has nothing to do +/// with slot 0 on the NIC. Recovery order comes from the order slots are +/// declared in, not from the id values. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct SlotId(pub u8); + +/// A byte range in the store that holds one device's images. Offsets are +/// counted from the start of that device's area, so the platform driver is +/// the one that knows which part holds it and where the area starts. +/// +/// Base and length describe any store the eRoT addresses directly. That is +/// flash today, and an EEPROM or a memory-mapped part would have the same +/// shape. An image with no address, streamed or held inside a self-updating +/// device, is not described this way. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct Region { + base: u32, + len: u32, +} + +impl Region { + /// Declares a region. Const, so a bad board table fails the build + /// instead of the boot. + /// + /// # Panics + /// + /// Panics if `len` is zero, or if `base + len` would run past the end + /// of the 32-bit offset range. + #[must_use] + pub const fn new(base: u32, len: u32) -> Self { + assert!(len > 0, "region length must not be zero"); + assert!( + base.checked_add(len).is_some(), + "region must not run past the end of the offset space" + ); + Self { base, len } + } + + /// Offset of the first byte, from the start of the device's firmware + /// partition. + #[must_use] + pub const fn base(&self) -> u32 { + self.base + } + + /// Length in bytes: how much the region holds, not the size of the + /// image now in it. + #[must_use] + pub const fn len(&self) -> u32 { + self.len + } + + /// Whether the region holds no bytes. + #[must_use] + pub const fn is_empty(&self) -> bool { + self.len == 0 + } + + /// Offset one past the last byte. + #[must_use] + pub const fn end(&self) -> u32 { + self.base + self.len + } + + /// Whether the two regions share a byte. + pub(crate) const fn overlaps(&self, other: &Region) -> bool { + self.base < other.end() && other.base < self.end() + } +} + +/// One slot in a device's layout. The number of slots is data, so a layout +/// is A/B, a single slot, or any other count depending on what the board +/// declares, and no layout shape is named in code. +/// +/// Every slot can be written and booted. The golden image can be neither, +/// and it is not a slot, so there is no flag to set and nothing to check. +#[derive(Debug, Clone, Copy)] +pub struct Slot { + id: SlotId, + region: Region, +} + +impl Slot { + /// Declares one slot. Const, so board tables still build at compile + /// time. Rules that cover a whole layout (unique ids, no overlap) are + /// checked by [`ImageLayout::new`], which sees the whole list. + #[must_use] + pub const fn new(id: SlotId, region: Region) -> Self { + Self { id, region } + } + + /// This slot's id, unique within the layout (checked by + /// [`ImageLayout::new`]). + #[must_use] + pub const fn id(&self) -> SlotId { + self.id + } + + /// Where this slot lives in the device's image store. + #[must_use] + pub const fn region(&self) -> Region { + self.region + } +} + +/// The golden image: the last image recovery falls back to, and the one +/// image the eRoT never writes. +/// +/// It is not a slot, so code that walks the slot list to pick a write +/// target, or to check the SVN floor, never sees it. The floor has to skip +/// it. A golden image's security version is fixed when the board is made, +/// so once the floor moves past that version, checking the floor would make +/// the last image that still boots unbootable. +/// +/// Skipping the floor is only safe while the image really cannot be +/// written, which the board has to guarantee in hardware: a write-protect +/// pin, a locked flash block, or a separate part. This crate cannot check +/// that. +#[derive(Debug, Clone, Copy)] +pub struct Golden { + region: Region, +} + +impl Golden { + /// Declares a layout's golden image. + #[must_use] + pub const fn new(region: Region) -> Self { + Self { region } + } + + /// Where the golden image lives in the device's image store. + #[must_use] + pub const fn region(&self) -> Region { + self.region + } +} + +/// Every image of one device that the eRoT can address: the slots it +/// writes, plus the golden image when there is one. Slots are declared in +/// recovery order: recovery tries them from top to bottom and falls back to +/// the golden image last. A board with plain A/B slots carries no golden +/// image, and recovery then stops after the last slot. +/// +/// A device has a layout when the eRoT owns its flash and writes its +/// images. A device that takes its own updates over PLDM and picks what it +/// boots has no layout, and the eRoT never names a byte range for it. That +/// is all [`DeviceConfig::layout`] being an `Option` says; how the eRoT +/// talks to such a device is decided elsewhere. +#[derive(Debug, Clone, Copy)] +pub struct ImageLayout { + slots: &'static [Slot], + golden: Option, +} + +impl ImageLayout { + /// Declares a device's images. Const, so a bad layout fails the + /// build. + /// + /// # Panics + /// + /// Panics if the layout holds no image, if two slots share an id, or + /// if two regions overlap, the golden image included. Overlapping + /// regions would let an update to one image corrupt another. + /// + /// The overlap check only covers addresses. Two regions that share a + /// flash erase block still wipe each other even though they do not + /// overlap, and this crate does not know the erase block size, so a + /// board checks that in its own const fence. + #[must_use] + pub const fn new(slots: &'static [Slot], golden: Option) -> Self { + assert!( + !slots.is_empty() || golden.is_some(), + "a layout must hold at least one image" + ); + let mut s = 0; + while s < slots.len() { + if let Some(golden) = golden { + assert!( + !slots[s].region.overlaps(&golden.region), + "a slot must not overlap the golden image" + ); + } + let mut t = s + 1; + while t < slots.len() { + assert!( + slots[s].id.0 != slots[t].id.0, + "slot ids must be unique within a layout" + ); + assert!( + !slots[s].region.overlaps(&slots[t].region), + "slots must not overlap" + ); + t += 1; + } + s += 1; + } + Self { slots, golden } + } + + /// The slots the eRoT writes, in declaration order. Empty when the + /// golden image is the device's only image. + #[must_use] + pub const fn slots(&self) -> &'static [Slot] { + self.slots + } + + /// The golden image, when the board has one. + #[must_use] + pub const fn golden(&self) -> Option { + self.golden + } + + /// How many images recovery can try: every slot, then the golden image + /// if there is one. + #[must_use] + pub const fn image_count(&self) -> usize { + self.slots.len() + self.golden.is_some() as usize + } +} + +#[cfg(test)] +mod tests { + use super::*; + + // Board tables run the constructors at compile time, where a + // rejection is a build error nobody can assert on. These tests call + // them at runtime to prove the reject paths actually fire. + + /// Slots are one megabyte each; the values only have to be distinct + /// and non-overlapping. + const SLOT_LEN: u32 = 0x10_0000; + + /// An ordinary slot, placed by id so two of them never overlap by + /// accident. + const fn slot(id: u8) -> Slot { + Slot::new(SlotId(id), Region::new(id as u32 * SLOT_LEN, SLOT_LEN)) + } + + /// The golden image, above every slot `slot` can place. + const GOLDEN: Golden = Golden::new(Region::new(0xF000_0000, SLOT_LEN)); + + const LAYOUT: ImageLayout = ImageLayout::new(const { &[slot(0), slot(1)] }, Some(GOLDEN)); + + /// The golden image may be a device's only image. + #[test] + fn accepts_a_layout_with_no_slots() { + let layout = ImageLayout::new(&[], Some(GOLDEN)); + assert!(layout.slots().is_empty()); + } + + #[test] + #[should_panic(expected = "slot ids must be unique")] + fn rejects_duplicate_slot_ids() { + let _ = ImageLayout::new( + const { + &[ + Slot::new(SlotId(0), Region::new(0, SLOT_LEN)), + Slot::new(SlotId(0), Region::new(SLOT_LEN, SLOT_LEN)), + ] + }, + Some(GOLDEN), + ); + } + + #[test] + #[should_panic(expected = "slots must not overlap")] + fn rejects_overlapping_slots() { + let _ = ImageLayout::new( + const { + &[ + Slot::new(SlotId(0), Region::new(0, SLOT_LEN)), + Slot::new(SlotId(1), Region::new(SLOT_LEN - 1, SLOT_LEN)), + ] + }, + Some(GOLDEN), + ); + } + + #[test] + #[should_panic(expected = "must not overlap the golden image")] + fn rejects_a_slot_overlapping_the_golden_image() { + let _ = ImageLayout::new( + const { &[Slot::new(SlotId(0), Region::new(0xF000_0000, SLOT_LEN))] }, + Some(GOLDEN), + ); + } + + /// Regions that touch do not overlap: `end` is one past the last + /// byte. + #[test] + fn accepts_adjacent_regions() { + let layout = ImageLayout::new( + const { + &[ + Slot::new(SlotId(0), Region::new(0, SLOT_LEN)), + Slot::new(SlotId(1), Region::new(SLOT_LEN, SLOT_LEN)), + ] + }, + Some(GOLDEN), + ); + assert_eq!( + layout.slots()[0].region().end(), + layout.slots()[1].region().base() + ); + } + + /// A board with plain A/B slots carries no golden image. + #[test] + fn accepts_slots_without_a_golden_image() { + let layout = ImageLayout::new(const { &[slot(0), slot(1)] }, None); + assert!(layout.golden().is_none()); + assert_eq!(layout.image_count(), 2); + } + + #[test] + #[should_panic(expected = "at least one image")] + fn rejects_a_layout_with_no_image() { + let _ = ImageLayout::new(&[], None); + } + + #[test] + fn counts_every_slot_and_the_golden_image() { + assert_eq!(LAYOUT.image_count(), 3); + assert_eq!(ImageLayout::new(&[], Some(GOLDEN)).image_count(), 1); + } + + #[test] + #[should_panic(expected = "region length must not be zero")] + fn rejects_a_zero_length_region() { + let _ = Region::new(0, 0); + } + + #[test] + #[should_panic(expected = "must not run past the end of the offset space")] + fn rejects_a_region_past_the_end_of_the_offset_space() { + let _ = Region::new(u32::MAX, 1); + } +} diff --git a/services/orchestrator/config/src/lib.rs b/services/orchestrator/config/src/lib.rs index dae78ac7d..509426f5f 100644 --- a/services/orchestrator/config/src/lib.rs +++ b/services/orchestrator/config/src/lib.rs @@ -12,229 +12,19 @@ #![cfg_attr(not(test), no_std)] -/// One boot checkpoint: a signal the orchestrator waits for, and how long -/// it waits. Retry policy is deliberately not table data: a retry -/// re-resets the device and re-runs the whole walk, so budgets are -/// per boot attempt and owned by the orchestrator state machine. -/// -/// The signal is a board-defined id — the schema attaches no meaning to -/// it and names no signal kinds. Each board defines its own vocabulary (a -/// small enum: a GPIO line, a progress-register threshold, a message-path -/// readiness) and gives it meaning in its `EvidenceReader`. The id is a -/// defunctionalized evidence check: data in the table instead of a -/// function, so the table stays printable, comparable, const-checkable — -/// and could one day be generated instead of written. -/// -/// Fields are private so a checkpoint that violates the schema is -/// unrepresentable: [`new`](Self::new) is the only way in, and it checks. -#[derive(Debug, Clone, Copy)] -pub struct BootCheckpoint { - name: &'static str, - signal: G, - timeout: core::time::Duration, -} - -impl BootCheckpoint { - /// Declares a checkpoint. `const`, so board tables run the checks at - /// build time. - /// - /// # Panics - /// - /// Panics — a build error in const context — if `name` is empty or - /// `timeout` is zero. - #[must_use] - pub const fn new(name: &'static str, signal: G, timeout: core::time::Duration) -> Self { - assert!(!name.is_empty(), "checkpoint name must not be empty"); - assert!(!timeout.is_zero(), "checkpoint timeout must not be zero"); - Self { - name, - signal, - timeout, - } - } - - /// Names the checkpoint in failure reports ("bl1", "kernel", …). - /// Unique within a device's checkpoint list. - #[must_use] - pub const fn name(&self) -> &'static str { - self.name - } - - /// Board-defined signal id, resolved by the board's `EvidenceReader` - /// (in `orchestrator-capabilities`). An id rather than a function, so - /// the table stays pure data — the type-level docs say why. - #[must_use] - pub const fn signal(&self) -> &G { - &self.signal - } - - /// Window for one attempt at this checkpoint. Expiry is the boot - /// walk's own judgment; hung devices report nothing. - /// - /// The orchestrator state machine never sees this value — it is - /// clockless. The walk consumes the windows and reports expiry as a - /// failed attempt; a component's whole boot timeout is nothing more - /// than its walk over these windows, in order. - #[must_use] - pub const fn timeout(&self) -> core::time::Duration { - self.timeout - } -} - -/// One managed downstream device, as declared by the board config. -/// -/// Generic over the board's reset signal type `R` (which must match the -/// `ResetId` of the reset controller behind the board's `BootControl` -/// implementation) and its boot-signal vocabulary `G`, for the same -/// reason: signal ids are board-specific. -/// -/// Deliberately says nothing about attestation or commit requirements: -/// those follow from what kind of device this is (iRoT-backed or -/// symbiont, the orchestrator's `ComponentKind`), not from a table -/// setting — a second knob would only let the two disagree. -/// -/// Fields are private so a device entry that violates the schema is -/// unrepresentable: [`new`](Self::new) is the only way in, and it checks. -#[derive(Debug, Clone, Copy)] -pub struct DeviceConfig { - name: &'static str, - reset_signal: R, - checkpoints: &'static [BootCheckpoint], -} - -impl DeviceConfig { - /// Declares a managed device. `const`, so board tables run the checks - /// at build time. - /// - /// # Panics - /// - /// Panics — a build error in const context — if `name` is empty, if - /// `checkpoints` is empty, or if two checkpoints share a name - /// (failure reports identify a checkpoint by name; a duplicate would - /// make them ambiguous). - #[must_use] - pub const fn new( - name: &'static str, - reset_signal: R, - checkpoints: &'static [BootCheckpoint], - ) -> Self { - assert!(!name.is_empty(), "device name must not be empty"); - assert!( - !checkpoints.is_empty(), - "device must declare at least one boot checkpoint" - ); - let mut c = 0; - while c < checkpoints.len() { - let mut d = c + 1; - while d < checkpoints.len() { - assert!( - !str_eq(checkpoints[c].name, checkpoints[d].name), - "checkpoint names must be unique per device" - ); - d += 1; - } - c += 1; - } - Self { - name, - reset_signal, - checkpoints, - } - } - - /// The device's name in reports and logs. - #[must_use] - pub const fn name(&self) -> &'static str { - self.name - } - - /// Reset signal id, passed to HalBootControl::new. - #[must_use] - pub const fn reset_signal(&self) -> &R { - &self.reset_signal - } - - /// Boot checkpoints, in the order the device passes them. The device - /// counts as booted when the last one is reached; a checkpoint whose - /// window expires fails the attempt — whether to retry or recover is - /// the orchestrator's decision, not table data. - #[must_use] - pub const fn checkpoints(&self) -> &'static [BootCheckpoint] { - self.checkpoints - } -} - -// `==` on `&str` is not const; compare bytes by hand. -const fn str_eq(a: &str, b: &str) -> bool { - let (a, b) = (a.as_bytes(), b.as_bytes()); - if a.len() != b.len() { - return false; - } - let mut i = 0; - while i < a.len() { - if a[i] != b[i] { - return false; - } - i += 1; - } - true -} - -#[cfg(test)] -mod tests { - use super::*; - use core::time::Duration; - - // Board tables run the constructors at compile time, where a - // rejection is a build error nobody can assert on. These tests call - // them at runtime to prove the reject paths actually fire. - - const CHECKPOINT: BootCheckpoint = - BootCheckpoint::new("boot-complete", 0, Duration::from_secs(1)); - - // Same name, different signal: each checkpoint is individually valid, - // so the pair only trips the device-level duplicate check. - const CHECKPOINT_DUP: BootCheckpoint = - BootCheckpoint::new("boot-complete", 1, Duration::from_secs(1)); - - #[test] - fn accepts_a_valid_table() { - let device = DeviceConfig::new("dev", 0u8, &[CHECKPOINT]); - assert_eq!(device.name(), "dev"); - assert_eq!(*device.reset_signal(), 0); - assert_eq!(device.checkpoints().len(), 1); - assert_eq!(device.checkpoints()[0].name(), "boot-complete"); - assert_eq!(*device.checkpoints()[0].signal(), 0); - assert_eq!(device.checkpoints()[0].timeout(), Duration::from_secs(1)); - } - - #[test] - #[should_panic(expected = "checkpoint names must be unique")] - fn rejects_duplicate_checkpoint_names() { - let _ = DeviceConfig::new("dev", 0u8, &[CHECKPOINT, CHECKPOINT_DUP]); - } - - #[test] - #[should_panic(expected = "device name must not be empty")] - fn rejects_an_empty_device_name() { - let _ = DeviceConfig::new("", 0u8, &[CHECKPOINT]); - } - - #[test] - #[should_panic(expected = "at least one boot checkpoint")] - fn rejects_an_empty_checkpoint_list() { - let _ = DeviceConfig::new("dev", 0u8, &[] as &[BootCheckpoint]); - } - - #[test] - #[should_panic(expected = "checkpoint name must not be empty")] - fn rejects_an_empty_checkpoint_name() { - let _ = BootCheckpoint::new("", 0u8, Duration::from_secs(1)); - } - - #[test] - #[should_panic(expected = "checkpoint timeout must not be zero")] - fn rejects_a_zero_checkpoint_timeout() { - let _ = BootCheckpoint::new("boot-complete", 0u8, Duration::ZERO); - } -} +pub mod chain; +pub mod checkpoint; +pub mod device; +pub mod layout; +pub mod record; + +#[doc(inline)] +pub use chain::{chain_of, ChainEntries}; +#[doc(inline)] +pub use checkpoint::BootCheckpoint; +#[doc(inline)] +pub use device::{assert_retry_reaches_every_image, DeviceConfig}; +#[doc(inline)] +pub use layout::{Golden, ImageLayout, Region, Slot, SlotId}; +#[doc(inline)] +pub use record::{RecordId, RecordLayout, RecordRegion}; diff --git a/services/orchestrator/config/src/record.rs b/services/orchestrator/config/src/record.rs new file mode 100644 index 000000000..de1082a86 --- /dev/null +++ b/services/orchestrator/config/src/record.rs @@ -0,0 +1,249 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The records the eRoT keeps across resets. + +use crate::layout::{ImageLayout, Region}; + +/// Names one record the eRoT keeps across resets. Like +/// [`SlotId`], the value is a name and not an index: ids only have to be +/// unique inside one [`RecordLayout`], and the board decides what each one +/// means. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct RecordId(pub u8); + +/// Where one eRoT-owned record lives: the SVN floor, the lockdown latch, a +/// pending-update record. A record is not an image, so it is never booted, +/// never recovered, and never described by an [`ImageLayout`]. +/// +/// The store has to be one only the eRoT can write. That is a hardware +/// property the board guarantees and this crate cannot check. +#[derive(Debug, Clone, Copy)] +pub struct RecordRegion { + id: RecordId, + region: Region, +} + +impl RecordRegion { + /// Declares where one record lives. Const, so a bad board table fails the + /// build. + #[must_use] + pub const fn new(id: RecordId, region: Region) -> Self { + Self { id, region } + } + + /// This region's id, unique within the layout (checked by + /// [`RecordLayout::new`]). + #[must_use] + pub const fn id(&self) -> RecordId { + self.id + } + + /// Where this record lives in the eRoT's store. + #[must_use] + pub const fn region(&self) -> Region { + self.region + } +} + +/// Every eRoT-owned record in one store, checked against each other and +/// against the images sharing that store. +/// +/// A layout describes one store. Pairing it with that store, and +/// guaranteeing that only the eRoT can write it, is board wiring this crate +/// cannot check. +/// +/// Offsets are counted from the start of the store, the same way +/// [`Region`] counts a device's images from the start of that device's +/// area. Records and images can only be compared when they are counted from +/// the same place, which is what the `images` argument of +/// [`new`](Self::new) says: pass the layout of the images in this store, +/// or `None` when the records have a store to themselves. +#[derive(Debug, Clone, Copy)] +pub struct RecordLayout { + regions: &'static [RecordRegion], +} + +impl RecordLayout { + /// Declares the records in one store. Const, so a board that puts the + /// SVN floor inside a slot fails the build instead of corrupting the + /// slot at the first commit. + /// + /// # Panics + /// + /// Panics if the layout is empty, if two regions share an id, if two + /// regions overlap, or if a region overlaps one of `images`. + /// + /// The overlap check only covers addresses. Two regions that share a + /// flash erase block still wipe each other, and this crate does not + /// know the erase block size, so a board checks that in its own const + /// fence. + #[must_use] + pub const fn new(regions: &'static [RecordRegion], images: Option) -> Self { + assert!(!regions.is_empty(), "a record layout must hold a record"); + let mut s = 0; + while s < regions.len() { + if let Some(images) = images { + let slots = images.slots(); + let mut i = 0; + while i < slots.len() { + assert!( + !regions[s].region.overlaps(&slots[i].region()), + "a record must not overlap a slot" + ); + i += 1; + } + if let Some(golden) = images.golden() { + assert!( + !regions[s].region.overlaps(&golden.region()), + "a record must not overlap the golden image" + ); + } + } + let mut t = s + 1; + while t < regions.len() { + assert!( + regions[s].id.0 != regions[t].id.0, + "record ids must be unique within a layout" + ); + assert!( + !regions[s].region.overlaps(®ions[t].region), + "records must not overlap" + ); + t += 1; + } + s += 1; + } + Self { regions } + } + + /// Where the named record lives, or `None` when the layout does not + /// declare it. + #[must_use] + pub const fn region(&self, id: RecordId) -> Option { + let mut s = 0; + while s < self.regions.len() { + if self.regions[s].id.0 == id.0 { + return Some(self.regions[s].region); + } + s += 1; + } + None + } + + /// Every region the layout declares, in declaration order. + #[must_use] + pub const fn regions(&self) -> &'static [RecordRegion] { + self.regions + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::layout::{Golden, Slot, SlotId}; + + // Board tables run the constructors at compile time, where a + // rejection is a build error nobody can assert on. These tests call + // them at runtime to prove the reject paths actually fire. + + /// Slots are one megabyte each; the values only have to be distinct + /// and non-overlapping. + const SLOT_LEN: u32 = 0x10_0000; + + /// An ordinary slot, placed by id so two of them never overlap by + /// accident. + const fn slot(id: u8) -> Slot { + Slot::new(SlotId(id), Region::new(id as u32 * SLOT_LEN, SLOT_LEN)) + } + + /// The golden image, above every slot `slot` can place. + const GOLDEN: Golden = Golden::new(Region::new(0xF000_0000, SLOT_LEN)); + + const LAYOUT: ImageLayout = ImageLayout::new(const { &[slot(0), slot(1)] }, Some(GOLDEN)); + + /// Records sit above every slot `slot` can place, so the two only + /// collide when a test means them to. + const FLOOR: RecordRegion = RecordRegion::new(RecordId(0), Region::new(0xE000_0000, SLOT_LEN)); + const LATCH: RecordRegion = RecordRegion::new(RecordId(1), Region::new(0xE010_0000, SLOT_LEN)); + + #[test] + fn finds_a_record_by_id() { + let records = RecordLayout::new(const { &[FLOOR, LATCH] }, Some(LAYOUT)); + assert_eq!(records.region(RecordId(1)), Some(LATCH.region())); + assert_eq!(records.regions().len(), 2); + } + + #[test] + fn an_undeclared_record_has_no_region() { + let records = RecordLayout::new(const { &[FLOOR] }, Some(LAYOUT)); + assert_eq!(records.region(RecordId(7)), None); + } + + /// Records in a store of their own have no images to be checked against. + #[test] + fn accepts_records_without_images() { + let records = RecordLayout::new( + const { &[RecordRegion::new(RecordId(0), Region::new(0, 4096))] }, + None, + ); + assert_eq!(records.region(RecordId(0)).map(|r| r.len()), Some(4096)); + } + + #[test] + #[should_panic(expected = "record ids must be unique")] + fn rejects_duplicate_record_ids() { + let _ = RecordLayout::new( + const { + &[ + RecordRegion::new(RecordId(0), Region::new(0xE000_0000, SLOT_LEN)), + RecordRegion::new(RecordId(0), Region::new(0xE010_0000, SLOT_LEN)), + ] + }, + None, + ); + } + + #[test] + #[should_panic(expected = "records must not overlap")] + fn rejects_overlapping_records() { + let _ = RecordLayout::new( + const { + &[ + RecordRegion::new(RecordId(0), Region::new(0xE000_0000, SLOT_LEN)), + RecordRegion::new(RecordId(1), Region::new(0xE000_0000, SLOT_LEN)), + ] + }, + None, + ); + } + + #[test] + #[should_panic(expected = "a record must not overlap a slot")] + fn rejects_a_record_inside_a_slot() { + let _ = RecordLayout::new( + const { &[RecordRegion::new(RecordId(0), Region::new(0, SLOT_LEN))] }, + Some(LAYOUT), + ); + } + + #[test] + #[should_panic(expected = "a record must not overlap the golden image")] + fn rejects_a_record_inside_the_golden_image() { + let _ = RecordLayout::new( + const { + &[RecordRegion::new( + RecordId(0), + Region::new(0xF000_0000, SLOT_LEN), + )] + }, + Some(LAYOUT), + ); + } + + #[test] + #[should_panic(expected = "a record layout must hold a record")] + fn rejects_an_empty_record_layout() { + let _ = RecordLayout::new(&[], None); + } +} diff --git a/services/orchestrator/driver/BUILD.bazel b/services/orchestrator/driver/BUILD.bazel index 0d3485afd..9a669eeb4 100644 --- a/services/orchestrator/driver/BUILD.bazel +++ b/services/orchestrator/driver/BUILD.bazel @@ -8,6 +8,8 @@ rust_library( srcs = [ "src/board.rs", "src/driver.rs", + "src/driver/self_update.rs", + "src/driver/update.rs", "src/lib.rs", "src/tests.rs", ], @@ -16,7 +18,9 @@ rust_library( visibility = ["//visibility:public"], deps = [ "//services/orchestrator/capabilities:orchestrator_capabilities", + "//services/orchestrator/config:orchestrator_config", "//services/orchestrator/sm:orchestrator_sm", + "//util/io", "@rust_crates//:heapless", ], ) diff --git a/services/orchestrator/driver/README.md b/services/orchestrator/driver/README.md index 2cb47cea9..1bde9121c 100644 --- a/services/orchestrator/driver/README.md +++ b/services/orchestrator/driver/README.md @@ -15,7 +15,7 @@ Everything device-specific arrives through the seams in `board.rs` Synchronous results (the verification verdict) return through `execute` and settle within the same dispatch run — there is no driver-side event queue. -Boot-walk verdicts are the one asynchronous read. `ReleaseReset` arms the +Boot-walk verdicts are the one asynchronous read. `ReleaseReset` starts the component's walk; the run loop polls and dispatches until quiet, then sleeps until the earliest walk deadline: @@ -31,6 +31,6 @@ loop { ``` Implemented executors: `ReadFirmware`, `VerifyFirmware`, `ReleaseReset` -(arms the boot walk), `AssertReset` (stops it). Everything else fails closed +(starts the boot walk), `AssertReset` (stops it). Everything else fails secure until its pillar lands (recovery, update path, attestation, reporting, lockdown latch). diff --git a/services/orchestrator/driver/src/board.rs b/services/orchestrator/driver/src/board.rs index f471a289a..9173eafd8 100644 --- a/services/orchestrator/driver/src/board.rs +++ b/services/orchestrator/driver/src/board.rs @@ -4,10 +4,15 @@ //! What the board supplies to the driver: traits and wiring data only. //! Boards (or test mocks) implement these. -use openprot_orchestrator_sm::{ComponentId, ComponentKind}; +use openprot_orchestrator_sm::{BootFailureKind, ComponentId}; +use orchestrator_capabilities::Updatable; +use orchestrator_config::DeviceConfig; +use util_io::ByteSource; -pub use orchestrator_capabilities::{BootControl, BootWatch}; -use orchestrator_capabilities::{Svn, SvnFloor}; +pub use orchestrator_capabilities::{AuthenticatedImage, BootControl, BootWatch, Measurement}; +use orchestrator_capabilities::{ + DeviceTrialBoot, IncrementalVerifier, Recovery, SelfReset, SelfUpdate, SvnFloor, +}; /// Access to one component's active firmware image, however it is reached — /// interposed flash, a PLDM/MCTP transfer, a RAM copy in tests. @@ -84,22 +89,22 @@ impl Verifier for &mut V { /// A [`Verifier`]'s judgment of one image. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Verdict { - /// Reported as `Event::VerificationPassed`. Carries the image's - /// manifest SVN: verification is the only authenticated reading of the - /// manifest, so this is the one value the anti-rollback commit - /// ([`Effect::CommitSvnFloor`](openprot_orchestrator_sm::Effect)) may - /// trust. - Authenticated { - /// The verified image's security version number. - svn: Svn, - }, + /// Reported as `Event::VerificationPassed`. Carries what the check + /// learned about the image, including the manifest SVN the + /// anti-rollback commit + /// ([`Effect::CommitSvnFloor`](openprot_orchestrator_sm::Effect)) + /// takes. The same payload the update path's + /// [`PollOutcome::Authenticated`](orchestrator_capabilities::PollOutcome) + /// carries: one description of an authenticated image, whether it was + /// checked at rest or staged. + Authenticated(AuthenticatedImage), /// Reported as `Event::VerificationFailed`. Rejected, } -/// One fact about the platform running degraded, carried outward to -/// management software. `#[non_exhaustive]`: a sink routes what it -/// recognises and ignores the rest, so a new report is not a trait break. +/// Something the orchestrator tells management software about. +/// `#[non_exhaustive]` so a sink just ignores variants it doesn't +/// know, and adding one doesn't break anyone. /// /// Payloads stay `Copy` and lifetime-free, like the effects these mirror. A /// report names a component only where the effect it mirrors does. @@ -112,6 +117,14 @@ pub enum Report { /// Recovery attempts exhausted and the platform halts. Reported before /// the lockdown latch, while there is still a platform to report from. RecoveryFailed(ComponentId), + /// A boot walk failed at a named checkpoint. The `kind` tells whether + /// this was silence (timed out), a retriable device fault, or a terminal + /// device fault. + BootFailed { + id: ComponentId, + checkpoint: &'static str, + kind: BootFailureKind, + }, /// An update request declined because the platform was busy. Nothing /// staged, and the requester may ask again. Platform-wide, not /// per-component: the machine supervises one update at a time and @@ -121,6 +134,49 @@ pub enum Report { /// discarded and no verdict for that request follows. Platform-wide for /// the same reason as [`Report::UpdateDeferred`]. UpdateAborted, + /// The verifier could not run its check: a crypto fault, or a + /// staging region it could not read. The update is rejected either + /// way, so without this report a broken verifier looks exactly like + /// a bad image. Platform-wide for the same reason as + /// [`Report::UpdateDeferred`]. + UpdateVerifierFault, + /// A component's image digest, computed during verification. + /// The driver sends it through the sink and forgets it. + Measured { + /// The component whose image this measures. + id: ComponentId, + /// The digest over that image. + measurement: Measurement, + }, + /// The spare slot could not be brought up to date after a commit. + /// The running image is fine. The other slot still holds the + /// firmware from before the update, so a fallback boots the old + /// version. + /// + /// A report is not enough: a slot left unbootable has to be repaired + /// from a known-good image. Nothing does that yet. + SlotResyncFailed(ComponentId), + /// The spare slot was brought up to date but the anti-rollback floor + /// could not be written afterwards. The component runs the new image + /// and both slots hold it; the floor still names the old SVN, so the + /// old image could be installed again. + SvnFloorCommitFailed(ComponentId), + /// The candidate for the eRoT authenticated with no manifest SVN and + /// was rejected. The update ends and the state machine returns to + /// `Ready`. + /// + /// A managed component is different: the image installs even with no + /// SVN and the floor for that component stays where it was + /// ([`Report::SvnFloorHeld`]). Only an image for the eRoT must carry + /// an SVN, because the ROM checks the SVN before boot. + SelfImageNoSvn, + /// The component's anti-rollback floor stayed where it was, because + /// the image that authenticated carried no SVN to move it to. The + /// board binds an eRoT-held floor for this component, so it asked for + /// anti-rollback its verifier cannot supply: nothing is wrong with + /// the image, and nothing protects against installing an older one + /// either. + SvnFloorHeld(ComponentId), } /// Where the driver hands its [`Report`]s. What a report becomes, a log @@ -128,7 +184,7 @@ pub enum Report { /// /// Infallible by design: a report names something that already happened, so /// an undeliverable one costs information, not containment. An error channel -/// would put reports on the fail-closed path, letting the act of reporting a +/// would put reports on the fail-secure path, letting the act of reporting a /// contained failure escalate it. pub trait ReportSink { /// Receives one report. A sink that cannot deliver immediately queues on @@ -166,7 +222,56 @@ pub trait BoardCapabilities { /// survives reset and power loss, otherwise a power cycle would /// re-admit images below the floor. type SvnFloor: SvnFloor; - // Later seams: Recovery, Staging. + /// Where reports go. `()` for a board with no management side to tell. + type ReportSink: ReportSink; + /// Stages and activates update payloads on the managed components. + type Updatable: Updatable; + /// Restores a managed component's image from its recovery source. + /// `()` for a board with no recovery path: every attempt reports + /// source exhaustion immediately. + type Recovery: Recovery; + /// Confirms the test image a downstream device was given once the + /// device boots it and reports ready, and reverts the trial when an + /// update supersedes the image or a recovery voids the boot behind it. + /// `()` for a device that keeps the trial record itself, + /// the usual case under + /// [`SvnFloorBinding::SelfManaged`](crate::SvnFloorBinding::SelfManaged): + /// the eRoT moves no slot metadata for that device, so confirm and + /// revert write nothing. + type DeviceTrial: DeviceTrialBoot; + /// The region an update source writes a candidate into. One region, + /// because one update runs at a time. + type Staging: ByteSource; + /// Incremental verification of staged update candidates. + type UpdateVerifier: IncrementalVerifier; + /// Durable storage that records the eRoT's own update. It has to + /// survive the reboot that decides whether the update worked. + type SelfUpdate: SelfUpdate; + /// Resets the eRoT, which is how its own update is activated. Every + /// board names a type; only [`Board::self_update`] reaches one. + type SelfReset: SelfReset; + /// The board's reset signal ids, as the device table spells them. + type ResetSignal: 'static; + /// The board's boot-probe vocabulary, as the device table spells it. + type Probe: 'static; +} + +/// The eRoT's own update session plus the anti-rollback floor it advances. +/// +/// The two are kept in one struct because nothing uses one without the +/// other. Both [`settle_self_update`](crate::settle_self_update) and +/// [`commit_self_svn_floor`](crate::commit_self_svn_floor) need the pair. +/// +/// This is not a [`SvnFloorBinding`]. That type exists to say who keeps a +/// component's floor, and the eRoT always keeps its own. +pub struct ErotUpdate { + /// Storage the session lives in across the reboot. + pub session: S, + /// The eRoT's own anti-rollback floor. + pub floor: F, + /// The reset that boots the trial image. The activation ends here, + /// and the call returns only if the reset did not happen. + pub reset: R, } /// Who keeps one component's anti-rollback floor. Spelled as its own type @@ -181,9 +286,50 @@ pub enum SvnFloorBinding { SelfManaged, } +/// Everything one component needs, in one place. `components[i]` is +/// `ComponentId(i)`: table position assigns the id, the same order the +/// board's device table declares. +/// +/// One struct per component rather than one array per capability, so a +/// component is written and read in one place and its parts cannot be +/// shuffled against each other. +pub struct ComponentWiring { + /// The device table row this wiring claims. `bring_up` checks it + /// against the table, so a pair of components wired into each other's + /// slots is caught there rather than driving the wrong reset line. + /// + /// The check reaches this field and no further. A capability built + /// against some other row, a boot walk handed `&DEVICES[1]` while this + /// says row 0, still passes. Build the array with + /// `core::array::from_fn` so one closure writes the index once. + pub device: &'static DeviceConfig, + /// The component's active firmware image. + pub image: B::Image, + /// Actuates the component's reset. + pub boot_control: B::BootControl, + /// Supervises the component's boot walk. + pub boot_watch: B::BootWatch, + /// Who keeps the component's anti-rollback floor. + pub svn_floor: SvnFloorBinding, + /// Stages updates for the component. A device with no update path + /// wires an adapter whose `poll_stage` errors. + pub updatable: B::Updatable, + /// The trial record for the component. The orchestrator confirms the + /// record when the downstream device boots the test image and reports + /// ready, and + /// reverts the record when an update supersedes that image or a + /// recovery voids the boot behind it. + pub trial: B::DeviceTrial, + /// Restores the component's image from its configured sources. `()` + /// for a board with no recovery path. + pub recovery: B::Recovery, +} + /// Everything the board supplies, built once at bring-up and handed to -/// `PlatformDriver::new`. Fields are public: executors may need two parts at once -/// (disjoint borrows). +/// [`bring_up`](crate::bring_up). Holds only what a board composes by hand: +/// anything the chain already states, the driver derives instead of taking it +/// here. Fields are public because a board writes this as a literal, and +/// because executors may need two parts at once (disjoint borrows). /// /// ```ignore /// struct Ast1060Board; @@ -193,34 +339,87 @@ pub enum SvnFloorBinding { /// type BootControl = ExtrstGpio; // per-component reset line /// type BootWatch = CheckpointWalk; // GPIO checkpoint walk over the boot window /// type SvnFloor = OtpSvnFloor; // fuse-backed anti-rollback floor +/// type ReportSink = MctpReports; // reports out over the management transport +/// type Updatable = PldmDevice; // device pulls its own chunks +/// type Recovery = SlotRecovery; // A/B + golden, attempt-indexed +/// type DeviceTrial = SlotTrial; // confirm or revert the activated slot +/// type Staging = StagingFlash; // where the update source writes +/// type UpdateVerifier = CryptoVerifier; // incremental signature check +/// type SelfUpdate = SelfUpdateSession; // session record in the eRoT's own flash +/// type SelfReset = WatchdogReset; // the reset that boots the trial image +/// type ResetSignal = ExtrstLine; // as DEVICES spells its reset ids +/// type Probe = BootProbe; // as DEVICES spells its boot probes /// } -/// let board = Board:: { -/// images: [bmc_image, cpld_image], -/// verifier, -/// boot_controls: [bmc_reset, cpld_reset], -/// boot_watches: [bmc_walk, cpld_walk], -/// component_kinds: [ComponentKind::Active, ComponentKind::Passive], -/// svn_floors: [SvnFloorBinding::Erot(bmc_floor), SvnFloorBinding::SelfManaged], -/// }; +/// +/// // The table is a static: bring_up checks each wiring against its row by +/// // address, and a const table can be promoted afresh at every use. +/// static DEVICES: [orchestrator_config::DeviceConfig; 2] = +/// [bmc_row, cpld_row]; +/// +/// // One chain, from the board's device table, for both halves. The const +/// // item is load-bearing: it forces chain_of's validation at build time. +/// const CHAIN: orchestrator_config::ChainEntries<2> = orchestrator_config::chain_of(&DEVICES); +/// let (orchestrator, driver) = bring_up::( +/// &CHAIN, +/// &DEVICES, +/// Board { +/// components: [ +/// ComponentWiring { +/// device: &DEVICES[0], +/// image: bmc_image, +/// boot_control: bmc_reset, +/// boot_watch: bmc_walk, +/// svn_floor: SvnFloorBinding::Erot(bmc_floor), +/// updatable: bmc_update, +/// recovery: bmc_recovery, +/// }, +/// ComponentWiring { +/// device: &DEVICES[1], +/// image: cpld_image, +/// boot_control: cpld_reset, +/// boot_watch: cpld_walk, +/// svn_floor: SvnFloorBinding::SelfManaged, +/// updatable: cpld_update, +/// recovery: cpld_recovery, +/// }, +/// ], +/// verifier, +/// report_sink, +/// update_staging, +/// update_stall_budget_millis: 30_000, +/// update_verifier: Some(crypto_verifier), +/// self_update: Some(ErotUpdate { +/// session: self_update, +/// floor: self_floor, +/// reset: self_reset, +/// }), +/// }, +/// MAX_RETRY, +/// ); /// ``` pub struct Board { - /// `images[i]` belongs to `ComponentId(i)` — device index = chain - /// position = table declaration order. - pub images: [B::Image; N], + /// `components[i]` is `ComponentId(i)`: device index, chain position + /// and table declaration order are the same number. + pub components: [ComponentWiring; N], /// Judges images for every component. pub verifier: B::Verifier, - /// `boot_controls[i]` actuates `ComponentId(i)`'s reset, same indexing - /// as `images`. - pub boot_controls: [B::BootControl; N], - /// `boot_watches[i]` supervises `ComponentId(i)`'s boot walk, same - /// indexing as `images`. - pub boot_watches: [B::BootWatch; N], - /// `component_kinds[i]` classifies `ComponentId(i)`: a completed walk becomes - /// `ComponentReady` for `Active`, `Booted` for `Passive`. Comes from - /// the same board table as the SM's chain, so both sides agree. - pub component_kinds: [ComponentKind; N], - /// `svn_floors[i]` says who keeps `ComponentId(i)`'s anti-rollback - /// floor, same indexing as `images`. - pub svn_floors: [SvnFloorBinding; N], - // Later seams add fields, e.g. recovery: [B::Recovery; N]. + /// Where the driver hands the SM's reports. One per platform, not one + /// per component: two of the four reports name no component. + pub report_sink: B::ReportSink, + /// Where an update source leaves the candidate. Not per component: + /// the SM allows one update at a time, so one region serves all of + /// them. + pub update_staging: B::Staging, + /// How long an update may make no progress before the pump abandons + /// it. Board policy, not the update source's: a device that stops + /// answering has to lose the job in bounded time whatever the source + /// would prefer. + pub update_stall_budget_millis: u64, + /// Incremental verifier for staged update candidates. The driver + /// takes ownership at construction; boards supply `Some(verifier)`. + pub update_verifier: Option, + /// The eRoT's own update session and floor. Set this to `None` on a + /// board that never updates itself, meaning one that does nothing but + /// supervise other components. + pub self_update: Option>, } diff --git a/services/orchestrator/driver/src/driver.rs b/services/orchestrator/driver/src/driver.rs index 1a14d41f2..bd08cff2f 100644 --- a/services/orchestrator/driver/src/driver.rs +++ b/services/orchestrator/driver/src/driver.rs @@ -4,12 +4,37 @@ //! The [`PlatformDriver`]: one executor method per [`Effect`] variant, routed from //! the SM through the [`Platform`] impl. -use openprot_orchestrator_sm::{ComponentId, ComponentKind, Effect, EffectError, Event, Platform}; +use openprot_orchestrator_sm::{ + BootFailureKind, Chain, ComponentAttrs, ComponentId, ComponentKind, Effect, EffectError, Event, + Orchestrator, Platform, +}; -use crate::board::{Board, BoardCapabilities, ImageSource, SvnFloorBinding, Verdict, Verifier}; -use orchestrator_capabilities::{BootControl, BootWatch, Svn, SvnFloor, WalkVerdict}; +use orchestrator_config::{ChainEntries, DeviceConfig}; + +use crate::board::{ + Board, BoardCapabilities, ComponentWiring, ImageSource, Report, ReportSink, SvnFloorBinding, + Verdict, Verifier, +}; +use orchestrator_capabilities::{ + AuthenticatedImage, BootControl, BootWatch, DeviceTrialBoot, FailureCause, IncrementalVerifier, + Progress, Recovery, RestoreOutcome, Svn, SvnFloor, WalkVerdict, +}; + +/// Which way a trial closes: keep the test image the downstream device +/// booted, or +/// discard it and leave the confirmed slot as it was. +enum TrialClose { + Keep, + Discard, +} /// Why the driver could not carry out an effect. +/// +/// Effects are what the state machine tells the driver to do. The event +/// loop turns these errors into `Event::EffectFailed`, which sends the +/// machine to `Locked`, so any error here locks the platform. A refusal +/// that should not lock belongs earlier, where the request arrives, before +/// the state machine emits an effect at all. #[derive(Clone, Copy, PartialEq, Eq, Debug)] pub enum DriverError { /// The effect names a component the driver has no device for. @@ -23,11 +48,65 @@ pub enum DriverError { VerifierFault, /// The component's boot control could not actuate the reset line. BootControlFault, - /// A floor commit was asked for a component with no verified image — - /// the SVN to advance to is unknown; fail closed. + /// A floor commit was asked for a component with no verified image, + /// so the SVN to advance to is unknown; fail secure. NoVerifiedImage, /// The component's SVN floor could not be advanced. SvnFloorFault, + /// An update is already in flight, or a self-update has not settled: + /// a trial still being judged, or one confirmed whose SVN the floor + /// has not taken. The frontend answers the requester over its own + /// protocol, the SM never sees the refused request. + UpdateBusy, + /// The device refused to activate what it staged. + UpdateFault, + /// The machine is pre-service or locked down, so it would drop the + /// request without reporting it. Refused here instead. + Unsupervised, + /// The recovery mechanism faulted (bus error, unreachable source). + /// Distinct from source exhaustion, which is a verdict, not a fault. + RecoveryFault, + /// An update effect ran with no job recorded. The frontend records + /// the job before the SM sees `UpdateRequest`, so this means the two + /// have drifted apart. + NoUpdateJob, + /// The candidate does not fit the staging region the board wired, so + /// there is nothing well-formed to read. Refused at submit; the + /// pump's window gives the same answer if it ever gets that far. + CandidateOutOfRange, + /// Activation was asked before the candidate passed verification. + /// The job survives, so `DiscardStaged` can still end it. + CandidateNotAuthenticated, + /// A self-update effect ran on a board that left `Board::self_update` + /// `None`. The event that opens the trial is read from that field, so + /// the board and the machine have drifted apart. + NoErotUpdate, + /// The eRoT's own update session could not be written. + SelfUpdateFault, + /// The eRoT's own candidate reached the activation with no manifest + /// SVN, so the session has no SVN to record. + /// + /// A guard, not the usual refusal: the pump rejects such a candidate + /// during verification + /// ([`Report::SelfImageNoSvn`](crate::Report)). Reaching the + /// activation anyway means the two checks disagree, which is worth + /// locking for where a missing version alone is not. + SelfActivateNoSvn, + /// The reset that boots the eRoT's trial image did not happen. The + /// session is already marked pending, so the next reset from any + /// source still boots the trial. The board's `SelfReset::Error` says + /// why the reset failed; the conversion to this variant discards that + /// error, so no caller and no report ever sees it. + SelfResetFault, + /// The trial record of a managed device could not be closed, so the + /// slot the device boots at the next reset is not the one the state + /// machine decided on. + TrialFault, + /// A staging step ran before anything commanded the work. Updates + /// get the flag from `AuthenticateStageUpdate`, and a slot re-sync + /// sets it when it queues the job. So the phase and the flag + /// disagree. + UpdateNotCommanded, } impl core::fmt::Display for DriverError { @@ -40,16 +119,51 @@ impl core::fmt::Display for DriverError { DriverError::BootControlFault => "boot control could not actuate the reset", DriverError::NoVerifiedImage => "no verified image to commit the floor to", DriverError::SvnFloorFault => "svn floor could not be advanced", + DriverError::UpdateBusy => "an update is in flight or a self-update has not settled", + DriverError::UpdateFault => "device refused to activate the staged image", + DriverError::Unsupervised => "the platform is pre-service or locked down", + DriverError::RecoveryFault => "recovery mechanism faulted", + DriverError::NoUpdateJob => "no update job for this effect", + DriverError::CandidateOutOfRange => "candidate does not fit the staging region", + DriverError::CandidateNotAuthenticated => "candidate has not passed verification yet", + DriverError::NoErotUpdate => "board wired no self-update", + DriverError::SelfUpdateFault => "self-update session could not be written", + DriverError::SelfActivateNoSvn => { + "the eRoT's own candidate reached the activation with no manifest SVN" + } + DriverError::SelfResetFault => "the reset into the trial image did not happen", + DriverError::TrialFault => "device trial record could not be closed", + DriverError::UpdateNotCommanded => "staging ran before the SM commanded it", }) } } impl core::error::Error for DriverError {} +mod self_update; +mod update; + +pub use self_update::{ + commit_self_svn_floor, settle_self_update, settle_self_update_at_boot, CommitFloorError, + SelfUpdateSettlement, SettleError, +}; +pub use update::UpdatePoll; + +/// Whether the update verifier is idle or mid-session. Move semantics +/// on the traits require this enum so the driver can hold either state. +enum VerifierState { + Idle(V), + Verifying(V::Session), +} + /// The effect executors. Everything device-specific lives in the [`Board`]; /// the driver's own fields are bookkeeping. pub struct PlatformDriver { board: Board, + /// `kinds[i]` classifies `ComponentId(i)`, derived from the chain the + /// state machine runs on. A completed walk becomes `ComponentReady` for + /// an `Active` component and `Booted` for a `Passive` one. + kinds: [ComponentKind; N], /// Component whose image is staged (source opened) for verification. staged: Option, /// `watching[i]`: `ComponentId(i)` is out of reset with a walk in @@ -57,28 +171,123 @@ pub struct PlatformDriver { /// terminal verdict. Only watched walks are polled, so a finished or /// quiesced walk emits no stale event. watching: [bool; N], - /// `verified_svn[i]` is the manifest SVN of `ComponentId(i)`'s last - /// authenticated image — the only value a floor commit may trust. - /// `None` until a verification passes; cleared again on rejection. - verified_svn: [Option; N], + /// `verified_svn[i]` is what the last verification of `ComponentId(i)` + /// recorded, the only reading a floor commit may trust. Reset to + /// [`VerifiedSvn::Unverified`] on rejection. + verified_svn: [VerifiedSvn; N], + /// The update job submitted by the frontend. Held until the update is + /// activated or discarded. + pending_update: Option, + /// Component and candidate length of the last activation. A commit + /// re-stages that payload into the spare slot. Cleared once the + /// re-sync is queued. + last_activated: Option<(ComponentId, u64)>, + /// An SVN floor advance waiting for the spare slot to catch up. A + /// floor above the SVN the spare slot holds leaves that slot + /// unbootable, so the commit holds the SVN floor advance here and the + /// pump applies it once the re-sync has written the confirmed image. + held_floor: Option<(ComponentId, Svn)>, + /// The incremental verifier, idle or mid-session. Moved out of the + /// board at construction so the pump can drive it without borrowing + /// the whole board. `None` only transiently during a pump step. + update_verifier: Option>, +} + +/// One in-flight update, recorded by [`PlatformDriver::submit_update`]. +struct UpdateJob { + target: ComponentId, + /// Candidate length in bytes, from the offer the source accepted. The + /// staging region is board geometry and usually larger, so the job + /// carries what part of it holds this candidate. + len: u64, + phase: UpdatePhase, + /// Set when the SM commands `AuthenticateStageUpdate`. The pump reads + /// this to know the SM has spoken; `phase` tracks how far execution + /// has gotten. Setting it twice is harmless, so a repeated command + /// needs no guard. + prepare_commanded: bool, + /// Progress at the last pump call, and when it last moved. The pump + /// judges a stall against these; both phases count bytes the same + /// way, so one rule covers staging and authentication. + progress: Progress, + /// `None` until the first pump call: the job is recorded before the + /// event loop has a clock reading for it. + progress_since_millis: Option, +} + +/// How far the in-flight update has come. +/// +/// The SM emits `AuthenticateStageUpdate` on entry to `Updating` and the +/// driver sequences the work: bytes are staged first, then the crypto +/// service verifies the staged image. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum UpdatePhase { + /// Recorded by the frontend, no executor has run yet. + Submitted, + /// `poll_stage` is pushing bytes to the device. + Staging, + /// The device holds the complete payload. Whether verification has + /// started is the verifier's to say, not a second flag here. + Staged, + /// The committed image is being written a second time, into the + /// slot the device just stopped booting from. The SM does not know + /// about this job. It ends in the driver. + Resyncing, + /// The verifier accepted the candidate; activation is next. Carries + /// the `AuthenticatedImage`, so the candidate's SVN cannot go missing + /// between the verdict and the activation that records it. + Authenticated(AuthenticatedImage), } impl PlatformDriver { - pub fn new(board: Board) -> Self { - // ComponentId is a u8, so ids for N > 256 components would wrap. - const { assert!(N <= 256) }; + /// Derives what the chain already states instead of taking it twice: the + /// component kinds come from `entries`, the same entries the state machine + /// is built from. + /// + /// # Panics + /// + /// Panics if an entry's id is not its position. The driver indexes every + /// per-component array by `id.get()`, so an entry out of position would + /// address the wrong component's reset line, flash and floor. + /// + /// Panics if the board's `update_verifier` is `None`. The driver takes + /// it out of the board here and owns it from then on, so a board that + /// leaves it empty could never verify an update. + pub(crate) fn new(entries: &[(ComponentId, ComponentAttrs); N], board: Board) -> Self { + // ComponentId is a u8; Chain rejects more than u8::MAX entries. + const { assert!(N <= u8::MAX as usize) }; + let mut kinds = [ComponentKind::Passive; N]; + let mut i = 0; + while i < N { + assert!( + entries[i].0.get() as usize == i, + "a chain entry's id must be its position in the chain" + ); + kinds[i] = entries[i].1.kind; + i += 1; + } + let mut board = board; + let update_verifier = board + .update_verifier + .take() + .expect("Board::update_verifier must be Some"); Self { board, + update_verifier: Some(VerifierState::Idle(update_verifier)), + kinds, staged: None, watching: [false; N], - verified_svn: [None; N], + verified_svn: [VerifiedSvn::Unverified; N], + pending_update: None, + last_activated: None, + held_floor: None, } } /// The board wiring, read-only, for the tests: they observe a /// capability after it moved into the driver, instead of every mock /// smuggling out a shared handle. Real consumers get targeted queries - /// when they exist — not this. + /// when they exist, not this. #[cfg(test)] pub(crate) fn board(&self) -> &Board { &self.board @@ -86,9 +295,13 @@ impl PlatformDriver { /// `id`'s image source. Takes the array rather than `&mut self` so the /// caller can borrow `board.verifier` alongside the returned image. - fn source(images: &mut [B::Image; N], id: ComponentId) -> Result<&mut B::Image, DriverError> { - images + fn source( + components: &mut [ComponentWiring; N], + id: ComponentId, + ) -> Result<&mut B::Image, DriverError> { + components .get_mut(id.get() as usize) + .map(|component| &mut component.image) .ok_or(DriverError::UnknownComponent) } @@ -96,7 +309,7 @@ impl PlatformDriver { /// [`verify_firmware`](Self::verify_firmware) can read it. pub fn stage_firmware(&mut self, id: ComponentId) -> Result<(), DriverError> { self.staged = None; - let source = Self::source(&mut self.board.images, id)?; + let source = Self::source(&mut self.board.components, id)?; source.open().map_err(|_| DriverError::ImageUnavailable)?; self.staged = Some(id); Ok(()) @@ -107,7 +320,7 @@ impl PlatformDriver { pub fn verify_firmware(&mut self, id: ComponentId) -> Result { // Id validity first: an unknown component is UnknownComponent even // though it can never be staged. - let source = Self::source(&mut self.board.images, id)?; + let source = Self::source(&mut self.board.components, id)?; if self.staged != Some(id) { return Err(DriverError::NotStaged); } @@ -118,46 +331,219 @@ impl PlatformDriver { .map_err(|_| DriverError::VerifierFault)?; let idx = id.get() as usize; Ok(match verdict { - Verdict::Authenticated { svn } => { - self.verified_svn[idx] = Some(svn); + Verdict::Authenticated(image) => { + self.verified_svn[idx] = match image.svn { + Some(svn) => VerifiedSvn::Svn(svn), + None => VerifiedSvn::Versionless, + }; + if let Some(measurement) = image.measurement { + self.report(Report::Measured { id, measurement }); + } Event::VerificationPassed(id) } Verdict::Rejected => { - self.verified_svn[idx] = None; + self.verified_svn[idx] = VerifiedSvn::Unverified; Event::VerificationFailed(id) } }) } - /// Advance `id`'s anti-rollback floor to its verified image's SVN. - /// A self-managed component keeps its own floor; the commit is a - /// no-op. A target at or below the current floor is the capability's - /// documented no-op, so a replayed commit is harmless. + /// Queue the spare slot's re-sync, then advance `id`'s anti-rollback + /// floor to its verified image's SVN. A target at or below the + /// current floor is the capability's documented no-op, so a replayed + /// commit is harmless. + /// + /// An `id` naming the eRoT returns through `commit_self_floor`, + /// which reads the floor from the `ErotUpdate` rather than from the + /// component wiring. Everything below describes a downstream device. + /// + /// A self-managed component gets neither the re-sync nor the SVN + /// floor advance. It keeps its own floor, and a device that owns its + /// anti-rollback owns its slot metadata too, the same split + /// `DeviceTrialBoot` draws. Writing into a slot the eRoT does not + /// control would reach past that seam. `commit_svn_floor` decides + /// whether the eRoT may write a component's slots by reading the + /// floor binding, which only says who keeps the floor; a board where + /// the floor keeper and the slot keeper differ cannot be wired today. + /// + /// Both slots carry the same SVN before the floor moves, so when a + /// re-sync is queued the SVN floor advance waits until the re-sync has + /// written the confirmed image into the spare slot. A re-sync transfer + /// that fails partway leaves the floor unchanged: moving it would put + /// the floor above the SVN the spare slot holds, where that slot will + /// not boot. + /// + /// With no re-sync queued, `advance_floor` writes the floor inside + /// the `CommitSvnFloor` effect, so a failed write fails the effect + /// and the state machine latches `Locked`. With a re-sync queued the + /// effect already answered `Ok` and the pump writes the floor later, + /// where a failed write has no effect left to fail and + /// `Report::SlotResyncFailed` is the channel that remains. The + /// Update Agent is not told: its answer goes out when + /// `Effect::CommitSvnFloor` is dispatched, which is before the pump + /// runs, so it hears the commit succeeded either way. pub fn commit_svn_floor(&mut self, id: ComponentId) -> Result<(), DriverError> { + if self.is_self(id) { + return self.commit_self_floor(); + } let idx = id.get() as usize; - let SvnFloorBinding::Erot(floor) = self + let SvnFloorBinding::Erot(_) = self .board - .svn_floors - .get_mut(idx) + .components + .get(idx) + .map(|component| &component.svn_floor) .ok_or(DriverError::UnknownComponent)? + else { + // The component tracks its own SVN, so there is no floor + // here to move and no slot of ours to bring up to date. + return Ok(()); + }; + let svn = match self.verified_svn[idx] { + VerifiedSvn::Svn(svn) => svn, + // The image authenticated and carried no version to move the + // floor to. Nothing is wrong with the image, so the commit + // succeeds and the floor stays where it is; the board asked + // for anti-rollback it cannot get, and the report is what + // says so. Refusing here would turn a legal image into a + // lockdown. The spare still gets the new image: the re-sync + // keeps the two slots holding the same firmware, which is + // wanted whether or not a floor moves behind it. + VerifiedSvn::Versionless => { + self.queue_slot_resync(id); + self.report(Report::SvnFloorHeld(id)); + return Ok(()); + } + // No verdict recorded at all. The commit follows a walk that + // verifies, so this means the driver and the machine have + // drifted apart, and it fails secure. + VerifiedSvn::Unverified => return Err(DriverError::NoVerifiedImage), + }; + if self.queue_slot_resync(id) { + // The spare still holds the old image. Hold the advance + // until the pass has put the new one there. + self.held_floor = Some((id, svn)); + return Ok(()); + } + if self.held_floor.is_some() { + // A pass is already running with an advance held behind it, + // so this commit arrived twice. Leave the held one to the + // pump rather than writing the floor while the spare is + // still being written. + return Ok(()); + } + self.advance_floor(id, svn) + } + + /// Writes `svn` to `id`'s floor. Only reached for a component whose + /// floor the eRoT holds. + fn advance_floor(&mut self, id: ComponentId, svn: Svn) -> Result<(), DriverError> { + let idx = id.get() as usize; + // Cannot fire: both callers read the binding first and only get + // an SVN for a component whose floor the eRoT holds. Kept so a + // third caller cannot write a floor that is not ours. + let Some(SvnFloorBinding::Erot(floor)) = self + .board + .components + .get_mut(idx) + .map(|component| &mut component.svn_floor) else { return Ok(()); }; - let svn = self.verified_svn[idx].ok_or(DriverError::NoVerifiedImage)?; floor.advance(svn).map_err(|_| DriverError::SvnFloorFault) } + /// Queues a second staging pass for the image just committed. The + /// slot the device stopped booting from still holds the old + /// firmware, and this pass overwrites it. The pump runs the + /// transfer. Nothing activates afterwards, so the payload stays in + /// the inactive slot. + /// + /// For a component whose floor the eRoT holds, the eRoT re-stages the + /// spare slot so both slots hold the firmware that was just confirmed, + /// and this transfer is that re-staging. For a self-managed component + /// [`commit_svn_floor`](Self::commit_svn_floor) returns before the + /// re-sync; the ownership split is documented there. + /// + /// It re-stages instead of copying slot to slot, because `Updatable` + /// keeps slot identity on the device's side. The candidate is still + /// in the staging region, since the machine runs one job at a time. + /// + /// Does nothing when there is nothing to re-sync. That is a + /// confirmed boot with no update behind it, or a staging region that + /// changed hands since the activation; `submit_update` and + /// `discard_staged` clear the claim when that happens. The in-flight + /// check below cannot fire today, because those same two clear the + /// claim before any job starts. It stays so a re-sync can never push + /// a job aside. A failure during the pass is reported. The running + /// image is committed either way. + fn queue_slot_resync(&mut self, id: ComponentId) -> bool { + let Some((target, len)) = self.last_activated else { + return false; + }; + if target != id || self.pending_update.is_some() { + return false; + } + self.last_activated = None; + self.pending_update = Some(UpdateJob { + target, + len, + phase: UpdatePhase::Resyncing, + prepare_commanded: true, + progress: Progress::start(len), + progress_since_millis: None, + }); + true + } + + /// Advances the eRoT's own floor to the SVN its confirmed trial + /// recorded, then closes the session. + /// + /// The eRoT's floor is not in `components[0].svn_floor`: it lives in + /// the `ErotUpdate`, next to the session that says which SVN the + /// trial confirmed. The commit travels `Event::SvnCommitRequest` and + /// `Effect::CommitSvnFloor` the way it does for a downstream device; + /// only where the driver reads the floor differs. + /// + /// A request with no confirmed session behind it returns + /// `NoVerifiedImage`, the same error `commit_svn_floor` returns for + /// a downstream device with no verdict recorded, so the effect fails + /// instead of the floor moving for an image no boot confirmed. + fn commit_self_floor(&mut self) -> Result<(), DriverError> { + let self_update = self + .board + .self_update + .as_mut() + .ok_or(DriverError::NoErotUpdate)?; + commit_self_svn_floor(&mut self_update.session, &mut self_update.floor).map_err(|err| { + match err { + CommitFloorError::Floor(_) => DriverError::SvnFloorFault, + CommitFloorError::Session(_) => DriverError::SelfUpdateFault, + // Nothing confirmed a trial, so there is no SVN to move to. + CommitFloorError::NotConfirmed(_) => DriverError::NoVerifiedImage, + } + }) + } + + /// Whether `id` is the eRoT: the platform acting on itself rather + /// than on a device it manages. The chain gives every component a + /// kind, `Erot`, `Active` or `Passive`, and `chain_of` admits exactly + /// one `Erot`, so exactly one id answers true. + fn is_self(&self, id: ComponentId) -> bool { + self.kinds.get(id.get() as usize) == Some(&ComponentKind::Erot) + } + /// `id`'s reset actuator. fn boot_control(&mut self, id: ComponentId) -> Result<&mut B::BootControl, DriverError> { self.board - .boot_controls + .components .get_mut(id.get() as usize) + .map(|component| &mut component.boot_control) .ok_or(DriverError::UnknownComponent) } - /// Release `id` from reset and arm its boot walk; + /// Release `id` from reset and start its boot walk; /// [`poll_boot_walks`](Self::poll_boot_walks) feeds the verdict back - /// as `ComponentReady(id)`/`Booted(id)`/`Timeout(id)`. Arms on every + /// as `ComponentReady(id)`/`Booted(id)`/`BootFailed { id, .. }`. Starts on every /// release: a retry re-release starts a fresh walk. pub fn release_reset(&mut self, id: ComponentId) -> Result<(), DriverError> { self.boot_control(id)? @@ -165,15 +551,15 @@ impl PlatformDriver { .map_err(|_| DriverError::BootControlFault)?; let idx = id.get() as usize; // In bounds: boot_control(id) above already rejected unknown ids. - self.board.boot_watches[idx].arm(); + self.board.components[idx].boot_watch.start(); self.watching[idx] = true; Ok(()) } - /// Hold `id` in reset — a durable quiesce, not a pulse; at-rest + /// Hold `id` in reset, a durable quiesce, not a pulse; at-rest /// verification and the recovery re-walk depend on it. Also stops the /// boot walk: a held device produces no boot signal, so polling it - /// could only yield a stale `Timeout`. + /// could only yield a stale `BootFailed`. pub fn assert_reset(&mut self, id: ComponentId) -> Result<(), DriverError> { self.boot_control(id)? .hold_in_reset() @@ -185,14 +571,14 @@ impl PlatformDriver { /// Polls every watched walk at `now_millis` and returns the first /// terminal verdict as its event: [`WalkVerdict::Complete`] becomes /// `ComponentReady(id)` (`Active`) or `Booted(id)` (`Passive`), - /// [`WalkVerdict::Failed`] becomes `Timeout(id)` regardless of cause — - /// retry budgeting is the SM's. The finished walk stops being watched; + /// [`WalkVerdict::Failed`] becomes `BootFailed { id, checkpoint, kind }`. + /// The finished walk stops being watched; /// each verdict is delivered once. /// /// Returns at the first event; drain by calling until /// [`BootWalkPoll::event`] is `None`. Only that last poll carries a - /// complete [`next_deadline_millis`](BootWalkPoll::next_deadline_millis) - /// — the earliest deadline among the still-waiting walks. + /// complete [`next_deadline_millis`](BootWalkPoll::next_deadline_millis), + /// the earliest deadline among the still-waiting walks. pub fn poll_boot_walks(&mut self, now_millis: u64) -> BootWalkPoll { let mut next_deadline_millis: Option = None; for idx in 0..N { @@ -200,7 +586,7 @@ impl PlatformDriver { continue; } let id: ComponentId = (idx as u8).into(); - match self.board.boot_watches[idx].poll(now_millis) { + match self.board.components[idx].boot_watch.poll(now_millis) { WalkVerdict::Waiting { deadline_millis } => { next_deadline_millis = Some(match next_deadline_millis { Some(d) => d.min(deadline_millis), @@ -209,19 +595,34 @@ impl PlatformDriver { } WalkVerdict::Complete => { self.watching[idx] = false; - let event = match self.board.component_kinds[idx] { + let event = match self.kinds[idx] { ComponentKind::Active => Event::ComponentReady(id), ComponentKind::Passive => Event::Booted(id), + // The eRoT is never released, so it is never watched + // and no walk finishes for it. Keep polling. The + // deadline so far covers only the components before + // this one, so returning here would give the caller + // too long a wait. + ComponentKind::Erot => continue, }; return BootWalkPoll { event: Some(event), next_deadline_millis, }; } - WalkVerdict::Failed { .. } => { + WalkVerdict::Failed { checkpoint, cause } => { self.watching[idx] = false; + let kind = match cause { + FailureCause::TimedOut => BootFailureKind::TimedOut, + FailureCause::DeviceRetriable => BootFailureKind::DeviceRetriable, + FailureCause::DeviceFatal => BootFailureKind::DeviceFatal, + }; return BootWalkPoll { - event: Some(Event::Timeout(id)), + event: Some(Event::BootFailed { + id, + checkpoint, + kind, + }), next_deadline_millis, }; } @@ -232,6 +633,81 @@ impl PlatformDriver { next_deadline_millis, } } + + /// Restore `id`'s image from its recovery source. The verdict travels + /// as an event, not an error: `Restored` and `SourceExhausted` are + /// outcomes the SM handles per failure policy, while an `Err` from + /// the mechanism is a genuine actuation fault that fails secure. + pub fn recover_component( + &mut self, + id: ComponentId, + attempt: u8, + ) -> Result { + let recovery = self + .board + .components + .get_mut(id.get() as usize) + .map(|component| &mut component.recovery) + .ok_or(DriverError::UnknownComponent)?; + match recovery.restore(attempt) { + Ok(RestoreOutcome::Restored) => Ok(Event::Restored(id)), + Ok(RestoreOutcome::SourceExhausted) => Ok(Event::RecoveryUnavailable(id)), + Err(_) => Err(DriverError::RecoveryFault), + } + } + + /// Closes the trial open for `id`, keeping the test image the + /// downstream device booted or discarding it. + /// + /// Confirming and reverting differ only in which call the trial record + /// gets, `confirm` or `revert`, so one method carries both. The state + /// machine decides, and [`TrialClose`] carries the decision, so the + /// driver cannot confirm a trial the state machine reverted. + /// + /// A failed close is an actuation fault and latches the state machine, + /// because a trial that will not close leaves the device booting an + /// unconfirmed image at the next reset. + fn close_device_trial( + &mut self, + id: ComponentId, + close: TrialClose, + ) -> Result<(), DriverError> { + let trial = self + .board + .components + .get_mut(id.get() as usize) + .map(|component| &mut component.trial) + .ok_or(DriverError::UnknownComponent)?; + let outcome = match close { + TrialClose::Keep => trial.confirm(), + TrialClose::Discard => trial.revert(), + }; + outcome.map_err(|_| DriverError::TrialFault) + } + + /// Hands one report to the board's sink. Cannot fail, so reporting stays + /// off the fail-secure path; reports arrive in the order the SM emitted + /// them. + pub fn report(&mut self, report: Report) { + self.board.report_sink.report(report); + } +} + +/// What the last verification of one component recorded about its image. +/// +/// Three states, not an `Option`, because "no verdict yet" and +/// "authenticated with no version in its manifest" cost different things +/// at commit time: the first is drift between the driver and the machine, +/// the second is an ordinary image on a board that cannot do anti-rollback +/// for it. +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +enum VerifiedSvn { + /// No verification has passed, or the last one failed. + Unverified, + /// The image authenticated and its manifest carried no SVN. + Versionless, + /// The SVN the authenticated manifest carried. + Svn(Svn), } /// One [`PlatformDriver::poll_boot_walks`] round. @@ -250,8 +726,8 @@ impl Platform for PlatformDriver { /// Routes each effect to its executor. Exhaustive: a new [`Effect`] /// variant must get an executor before this compiles. Synchronous /// results (the verification verdict) come back as the returned event; - /// every executor error reports as [`EffectError`] — the SM treats all - /// actuation failures the same, fail-closed. + /// every executor error reports as [`EffectError`], the SM treats all + /// actuation failures the same, fail-secure. fn execute(&mut self, effect: Effect) -> Result, EffectError> { match effect { Effect::ReadFirmware(id) => self.stage_firmware(id).map(|_| None), @@ -259,25 +735,54 @@ impl Platform for PlatformDriver { Effect::ReleaseReset(id) => self.release_reset(id).map(|_| None), Effect::AssertReset(id) => self.assert_reset(id).map(|_| None), Effect::CommitSvnFloor(id) => self.commit_svn_floor(id).map(|_| None), + // Reports carry no error, so they never reach the fail-secure + // group below. + Effect::ReportIsolated(id) => { + self.report(Report::Isolated(id)); + Ok(None) + } + Effect::ReportRecoveryFailed(id) => { + self.report(Report::RecoveryFailed(id)); + Ok(None) + } + Effect::ReportUpdateDeferred => { + self.pending_update = None; + self.report(Report::UpdateDeferred); + Ok(None) + } + Effect::ReportUpdateAborted => { + self.pending_update = None; + self.report(Report::UpdateAborted); + Ok(None) + } + Effect::ReportBootFailed { + id, + checkpoint, + kind, + } => { + self.report(Report::BootFailed { + id, + checkpoint, + kind, + }); + Ok(None) + } + Effect::RecoverComponent { id, attempt } => { + self.recover_component(id, attempt).map(Some) + } + Effect::AuthenticateStageUpdate => self.prepare_update().map(|_| None), + Effect::ActivateUpdate => self.activate_update().map(|_| None), + Effect::DiscardStaged => self.discard_staged().map(|_| None), + Effect::ConfirmSelfTrial => self.confirm_self_trial().map(|_| None), + Effect::ConfirmDeviceTrial(id) => { + self.close_device_trial(id, TrialClose::Keep).map(|_| None) + } + Effect::RevertDeviceTrial(id) => self + .close_device_trial(id, TrialClose::Discard) + .map(|_| None), // No board capability is composed for these seams yet, so they - // fail closed here instead of behind stub methods. Each group - // gains an executor when its capability joins - // [`BoardCapabilities`], as BootControl did above: recovery - // sourcing for RecoverComponent; update staging, authentication - // and trial activation for the update quartet; evidence signing - // for SignAttestation; the management reporting path for the - // Report effects; the terminal latch for LatchLockdown. - Effect::RecoverComponent { .. } - | Effect::AuthenticateUpdate - | Effect::StageUpdate - | Effect::ActivateUpdate - | Effect::DiscardStaged - | Effect::SignAttestation - | Effect::ReportIsolated(_) - | Effect::ReportRecoveryFailed(_) - | Effect::ReportUpdateDeferred - | Effect::ReportUpdateAborted - | Effect::LatchLockdown => return Err(EffectError), + // fail secure here instead of behind stub methods. + Effect::SignAttestation | Effect::LatchLockdown => return Err(EffectError), // Emit is consumed by the orchestrator; receiving one is a // driver bug. Effect::Emit(_) => return Err(EffectError), @@ -285,3 +790,82 @@ impl Platform for PlatformDriver { .map_err(|_| EffectError) } } + +/// Brings a platform up from one chain: the state machine that decides and the +/// driver that acts, built from the same entries so neither can be holding a +/// different list of components than the other. +/// +/// Takes a [`ChainEntries`] returned by `orchestrator_config::chain_of`, +/// which validates the table at const time. Boards declare the result as a +/// `const` item, so an invalid table is a build error, not a runtime panic. +/// +/// `chain_entries` and `devices` are expected to come from the same table. +/// Nothing checks that, so one board's chain passed with another's table +/// would describe every component wrongly. +/// +/// # Panics +/// +/// Panics if a component's wiring does not name its own row of `devices`. +/// The wiring holds hardware handles, so it cannot be checked at const time +/// the way `chain_of` checks the table; the assert catches a miswired board +/// at first bring-up, before it drives another component's reset line. +/// +/// The table has to be a `static` item. A `const` table is promoted afresh +/// at each use, so the row a wiring names and the row here would be two +/// addresses and the check could not hold on a correctly wired board. +pub fn bring_up( + chain_entries: &'static ChainEntries, + devices: &'static [DeviceConfig; N], + board: Board, + max_retry: u8, +) -> (Orchestrator, PlatformDriver) { + for (component, device) in board.components.iter().zip(devices.iter()) { + assert!( + core::ptr::eq(component.device, device), + "a component's wiring must name its own device table entry, \ + and the table has to be a static item" + ); + } + let entries = chain_entries.entries(); + // chain_of validated: nonempty, at most u8::MAX, ids are positions, + // deps strictly earlier, eRoT at position 0 and nowhere else. + // Chain::try_from rechecks all of that except the eRoT rule, so the + // expect cannot fire. Only chain_of knows that rule, which is what lets + // the unit tests and the QEMU runtime test build a bare chain through + // Chain::try_from that starts with any kind. + let chain: Chain = heapless::Vec::from_slice(entries) + .expect("same length as the capacity") + .try_into() + .expect("chain_of validated the entries"); + ( + Orchestrator::new(chain, max_retry), + PlatformDriver::new(entries, board), + ) +} + +/// The connection between an update frontend and the SM: called (by the +/// event loop, on the frontend's behalf) once a complete candidate for +/// `target` sits in the staging region. Records the job first, then injects +/// [`Event::UpdateRequest`]; that order is load-bearing, +/// `AuthenticateStageUpdate` can never run without a target. On refusal no +/// event is injected and the frontend answers the requester over its own +/// protocol. +/// +/// Every request gets one answer. `Ready` runs the update and the other +/// supervised states report it deferred, but an unsupervised machine drops +/// what it does not handle, so the request is refused here instead. The +/// check sits outside the state machine because giving `Locked` an arm that +/// emits a report would stop it being inert. +pub fn request_update( + orchestrator: &mut Orchestrator, + driver: &mut PlatformDriver, + target: ComponentId, + len: u64, +) -> Result<(), DriverError> { + if !orchestrator.state().is_supervised() { + return Err(DriverError::Unsupervised); + } + driver.submit_update(target, len)?; + orchestrator.dispatch(driver, Event::UpdateRequest(target)); + Ok(()) +} diff --git a/services/orchestrator/driver/src/driver/self_update.rs b/services/orchestrator/driver/src/driver/self_update.rs new file mode 100644 index 000000000..a05a637a8 --- /dev/null +++ b/services/orchestrator/driver/src/driver/self_update.rs @@ -0,0 +1,367 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The eRoT's own update: settling the last one at boot, confirming a +//! trial the chain walk judged, and advancing the eRoT's own floor once +//! the Update Agent requests it. +//! +//! The activation that starts a trial is in +//! [`update`](super::update), with the rest of the update pump. + +use openprot_orchestrator_sm::{Event, Orchestrator}; +use orchestrator_capabilities::{ + RunningImage, SelfUpdate, SelfUpdateState, Svn, SvnFloor, TrialOutcome, +}; + +use super::{DriverError, PlatformDriver}; +use crate::board::BoardCapabilities; + +impl PlatformDriver { + /// Settles the eRoT's last self-update at the start of this boot, from + /// the session and floor the board wired, and says what it found. + /// + /// The same call as [`settle_self_update`], reaching the pair through + /// [`Board::self_update`] so an event loop that only holds the driver can + /// make it. A board that wired no self-update answers `Settled`: no + /// session is no session, whether it is missing or empty. + /// + /// Runs once, before [`Event::PowerGood`], and the caller dispatches + /// [`SelfUpdateSettlement::event`] before that. A later run names an + /// event the state machine drops: the trial is judged once per boot, by + /// the walk that has already run. + pub fn settle_self_update_session( + &mut self, + ) -> Result, SvnFloorError>> { + let Some(self_update) = self.board.self_update.as_mut() else { + return Ok(SelfUpdateSettlement::Settled); + }; + settle_self_update(&mut self_update.session, &self_update.floor) + } + + /// Confirms the eRoT's own update session: the trial image booted and + /// the chain came up behind it. + /// + /// Moves the session to `Committed`. The Update Agent sends + /// UpdateSecurityRevision when it sends it; what the confirm decides is + /// the answer, since `commit_self_svn_floor` refuses a session that does + /// not read `Committed`. The floor does not move here, and nothing reads + /// the SVN: the session recorded it at `prepare`, and that is the only + /// authenticated reading of it. + /// + /// `confirm` is idempotent, so a board whose session already reads + /// `Committed` answers `Ok`. A board with no [`ErotUpdate`](crate::ErotUpdate) at all is a + /// different matter and fails secure: the effect only ever follows the + /// event the settle call produced, so reaching here without one means the + /// board and the machine disagree about whether this eRoT updates + /// itself. + pub(super) fn confirm_self_trial(&mut self) -> Result<(), DriverError> { + let self_update = self + .board + .self_update + .as_mut() + .ok_or(DriverError::NoErotUpdate)?; + self_update + .session + .confirm() + .map_err(|_| DriverError::SelfUpdateFault) + } +} + +/// The error type of the board's self-update session, spelled once so +/// [`PlatformDriver::settle_self_update_session`] fits on a line. +type SelfUpdateError = <::SelfUpdate as SelfUpdate>::Error; + +/// The error type of the board's anti-rollback floor, for the same reason. +type SvnFloorError = <::SvnFloor as SvnFloor>::Error; + +/// What [`settle_self_update`] found in the eRoT's last self-update. +/// +/// What to do about it is the caller's, the same split the capability seams +/// use. +#[must_use] +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub enum SelfUpdateSettlement { + /// Nothing is left to do, so the boot carries on and a new self-update + /// may start: no session, a session nothing would confirm and that was + /// reverted, or a confirmed session whose floor had already taken its + /// SVN. + Settled, + /// This boot is the trial run of the eRoT's own update, and nothing has + /// judged it yet. The chain walk is what judges it: the trial image + /// booted, and bringing the platform up is what it has to prove. No new + /// self-update may start: recording one would overwrite the session. + TrialRunning { + /// The SVN the session recorded, and the floor's target once the + /// trial is confirmed. + svn: Svn, + }, + /// The trial was confirmed and the floor is still below `svn`. The + /// Update Agent requests the advance with UpdateSecurityRevision, so + /// this boot leaves it alone. No new self-update may start: recording + /// one would overwrite the session. + AwaitingFloorAdvance { + /// The SVN the session recorded, and the floor's target. + svn: Svn, + }, + /// A trial image is running that no session claims, so the eRoT must not + /// keep running it. The session is reverted, which clears the pending + /// mark, so the confirmed image runs after a reset. An implementation + /// whose `revert` leaves the mark in place would run the same image + /// again. + UnclaimedImageRunning, +} + +impl SelfUpdateSettlement { + /// Which event the caller dispatches into the state machine for this + /// settlement, if any. + /// + /// Only a running trial needs one: the state machine judges that trial + /// by reaching [`State::Ready`](openprot_orchestrator_sm::State), so it + /// has to know the trial is running before the walk starts. The other + /// settlements are the caller's to act on and change nothing about the + /// walk, so they dispatch no event. + #[must_use] + pub const fn event(self) -> Option { + match self { + SelfUpdateSettlement::TrialRunning { .. } => Some(Event::SelfTrialBooted), + SelfUpdateSettlement::Settled + | SelfUpdateSettlement::AwaitingFloorAdvance { .. } + | SelfUpdateSettlement::UnclaimedImageRunning => None, + } + } +} + +/// Finishes off the eRoT's last self-update, at the start of the next boot. +/// +/// An update writes the new image to the secondary slot and marks the session +/// pending, so the next reset runs that image once. That trial run is then +/// either confirmed or reverted. The eRoT loses all of RAM across the reset, +/// so the session in durable storage plus the image this boot is running is +/// everything it has to go on. This reads both and says what it found: +/// +/// - No session: nothing happened, carry on. +/// - The session is pending and the trial image booted: this boot is the trial +/// run. Nothing here judges it. The chain walk does, by bringing the +/// platform up, so the session is left alone. +/// - The session is prepared or pending but the confirmed image booted: the +/// update never ran, or its trial failed and the platform fell back. The +/// session is reverted, so the update is done again rather than counted as +/// finished. +/// - A trial image is running that no session claims: the session is reverted, +/// which also clears the pending mark, so the confirmed image runs after a +/// reset. The eRoT must not keep running an image nothing vouched for. +/// - The session is confirmed and the floor is still below its SVN: the floor +/// advance is what is left, and the Update Agent requests it, so this +/// boot must not do it. +/// - The session is confirmed and the floor already reads that SVN or higher: +/// the advance landed before a crash, so the session is closed here. +/// +/// Running it twice lands in the same place, which is what lets a boot that +/// died partway through simply repeat it. A storage fault leaves the session +/// as it is and comes back as [`SettleError`] with the storage's own error +/// inside, rather than guessing. +/// +/// Must run before the machine can grant a new update: `prepare` overwrites +/// whatever session is there, so a new update recorded over one still being +/// judged would lose what it owes. +/// +/// The trial gets one boot. A platform whose pending mark survives a reset has +/// to clear it before this runs, otherwise an unplanned reset runs the trial +/// image again. +/// +/// Takes the session and the eRoT's own floor directly. Neither is board +/// wiring: nothing calls this yet, and a seam joins [`BoardCapabilities`] when +/// an executor needs it. +pub fn settle_self_update( + session: &mut S, + floor: &F, +) -> Result> { + let state = session.state().map_err(SettleError::Session)?; + let running = session.running().map_err(SettleError::Session)?; + match orchestrator_capabilities::trial_outcome(state, running) { + TrialOutcome::NoSession => Ok(SelfUpdateSettlement::Settled), + TrialOutcome::InProgress => { + // Nothing here judges the trial. The chain walk that follows + // does, by reaching Ready. + let SelfUpdateState::TrialPending { svn } = state else { + // trial_outcome answers InProgress for TrialPending alone. + // Fail secure rather than guess which SVN was recorded. + return Err(SettleError::InconsistentSession(state)); + }; + Ok(SelfUpdateSettlement::TrialRunning { svn }) + } + TrialOutcome::Unconfirmed => { + session.revert().map_err(SettleError::Session)?; + if running == RunningImage::Trial { + return Ok(SelfUpdateSettlement::UnclaimedImageRunning); + } + Ok(SelfUpdateSettlement::Settled) + } + TrialOutcome::ConfirmedUncommitted { svn } => { + let reached = floor.floor().map_err(SettleError::Floor)?; + if reached >= svn { + session.complete().map_err(SettleError::Session)?; + return Ok(SelfUpdateSettlement::Settled); + } + Ok(SelfUpdateSettlement::AwaitingFloorAdvance { svn }) + } + } +} + +/// Why [`settle_self_update`] could not finish. +/// +/// Carries the storage error rather than flattening it, which is what the +/// `core::error::Error` bound on both seams is for. A caller that only needs +/// to fail secure collapses it to one [`DriverError`] in a line. +#[derive(Debug, PartialEq, Eq)] +pub enum SettleError { + /// The session could not be read or written. + Session(S), + /// The eRoT's own anti-rollback floor could not be read. + Floor(F), + /// `trial_outcome` said a trial is in progress for a state that is not + /// `TrialPending`. It cannot today, since that is the only state it + /// answers `InProgress` for. Kept so a change there fails secure rather + /// than guessing which SVN was recorded. + InconsistentSession(SelfUpdateState), +} + +impl core::fmt::Display for SettleError { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + SettleError::Session(err) => write!(f, "self-update session: {err}"), + SettleError::Floor(err) => write!(f, "self-update floor: {err}"), + SettleError::InconsistentSession(state) => { + write!( + f, + "self-update session reads {state:?} and cannot be settled" + ) + } + } + } +} + +impl core::error::Error + for SettleError +{ + fn source(&self) -> Option<&(dyn core::error::Error + 'static)> { + match self { + SettleError::Session(err) => Some(err), + SettleError::Floor(err) => Some(err), + SettleError::InconsistentSession(_) => None, + } + } +} + +/// Advances the eRoT's own anti-rollback floor to the SVN of its confirmed +/// self-update, then closes the session. +/// +/// Call this when the Update Agent sends UpdateSecurityRevision, which the FD +/// reports as `SvnCommitPending`. The caller answers the agent with what comes +/// back: done on `Ok`, refused on `Err`. Activating an image never moves the +/// SVN floor. It moves only here, when the Update Agent sends +/// UpdateSecurityRevision after a trial boot was confirmed. +/// +/// Refuses unless the session says confirmed and is still open. With no +/// confirmed session, nothing has run the image this SVN belongs to, so the +/// floor stays where it is. +/// +/// Asking twice is safe. If the eRoT crashes after the floor moved but before +/// the session closed, the next UpdateSecurityRevision advances the floor to +/// the same value again, which changes nothing, and closes the session. Once +/// the session is closed, any further one gets +/// [`CommitFloorError::NotConfirmed`]: an answer lost on the way back means +/// a retry from the Update Agent fails even though the SVN floor +/// already holds the SVN it requested. +/// +/// If the floor cannot be written, the session stays open, so the next +/// UpdateSecurityRevision runs the whole thing again and the advance is not +/// lost. The Update Agent is the only thing that retries; nothing here does. +/// +/// Takes the session and the floor as arguments, as [`settle_self_update`] +/// does. Neither is wired into the board yet. +pub fn commit_self_svn_floor( + session: &mut S, + floor: &mut F, +) -> Result<(), CommitFloorError> { + let state = session.state().map_err(CommitFloorError::Session)?; + let running = session.running().map_err(CommitFloorError::Session)?; + let TrialOutcome::ConfirmedUncommitted { svn } = + orchestrator_capabilities::trial_outcome(state, running) + else { + return Err(CommitFloorError::NotConfirmed(state)); + }; + floor.advance(svn).map_err(CommitFloorError::Floor)?; + session.complete().map_err(CommitFloorError::Session) +} + +/// Why [`commit_self_svn_floor`] could not advance the floor. +/// +/// Keeps the session's or the floor's own error inside instead of flattening +/// both into one code, the same as [`SettleError`] does. +#[derive(Debug, PartialEq, Eq)] +pub enum CommitFloorError { + /// Reading or writing the session failed. + Session(S), + /// Writing the eRoT's own anti-rollback floor failed. + Floor(F), + /// No confirmed self-update is waiting for the floor, so there is no SVN + /// an image has proven itself at. Carries what the session says: `Idle` + /// when no self-update is in flight or the request arrived a second time, + /// `TrialPending` when it arrived before the trial boot was judged. + NotConfirmed(SelfUpdateState), +} + +impl core::fmt::Display for CommitFloorError { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + CommitFloorError::Session(err) => write!(f, "self-update session: {err}"), + CommitFloorError::Floor(err) => write!(f, "self-update floor: {err}"), + CommitFloorError::NotConfirmed(state) => { + write!( + f, + "no confirmed self-update to commit the floor to: session reads {state:?}" + ) + } + } + } +} + +impl core::error::Error + for CommitFloorError +{ + fn source(&self) -> Option<&(dyn core::error::Error + 'static)> { + match self { + CommitFloorError::Session(err) => Some(err), + CommitFloorError::Floor(err) => Some(err), + CommitFloorError::NotConfirmed(_) => None, + } + } +} + +/// Settles the eRoT's own self-update at the start of a boot and tells the +/// machine what it found. +/// +/// Belongs between [`bring_up`] and the first [`Event::PowerGood`]. The +/// settlement decides whether a new self-update may start, and a trial that +/// is running has to be declared before the walk begins, because what judges +/// it is the walk reaching [`State::Ready`](openprot_orchestrator_sm::State). +/// +/// Returns what [`PlatformDriver::settle_self_update_session`] found, so a +/// caller that needs more than the event (refusing a new self-update, +/// acting on an unclaimed image) reads it off the settlement. A board that +/// wired no self-update answers `Settled` and nothing is dispatched. +/// +/// A storage fault comes back unchanged. Nothing is dispatched then: the +/// boot has no honest answer about what the last self-update was doing, and +/// the caller decides what that costs. +pub fn settle_self_update_at_boot( + orchestrator: &mut Orchestrator, + driver: &mut PlatformDriver, +) -> Result, SvnFloorError>> { + let settlement = driver.settle_self_update_session()?; + if let Some(event) = settlement.event() { + orchestrator.dispatch(driver, event); + } + Ok(settlement) +} diff --git a/services/orchestrator/driver/src/driver/update.rs b/services/orchestrator/driver/src/driver/update.rs new file mode 100644 index 000000000..30643dacb --- /dev/null +++ b/services/orchestrator/driver/src/driver/update.rs @@ -0,0 +1,570 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The update pump: one in-flight update job, driven one bounded step +//! at a time by the event loop. Staging pushes bytes to the device, +//! then the board's verifier reads them back out of the staging region. +//! +//! A slot re-sync shares the machinery and ends here without an event, +//! because the SM never asked for it. + +use super::{DriverError, PlatformDriver, UpdateJob, UpdatePhase, VerifierState}; +use crate::board::{BoardCapabilities, Report}; +use core::convert::Infallible; +use openprot_orchestrator_sm::{ComponentId, Event}; +use orchestrator_capabilities::{ + trial_outcome, AuthenticatedImage, IncrementalVerifier, PollOutcome, Progress, SelfReset, + SelfUpdate, StageProgress, TrialOutcome, Updatable, VerifySession, +}; +use util_io::{ByteSource, ByteWindow}; + +/// What one pump call established, before the stall rule is applied. +enum Step { + /// The step ran and moved the job this far. + Working(Progress), + /// The device holds the complete payload; verification is next. + Staged, + /// The verifier authenticated the candidate, and the + /// `AuthenticatedImage` is what it read from the candidate. + Authenticated(AuthenticatedImage), + /// The candidate failed, or the device did. + Rejected, +} + +/// One [`PlatformDriver::pump_update`] round. +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub struct UpdatePoll { + /// `UpdateVerified` when the verifier accepts the candidate, or + /// `UpdateRejected` on fault, rejection, or stall. + pub event: Option, + /// How far the job has come, for the update source's progress + /// report. `None` once the job has ended. + pub progress: Option, +} + +impl UpdatePoll { + /// No job, or a job whose next move is the SM's. + pub(crate) const fn idle() -> Self { + Self { + event: None, + progress: None, + } + } +} + +impl PlatformDriver { + /// The frontend half of the update handshake: record `target` as the + /// component the staged candidate is for and `len` as how much of the + /// staging region the candidate occupies. Must succeed BEFORE + /// [`Event::UpdateRequest`] is dispatched; `AuthenticateStageUpdate` + /// with no stored job fails secure. Refuses an unknown id and a + /// second submit while one update is in flight; nothing is stored on + /// refusal, so a refused request can never surface as an update + /// event. + /// + /// `len` is checked against the staging region here, the first point + /// the driver sees it. Whether the candidate fits is settled for the + /// requester when the offer is answered, before a byte transfers + /// (see `RejectOffer` in the PLDM IPC design); this is the driver + /// failing closed behind that. Refusing here keeps the SM out of + /// `Updating` on a job that could never finish. + /// + /// The length stays on the job because the staging region is board + /// geometry and usually larger, so the reader needs to know where + /// the candidate ends. + /// + /// A slot re-sync counts as in flight. It is writing the staging + /// region to a device, and a new candidate would overwrite those + /// bytes halfway through. + pub fn submit_update(&mut self, target: ComponentId, len: u64) -> Result<(), DriverError> { + self.board + .components + .get(target.get() as usize) + .ok_or(DriverError::UnknownComponent)?; + // Busy first: one update at a time, whatever it targets. An + // update of the eRoT arriving mid-update is refused as + // `UpdateBusy`, not `NoErotUpdate`. + if self.pending_update.is_some() { + return Err(DriverError::UpdateBusy); + } + if self.is_self(target) { + self.check_self_update_may_start()?; + } + if len > self.board.update_staging.len() { + return Err(DriverError::CandidateOutOfRange); + } + // The region is about to hold a different candidate. The last + // activation cannot re-stage from it any more. + self.last_activated = None; + self.pending_update = Some(UpdateJob { + target, + len, + phase: UpdatePhase::Submitted, + prepare_commanded: false, + progress: Progress::start(len), + progress_since_millis: None, + }); + Ok(()) + } + + /// Discards the in-flight update: tells the device to drop what it + /// staged and clears the job. + /// + /// Infallible on the device side ([`Updatable::abandon`] cannot fail), + /// so the only refusal is having no job at all, which means the SM and + /// the driver have drifted apart. + pub fn discard_staged(&mut self) -> Result<(), DriverError> { + let target = self + .pending_update + .as_ref() + .ok_or(DriverError::NoUpdateJob)? + .target; + let updatable = self + .board + .components + .get_mut(target.get() as usize) + .map(|component| &mut component.updatable) + .ok_or(DriverError::UnknownComponent)?; + updatable.abandon(); + self.pending_update = None; + // The region's contents are being dropped. A later commit must + // not re-stage from it. + self.last_activated = None; + self.abandon_verification(); + Ok(()) + } + + /// Whether the eRoT may start an update of itself. + /// + /// Checked at submit, where a refusal only declines the request: + /// the driver stores nothing and the state machine never sees + /// `UpdateRequest`, so no state changes and no effect runs. Refusing + /// after the state machine has commanded the activation would fail + /// that effect and lock the platform. + /// + /// A confirmed trial stops blocking once the session closes, by + /// [`commit_self_svn_floor`](crate::commit_self_svn_floor) or at the + /// next boot by [`settle_self_update`](crate::settle_self_update). + fn check_self_update_may_start(&self) -> Result<(), DriverError> { + let self_update = self + .board + .self_update + .as_ref() + .ok_or(DriverError::NoErotUpdate)?; + let state = self_update + .session + .state() + .map_err(|_| DriverError::SelfUpdateFault)?; + let running = self_update + .session + .running() + .map_err(|_| DriverError::SelfUpdateFault)?; + match trial_outcome(state, running) { + // `InProgress`: this boot is the trial being judged. + // `ConfirmedUncommitted`: the floor has not taken the SVN + // the session holds. The session is still in use in each + // case, and `prepare` would write over it, so refuse. + TrialOutcome::InProgress | TrialOutcome::ConfirmedUncommitted { .. } => { + Err(DriverError::UpdateBusy) + } + // `NoSession`: no session to protect. `Unconfirmed`: the + // boot that would confirm the session will not come, so + // settlement reverts the session and `prepare` may write a + // new one. + TrialOutcome::NoSession | TrialOutcome::Unconfirmed => Ok(()), + } + } + + /// Records the SM's `AuthenticateStageUpdate` command. Setting it + /// twice is harmless, so a repeated command needs no guard. + pub fn prepare_update(&mut self) -> Result<(), DriverError> { + let job = self + .pending_update + .as_mut() + .ok_or(DriverError::NoUpdateJob)?; + job.prepare_commanded = true; + Ok(()) + } + + /// Activates the staged candidate: the device's next boot runs it, + /// tentatively. Clears the job, which has reached its end. + /// + /// The commit is not here. Activation proposes; `BootConfirmed` and + /// `CommitSvnFloor` decide. + /// + /// The eRoT's own candidate goes through + /// [`activate_self_update`](Self::activate_self_update) instead: it is + /// the thing being rebooted, so there is no device to command and no + /// walk to watch. + pub fn activate_update(&mut self) -> Result<(), DriverError> { + let job = self + .pending_update + .as_ref() + .ok_or(DriverError::NoUpdateJob)?; + let UpdatePhase::Authenticated(image) = job.phase else { + return Err(DriverError::CandidateNotAuthenticated); + }; + if self.is_self(job.target) { + // The activation ends in a reset that does not return, so + // `Ok` is uninhabited and `let Err` is the only pattern. + let Err(fault) = self.activate_self_update(image); + return Err(fault); + } + let (target, len) = (job.target, job.len); + let updatable = self + .board + .components + .get_mut(target.get() as usize) + .map(|component| &mut component.updatable) + .ok_or(DriverError::UnknownComponent)?; + updatable.activate().map_err(|_| DriverError::UpdateFault)?; + self.pending_update = None; + self.last_activated = Some((target, len)); + Ok(()) + } + + /// Activates the eRoT's own candidate: record the candidate image's + /// SVN in the session, mark the trial pending, reset into the + /// candidate. + /// + /// `prepare` records the SVN before `set_trial_pending` marks the + /// trial, the order + /// [`SelfUpdate`](orchestrator_capabilities::SelfUpdate) states. A + /// crash between the two leaves a pending trial with the old image + /// still running, which the next boot reads as unconfirmed. The other + /// order would boot a trial with no session to judge it. + /// + /// Returns only on failure, as the success type says. The job is + /// cleared before the reset, because nothing after it runs and a + /// failed reset must not leave a job the next boot would find. + /// + /// So a failed reset leaves the session `TrialPending` and no job in + /// RAM. The durable state says the same thing: the candidate sits in + /// the staging region and the session marks the trial, so the next + /// reset from any source boots the trial and the boot after judges + /// it. Only retrying the activation is lost, and a retry would need + /// the candidate staged again anyway. + fn activate_self_update( + &mut self, + image: AuthenticatedImage, + ) -> Result { + let svn = image.svn.ok_or(DriverError::SelfActivateNoSvn)?; + // `board` and `pending_update` are separate fields, so holding + // this borrow of `board` does not block the assignment to + // `pending_update` below. + let self_update = self + .board + .self_update + .as_mut() + .ok_or(DriverError::NoErotUpdate)?; + let session = &mut self_update.session; + session + .prepare(svn) + .map_err(|_| DriverError::SelfUpdateFault)?; + session + .set_trial_pending() + .map_err(|_| DriverError::SelfUpdateFault)?; + self.pending_update = None; + self_update + .reset + .reset() + .map_err(|_| DriverError::SelfResetFault) + } + + /// One step of the in-flight update, called by the event loop between + /// events, as [`poll_boot_walks`](Self::poll_boot_walks) is. + /// + /// Staging and verification each run one bounded step per call, so + /// the loop stays live through a transfer that takes minutes. A job + /// that stops making progress for longer than the board's stall + /// budget is abandoned here rather than waited out. + /// + /// An update ends in `UpdateVerified` or `UpdateRejected`, and the + /// job stays until the SM answers with `ActivateUpdate` or + /// `DiscardStaged`. + /// + /// A slot re-sync is different. It ends here with no event and + /// without verification. The SM never asked for it, a verdict would + /// activate the image a second time, and the image is the one the + /// device is already running, which was verified on its way in. + pub fn pump_update(&mut self, now_millis: u64) -> UpdatePoll { + let Some(job) = self.pending_update.as_mut() else { + return UpdatePoll::idle(); + }; + let since = *job.progress_since_millis.get_or_insert(now_millis); + let phase = job.phase; + let before = job.progress; + + let stepped = match phase { + UpdatePhase::Submitted if job.prepare_commanded => { + job.phase = UpdatePhase::Staging; + return UpdatePoll { + event: None, + progress: Some(job.progress), + }; + } + // Nothing to pump: the SM has not commanded the work yet, + // or the SM owns the next move (Authenticated waits for + // ActivateUpdate). + UpdatePhase::Submitted | UpdatePhase::Authenticated(_) => return UpdatePoll::idle(), + UpdatePhase::Staging | UpdatePhase::Resyncing => self.poll_staging(), + // Bytes are in. The verifier's state says whether this pump + // starts a session or advances one. + UpdatePhase::Staged => match self.update_verifier.take() { + Some(VerifierState::Idle(verifier)) => { + self.update_verifier = Some(VerifierState::Verifying(verifier.start())); + return self.opened_verification(now_millis); + } + Some(VerifierState::Verifying(session)) => self.poll_verification(session), + None => return self.reject_job(), + }, + }; + + let step = match stepped { + Ok(step) => step, + Err(_) => return self.reject_job(), + }; + + let job = match self.pending_update.as_mut() { + Some(job) => job, + None => return UpdatePoll::idle(), + }; + match step { + Step::Working(progress) => { + job.progress = progress; + if progress.written > before.written { + job.progress_since_millis = Some(now_millis); + } else if now_millis.saturating_sub(since) >= self.board.update_stall_budget_millis + { + return match phase { + UpdatePhase::Resyncing => self.end_resync(), + _ => self.reject_job(), + }; + } + UpdatePoll { + event: None, + // Nobody asked for a re-sync, so there is no + // requester to report its progress to. + progress: (phase != UpdatePhase::Resyncing).then_some(progress), + } + } + // A re-sync ends in the driver. Telling the SM the payload + // is staged would activate the image a second time, and the + // device is already running it. + Step::Staged if phase == UpdatePhase::Resyncing => { + self.pending_update = None; + // Both slots hold the image now, so the floor may move. + if let Some((id, svn)) = self.held_floor.take() + && self.advance_floor(id, svn).is_err() + { + self.report(Report::SvnFloorCommitFailed(id)); + } + UpdatePoll::idle() + } + Step::Staged => { + job.phase = UpdatePhase::Staged; + UpdatePoll { + event: None, + progress: Some(job.progress), + } + } + Step::Authenticated(image) => { + job.phase = UpdatePhase::Authenticated(image); + UpdatePoll { + event: Some(Event::UpdateVerified), + progress: None, + } + } + // A failed re-sync leaves the running image committed and + // the spare slot stale. Report it. The SM has nothing to + // decide here. + Step::Rejected if phase == UpdatePhase::Resyncing => self.end_resync(), + Step::Rejected => self.reject_job(), + } + } + + /// Runs on the pump that starts the session. Verification counts its + /// own bytes from zero, so the progress and the stall budget start + /// over here. + fn opened_verification(&mut self, now_millis: u64) -> UpdatePoll { + let Some(job) = self.pending_update.as_mut() else { + return UpdatePoll::idle(); + }; + job.progress = Progress::start(job.len); + job.progress_since_millis = Some(now_millis); + UpdatePoll { + event: None, + progress: Some(job.progress), + } + } + + /// Drops a session the driver cannot poll and returns `error`. + /// `poll_verification` takes the session before it knows the step can + /// run, so every early return has to put the verifier back. Miss one + /// and `update_verifier` stays `None`, and nothing is ever verified + /// again. + fn drop_session( + &mut self, + session: ::Session, + error: DriverError, + ) -> DriverError { + self.update_verifier = Some(VerifierState::Idle(session.abandon())); + error + } + + /// One verification step: polls `session` over the staging region, + /// the same window staging wrote through. An error means the driver + /// could not run the step. A bad candidate is `Step::Rejected`. + fn poll_verification( + &mut self, + session: ::Session, + ) -> Result { + let len = match self.pending_update.as_ref() { + Some(job) => job.len, + None => return Err(self.drop_session(session, DriverError::NoUpdateJob)), + }; + let window = match ByteWindow::try_new(&self.board.update_staging, 0, len) { + Ok(window) => window, + Err(_) => return Err(self.drop_session(session, DriverError::CandidateOutOfRange)), + }; + Ok(match session.poll(&window) { + PollOutcome::Processing { session, progress } => { + self.update_verifier = Some(VerifierState::Verifying(session)); + Step::Working(progress) + } + PollOutcome::Authenticated { verifier, image } => { + self.update_verifier = Some(VerifierState::Idle(verifier)); + let target = self.pending_update.as_ref().map(|job| job.target); + // `prepare` takes an `Svn`, so no SVN means no session + // and no trial to mark: the candidate could never run. + // Rejected here, not at the activation, where refusing + // fails the effect and locks the platform. + if image.svn.is_none() && target.is_some_and(|id| self.is_self(id)) { + self.report(Report::SelfImageNoSvn); + return Ok(Step::Rejected); + } + // The phase carries the image from here. Only the eRoT's + // session records the candidate's SVN; see "Where the SVN + // comes from" in + // docs/src/design/erot-self-verification.md. + Step::Authenticated(image) + } + PollOutcome::Rejected(v) => { + self.update_verifier = Some(VerifierState::Idle(v)); + Step::Rejected + } + PollOutcome::Fault(v, _) => { + self.update_verifier = Some(VerifierState::Idle(v)); + // A fault and a bad image both end the job with + // UpdateRejected. The report says which one happened. + self.report(Report::UpdateVerifierFault); + Step::Rejected + } + }) + } + + /// One staging step: borrows the staging region and the device as + /// separate fields so the window can be read while the device writes. + fn poll_staging(&mut self) -> Result { + let job = self + .pending_update + .as_ref() + .ok_or(DriverError::NoUpdateJob)?; + if !job.prepare_commanded { + return Err(DriverError::UpdateNotCommanded); + } + let (target, len) = (job.target, job.len); + let window = ByteWindow::try_new(&self.board.update_staging, 0, len) + .map_err(|_| DriverError::CandidateOutOfRange)?; + let updatable = self + .board + .components + .get_mut(target.get() as usize) + .map(|component| &mut component.updatable) + .ok_or(DriverError::UnknownComponent)?; + match updatable.poll_stage(&window) { + Ok(StageProgress::Transferring { progress }) => Ok(Step::Working(progress)), + Ok(StageProgress::Ready) => Ok(Step::Staged), + Err(_) => Ok(Step::Rejected), + } + } + + /// Ends a re-sync that failed or stalled. The SM never knew about + /// this job, so nothing else clears it and the pump would retry the + /// same failure forever. The running image stays committed. The + /// stale slot is reported. + /// + /// Rejecting instead would hand the SM a verdict for a job it never + /// started. `reject_job` keeps the job and waits for `DiscardStaged`, + /// which only `Updating` sends, and the SM is in `Ready` here. The + /// job would never clear and every later update would be refused as + /// busy. + fn end_resync(&mut self) -> UpdatePoll { + let Some(job) = self.pending_update.take() else { + return UpdatePoll::idle(); + }; + if let Some(updatable) = self + .board + .components + .get_mut(job.target.get() as usize) + .map(|component| &mut component.updatable) + { + updatable.abandon(); + } + // The spare still holds the old image, so the floor stays where + // it is. Moving it would leave the spare below the floor and + // unbootable, which is what the ordering exists to avoid. + self.held_floor = None; + self.report(Report::SlotResyncFailed(job.target)); + UpdatePoll::idle() + } + + /// Ends the job the way the SM understands: the device drops what it + /// staged and the verdict travels as `UpdateRejected`. The job itself + /// stays until the SM answers with `DiscardStaged`, so the two sides + /// never disagree about whether an update is in flight. + fn reject_job(&mut self) -> UpdatePoll { + if let Some(job) = self.pending_update.as_mut() { + job.phase = UpdatePhase::Submitted; + job.prepare_commanded = false; + } + self.abandon_job(); + self.abandon_verification(); + UpdatePoll { + event: Some(Event::UpdateRejected), + progress: None, + } + } + + /// Tells the device to drop what it was staging. Leaves the job + /// alone: the SM clears it when it answers `DiscardStaged`. + fn abandon_job(&mut self) { + let Some(job) = self.pending_update.as_ref() else { + return; + }; + let target = job.target.get() as usize; + if let Some(updatable) = self + .board + .components + .get_mut(target) + .map(|component| &mut component.updatable) + { + updatable.abandon(); + } + } + + /// If a verification session is active, abandons it and returns the + /// verifier to idle. + fn abandon_verification(&mut self) { + let state = self.update_verifier.take(); + self.update_verifier = match state { + Some(VerifierState::Verifying(session)) => Some(VerifierState::Idle(session.abandon())), + other => other, + }; + } + + /// Target of the in-flight update, if one was submitted. + pub fn pending_update(&self) -> Option { + self.pending_update.as_ref().map(|job| job.target) + } +} diff --git a/services/orchestrator/driver/src/lib.rs b/services/orchestrator/driver/src/lib.rs index b2644addc..f5a81a35d 100644 --- a/services/orchestrator/driver/src/lib.rs +++ b/services/orchestrator/driver/src/lib.rs @@ -7,7 +7,7 @@ //! [`PlatformDriver`] implements the SM's [`Platform`] seam, delegating each //! `Effect` to a board-composed capability per the platform-boundary contract //! (`docs/src/design/orchestrator/orchestrator-model.md` §6). Effects whose -//! capability is not composed yet fail closed in `execute`; the driver grows +//! capability is not composed yet fail secure in `execute`; the driver grows //! an executor only when the capability it delegates to exists. //! //! Synchronous results (the verification verdict) return through `execute`; @@ -23,7 +23,7 @@ //! //! Boot-walk verdicts are the one asynchronous read: the run loop calls //! [`PlatformDriver::poll_boot_walks`] and dispatches the returned events -//! (`ComponentReady`/`Booted`/`Timeout`) into the SM. +//! (`ComponentReady`/`Booted`/`BootFailed`) into the SM. //! //! [`Platform`]: openprot_orchestrator_sm::Platform @@ -36,6 +36,11 @@ mod driver; mod tests; pub use board::{ - Board, BoardCapabilities, ImageSource, Report, ReportSink, SvnFloorBinding, Verdict, Verifier, + Board, BoardCapabilities, ComponentWiring, ErotUpdate, ImageSource, Measurement, Report, + ReportSink, SvnFloorBinding, Verdict, Verifier, +}; +pub use driver::{ + bring_up, commit_self_svn_floor, request_update, settle_self_update, + settle_self_update_at_boot, BootWalkPoll, CommitFloorError, DriverError, PlatformDriver, + SelfUpdateSettlement, SettleError, UpdatePoll, }; -pub use driver::{BootWalkPoll, DriverError, PlatformDriver}; diff --git a/services/orchestrator/driver/src/tests.rs b/services/orchestrator/driver/src/tests.rs index c18b82f41..489736fda 100644 --- a/services/orchestrator/driver/src/tests.rs +++ b/services/orchestrator/driver/src/tests.rs @@ -5,10 +5,14 @@ extern crate std; use crate::*; use openprot_orchestrator_sm::{ - ComponentAttrs, ComponentId, ComponentKind, Effect, Event, Orchestrator, Platform, - PowerOnResult, State, + BootFailureKind, ComponentAttrs, ComponentId, ComponentKind, Effect, Event, Orchestrator, + Platform, PowerOnResult, State, }; -use orchestrator_capabilities::{BootWatch, FailureCause, Svn, SvnFloor, WalkVerdict}; +use orchestrator_capabilities::{ + AuthenticatedImage, BootWatch, FailureCause, Progress, Recovery, RestoreOutcome, RunningImage, + SelfReset, SelfUpdate, SelfUpdateState, Svn, SvnFloor, WalkVerdict, +}; +use util_io::{ByteReadError, ByteSource}; const C0: ComponentId = ComponentId::new(0); @@ -109,10 +113,57 @@ impl core::error::Error for VerifierError {} /// chunks. struct XorVerifier { fault: bool, - /// The manifest SVN this verifier reports for an authenticated image. + /// What this verifier reports as the image's measurement. A real one + /// hashes the image; this one is told what to say. + measurement: Option, + /// The manifest SVN this verifier reports for an authenticated image, + /// or `None` for one that authenticates without reading a manifest. /// A real verifier reads it from the signed manifest of the image it /// just checked; the test image format has no manifest, so tests pin it. - svn: u32, + svn: Option, +} + +/// The other constructors are [`accepting`](Self::accepting) with one field +/// changed, which is all any test varies. +impl XorVerifier { + /// Authenticates an image that passes the magic and XOR check, reporting + /// [`MOCK_SVN`] and no measurement. + const fn accepting() -> Self { + Self { + fault: false, + svn: Some(MOCK_SVN), + measurement: None, + } + } + + /// Authenticates the same images as [`accepting`](Self::accepting) and + /// reports no SVN, as a verifier that checks a signature without + /// reading a manifest does. Nothing may commit a floor behind it. + const fn unversioned() -> Self { + Self { + fault: false, + svn: None, + measurement: None, + } + } + + /// Errors out instead of returning a verdict; the image is never read. + const fn faulting() -> Self { + Self { + fault: true, + svn: Some(MOCK_SVN), + measurement: None, + } + } + + /// Reports `measurement` for an image that passes the check. + const fn measuring(measurement: Measurement) -> Self { + Self { + fault: false, + svn: Some(MOCK_SVN), + measurement: Some(measurement), + } + } } impl Verifier for XorVerifier { @@ -144,7 +195,10 @@ impl Verifier for XorVerifier { } let ok = len > IMAGE_MAGIC.len() && magic == IMAGE_MAGIC && xor == 0; Ok(if ok { - Verdict::Authenticated { svn: Svn(self.svn) } + Verdict::Authenticated(AuthenticatedImage { + svn: self.svn.map(Svn), + measurement: self.measurement, + }) } else { Verdict::Rejected }) @@ -166,6 +220,9 @@ impl core::error::Error for ResetFault {} /// line after the control moves into the driver. struct MockReset { held: std::rc::Rc>, + /// Times the line was asserted, so a test can tell one boot from a + /// second one. + holds: std::rc::Rc>, fail: bool, } @@ -173,6 +230,7 @@ impl MockReset { fn new() -> Self { Self { held: std::rc::Rc::new(core::cell::Cell::new(true)), + holds: std::rc::Rc::new(core::cell::Cell::new(0)), fail: false, } } @@ -185,6 +243,7 @@ impl orchestrator_capabilities::BootControl for MockReset { if self.fail { return Err(ResetFault); } + self.holds.set(self.holds.get() + 1); self.held.set(true); Ok(()) } @@ -199,9 +258,9 @@ impl orchestrator_capabilities::BootControl for MockReset { } /// Boot walk without a device; scripted verdicts. An exhausted script -/// holds its last verdict; an empty script waits forever. `arm` rewinds +/// holds its last verdict; an empty script waits forever. `start` rewinds /// to the script start, so a fresh attempt is observable from the -/// verdicts alone — no poll or arm counters needed. +/// verdicts alone — no poll or start counters needed. struct MockWalk { verdicts: std::vec::Vec, next: usize, @@ -221,7 +280,7 @@ impl MockWalk { } impl BootWatch for MockWalk { - fn arm(&mut self) { + fn start(&mut self) { self.next = 0; } @@ -266,11 +325,393 @@ struct MockFloor { impl MockFloor { fn new() -> Self { + Self::with_floor(Svn(0)) + } + + fn with_floor(floor: Svn) -> Self { Self { - floor: 0, + floor: floor.0, fail: false, } } + + fn faulting() -> Self { + Self { + floor: 0, + fail: true, + } + } +} + +/// The device table the mock boards wire against. Two entries, because the +/// tests only ever build boards of one or two components, and `bring_up` +/// checks each wiring against its row here. +/// +/// The rows exist for that identity check and nothing else. A test that +/// builds its driver directly never reaches `bring_up`, and no other code +/// reads `ComponentWiring::device`, so a single-component fixture pointing +/// at row 0 says nothing about what that component is. +static MOCK_DEVICES: [orchestrator_config::DeviceConfig; 2] = [ + orchestrator_config::DeviceConfig::erot("erot", None), + orchestrator_config::DeviceConfig::new( + "dev", + 0, + &[orchestrator_config::BootCheckpoint::new( + "up", + 1, + core::time::Duration::from_millis(10), + )], + None, + ComponentAttrs::active_required(), + ), +]; + +/// Chain entries for an all-passive chain of `N` components, which is what +/// most of these tests want. Ids are positions, as the driver requires. +fn passive_entries() -> [(ComponentId, ComponentAttrs); N] { + core::array::from_fn(|i| { + ( + ComponentId::new(i as u8), + ComponentAttrs::passive_required(), + ) + }) +} + +/// The same, with the kinds a test cares about. +fn entries_with_kinds( + kinds: [ComponentKind; N], +) -> [(ComponentId, ComponentAttrs); N] { + core::array::from_fn(|i| { + let mut attrs = ComponentAttrs::passive_required(); + attrs.kind = kinds[i]; + (ComponentId::new(i as u8), attrs) + }) +} + +/// Update adapter without a HAL. Stages the whole payload in one step by +/// default; `stepping`, `stalling` and `faulting` give the pump the other +/// shapes it has to handle. +struct MockUpdatable { + ready: bool, + active: bool, + abandons: usize, + /// Transferring steps before the device reports Ready. + steps: usize, + written: u64, + /// Answers Transferring forever without moving `written`: the stall + /// the pump's budget exists for. + stalls: bool, + /// Fails every step. + faults: bool, + /// How many staging passes go fine before `stalls` or `faults` kick + /// in. 0 means the device breaks from the start. 1 means the first + /// transfer works, so an update can reach its commit, and the second + /// pass is the one that goes wrong. + good_passes: usize, + /// Completed stagings, so a test can tell a re-sync happened. + stagings: usize, + /// Successful activations. A re-sync leaves the device ready again, + /// so a second `activate` would succeed and nothing else would show + /// it. + activations: usize, +} + +/// Bytes one staging step writes. +const STAGE_CHUNK: u64 = 8; + +impl MockUpdatable { + /// Reports Ready on the first step. + fn new() -> Self { + Self { + ready: false, + active: false, + abandons: 0, + steps: 0, + written: 0, + stalls: false, + faults: false, + good_passes: 0, + stagings: 0, + activations: 0, + } + } + + /// Transfers in `steps` steps before reporting Ready. + fn stepping(steps: usize) -> Self { + Self { + steps, + ..Self::new() + } + } + + fn stalling() -> Self { + Self { + stalls: true, + ..Self::new() + } + } + + fn faulting() -> Self { + Self { + faults: true, + ..Self::new() + } + } + + /// The first transfer works. Every step of the second one fails. + fn faulting_on_the_second_pass() -> Self { + Self { + faults: true, + good_passes: 1, + ..Self::new() + } + } + + /// The first transfer works. The second one goes quiet. + fn stalling_on_the_second_pass() -> Self { + Self { + stalls: true, + good_passes: 1, + ..Self::new() + } + } +} + +/// The staging region: a fixed buffer an update source would have +/// written into. +struct MemStaging { + bytes: [u8; STAGING_LEN], +} + +/// Room for the candidate plus slack, so a test can tell the region's +/// length from the candidate's. +const STAGING_LEN: usize = 64; + +/// What `mock_board` declares as its candidate length: shorter than the +/// region, so the job carries the actual occupied range. +const CANDIDATE_LEN: u64 = 32; + +impl MemStaging { + fn new() -> Self { + Self { + bytes: core::array::from_fn(|i| i as u8), + } + } +} + +impl ByteSource for MemStaging { + fn len(&self) -> u64 { + self.bytes.len() as u64 + } + + fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<(), ByteReadError> { + let start = offset as usize; + let end = start + .checked_add(buf.len()) + .ok_or(ByteReadError::OutOfRange)?; + if end > self.bytes.len() { + return Err(ByteReadError::OutOfRange); + } + buf.copy_from_slice(&self.bytes[start..end]); + Ok(()) + } +} + +/// Test verifier. Reads `chunk` bytes per poll, so it can be made to +/// take several polls like a real one. +/// +/// It reads the bytes it is handed and checks them, which catches a +/// window opened at the wrong offset. It cannot catch a window of the +/// wrong length, because MemStaging's bytes repeat the same pattern all +/// the way across. The length is checked in +/// `verification_advances_one_bounded_step_per_pump` instead, through +/// the total it asserts. +struct StubVerifier { + /// Bytes read per poll. A chunk shorter than the candidate makes + /// verification take several polls, as a real verifier does. + chunk: u64, + /// One verdict per session, in order. The last entry repeats, so a + /// list of one answers every session the same way. + verdicts: &'static [StubVerdict], + /// Sessions started so far, the index into `verdicts`. + sessions: usize, +} + +/// How a stub session is told to end. +#[derive(Clone, Copy, PartialEq, Eq)] +enum StubVerdict { + Authenticate, + /// Authenticates but reports no SVN, like a verifier that checks a + /// signature without reading a manifest. + AuthenticateVersionless, + Reject, + Fault, + /// Never reaches a verdict and never moves `written`: the stalled + /// verifier the pump's budget exists for. + Stall, +} + +/// A live stub session. Holds the verifier so a terminal outcome can +/// hand it back. +struct StubSession { + verifier: StubVerifier, + /// Bytes read so far. + offset: u64, + verdict: StubVerdict, +} + +#[derive(Debug)] +struct StubVerifierFault; + +impl core::fmt::Display for StubVerifierFault { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.write_str("stub verifier fault") + } +} + +impl core::error::Error for StubVerifierFault {} + +impl StubVerifier { + /// Gets through the whole candidate in one poll. + fn new(verdicts: &'static [StubVerdict]) -> Self { + Self { + chunk: CANDIDATE_LEN, + verdicts, + sessions: 0, + } + } + + fn accepting() -> Self { + Self::new(&[StubVerdict::Authenticate]) + } + + /// Authenticates every candidate and reports no SVN for it. + fn unversioned() -> Self { + Self::new(&[StubVerdict::AuthenticateVersionless]) + } + + fn rejecting() -> Self { + Self::new(&[StubVerdict::Reject]) + } + + fn faulting() -> Self { + Self::new(&[StubVerdict::Fault]) + } + + fn stalling() -> Self { + Self::new(&[StubVerdict::Stall]) + } + + /// Rejects the first session and accepts the second, so one driver + /// can run a failed update and then a good one. The pump opens one + /// session per candidate, so that is one candidate each. + fn rejecting_then_accepting() -> Self { + Self::new(&[StubVerdict::Reject, StubVerdict::Authenticate]) + } + + /// Takes `polls` polls to get through a `CANDIDATE_LEN` candidate. + fn chunked(polls: u64) -> Self { + Self::chunked_verdicts(polls, &[StubVerdict::Authenticate]) + } + + /// A chunked verifier with a verdict per session, for tests that + /// have to tell a new session from a leftover one. + fn chunked_verdicts(polls: u64, verdicts: &'static [StubVerdict]) -> Self { + assert!( + polls > 0 && CANDIDATE_LEN % polls == 0, + "a chunk that does not divide the candidate makes the poll count a guess" + ); + Self { + chunk: CANDIDATE_LEN / polls, + ..Self::new(verdicts) + } + } +} + +impl orchestrator_capabilities::IncrementalVerifier for StubVerifier { + type Error = StubVerifierFault; + type Session = StubSession; + + fn start(mut self) -> StubSession { + let verdict = self.verdicts[self.sessions.min(self.verdicts.len() - 1)]; + self.sessions += 1; + StubSession { + verifier: self, + offset: 0, + verdict, + } + } +} + +impl orchestrator_capabilities::VerifySession for StubSession { + type Verifier = StubVerifier; + type Error = StubVerifierFault; + + fn poll(mut self, payload: &dyn ByteSource) -> orchestrator_capabilities::PollOutcome { + use orchestrator_capabilities::PollOutcome; + + let total = payload.len(); + if total == 0 { + return PollOutcome::Fault(self.verifier, StubVerifierFault); + } + if self.verdict == StubVerdict::Stall { + let progress = Progress::start(total); + return PollOutcome::Processing { + session: self, + progress, + }; + } + + let chunk = self.verifier.chunk.min(total - self.offset) as usize; + let mut buf = [0u8; STAGING_LEN]; + if payload.read_at(self.offset, &mut buf[..chunk]).is_err() { + return PollOutcome::Fault(self.verifier, StubVerifierFault); + } + // MemStaging holds byte i at offset i. If the driver opened the + // window at the wrong offset, these bytes do not match. + for (i, byte) in buf[..chunk].iter().enumerate() { + if *byte != (self.offset + i as u64) as u8 { + return PollOutcome::Fault(self.verifier, StubVerifierFault); + } + } + + self.offset += chunk as u64; + if self.offset < total { + let progress = Progress { + written: self.offset, + total, + }; + return PollOutcome::Processing { + session: self, + progress, + }; + } + match self.verdict { + StubVerdict::Authenticate => PollOutcome::Authenticated { + verifier: self.verifier, + image: AuthenticatedImage { + svn: Some(Svn(CANDIDATE_SVN)), + // The update path's stub hashes nothing. + measurement: None, + }, + }, + StubVerdict::AuthenticateVersionless => PollOutcome::Authenticated { + verifier: self.verifier, + image: AuthenticatedImage { + svn: None, + measurement: None, + }, + }, + StubVerdict::Reject => PollOutcome::Rejected(self.verifier), + StubVerdict::Fault | StubVerdict::Stall => { + PollOutcome::Fault(self.verifier, StubVerifierFault) + } + } + } + + fn abandon(self) -> StubVerifier { + self.verifier + } } impl orchestrator_capabilities::SvnFloor for MockFloor { @@ -292,6 +733,198 @@ impl orchestrator_capabilities::SvnFloor for MockFloor { } } +impl orchestrator_capabilities::Updatable for MockUpdatable { + fn poll_stage( + &mut self, + payload: &dyn util_io::ByteSource, + ) -> Result + { + let misbehaves = self.stagings >= self.good_passes; + if self.faults && misbehaves { + return Err(orchestrator_capabilities::UpdateError::Device); + } + let total = payload.len(); + if self.stalls && misbehaves { + return Ok(orchestrator_capabilities::StageProgress::Transferring { + progress: Progress { + written: self.written, + total, + }, + }); + } + if self.steps > 0 { + self.steps -= 1; + self.written = (self.written + STAGE_CHUNK).min(total); + return Ok(orchestrator_capabilities::StageProgress::Transferring { + progress: Progress { + written: self.written, + total, + }, + }); + } + self.ready = true; + self.stagings += 1; + self.written = 0; + Ok(orchestrator_capabilities::StageProgress::Ready) + } + + fn abandon(&mut self) { + self.ready = false; + self.abandons += 1; + } + + fn activate(&mut self) -> Result<(), orchestrator_capabilities::UpdateError> { + if !self.ready { + return Err(orchestrator_capabilities::UpdateError::NothingStaged); + } + self.active = true; + self.activations += 1; + Ok(()) + } +} + +/// The eRoT's own reset. A test process cannot reset itself, so this +/// counts the attempt and fails, like a reset that did not happen. The +/// count is what a driver test reads once activation calls `reset`. +struct MockSelfReset { + attempts: u32, +} + +impl MockSelfReset { + const fn new() -> Self { + Self { attempts: 0 } + } +} + +#[derive(Debug, PartialEq, Eq)] +struct MockResetFault; + +impl core::fmt::Display for MockResetFault { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.write_str("mock reset fault") + } +} + +impl core::error::Error for MockResetFault {} + +impl SelfReset for MockSelfReset { + type Error = MockResetFault; + + fn reset(&mut self) -> Result { + self.attempts += 1; + Err(MockResetFault) + } +} + +/// The eRoT's own update session, in RAM. `running` says which image this +/// boot runs, the trial one or the confirmed one, as a test sets it. +struct MockSelfUpdate { + state: SelfUpdateState, + running: RunningImage, + fail: bool, +} + +impl MockSelfUpdate { + fn idle() -> Self { + Self { + state: SelfUpdateState::Idle, + running: RunningImage::Confirmed, + fail: false, + } + } + + fn with_session(state: SelfUpdateState, running: RunningImage) -> Self { + Self { + state, + running, + fail: false, + } + } +} + +impl SelfUpdate for MockSelfUpdate { + type Error = SelfSessionFault; + + fn state(&self) -> Result { + self.checked().map(|_| self.state) + } + + fn running(&self) -> Result { + self.checked().map(|_| self.running) + } + + fn prepare(&mut self, svn: Svn) -> Result<(), SelfSessionFault> { + self.checked()?; + self.state = SelfUpdateState::Prepared { svn }; + Ok(()) + } + + fn set_trial_pending(&mut self) -> Result<(), SelfSessionFault> { + self.checked()?; + // Marking the trial pending twice is a retry, not a fault. + let (SelfUpdateState::Prepared { svn } | SelfUpdateState::TrialPending { svn }) = + self.state + else { + return Err(SelfSessionFault); + }; + self.state = SelfUpdateState::TrialPending { svn }; + Ok(()) + } + + fn confirm(&mut self) -> Result<(), SelfSessionFault> { + self.checked()?; + // Confirming a confirmed session is the same retry. + let (SelfUpdateState::TrialPending { svn } | SelfUpdateState::Committed { svn }) = + self.state + else { + return Err(SelfSessionFault); + }; + self.state = SelfUpdateState::Committed { svn }; + Ok(()) + } + + fn complete(&mut self) -> Result<(), SelfSessionFault> { + self.checked()?; + // A session still being judged is dropped with revert, never + // completed, so complete faults rather than discard it. + if !matches!( + self.state, + SelfUpdateState::Committed { .. } | SelfUpdateState::Idle + ) { + return Err(SelfSessionFault); + } + self.state = SelfUpdateState::Idle; + Ok(()) + } + + fn revert(&mut self) -> Result<(), SelfSessionFault> { + self.checked()?; + self.state = SelfUpdateState::Idle; + Ok(()) + } +} + +impl MockSelfUpdate { + fn checked(&self) -> Result<(), SelfSessionFault> { + if self.fail { + Err(SelfSessionFault) + } else { + Ok(()) + } + } +} + +#[derive(Debug, PartialEq, Eq)] +struct SelfSessionFault; + +impl core::fmt::Display for SelfSessionFault { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.write_str("self-update session fault") + } +} + +impl core::error::Error for SelfSessionFault {} + /// The test board's type choices. struct MockBoard; @@ -301,20 +934,85 @@ impl BoardCapabilities for MockBoard { type BootControl = MockReset; type BootWatch = MockWalk; type SvnFloor = MockFloor; + type ReportSink = RecordingSink; + type Updatable = MockUpdatable; + type Recovery = (); + type DeviceTrial = (); + type Staging = MemStaging; + type UpdateVerifier = StubVerifier; + type SelfUpdate = MockSelfUpdate; + type SelfReset = MockSelfReset; + type ResetSignal = u8; + type Probe = u8; +} + +/// The SVN the update verifier reads from a candidate's manifest. +/// Distinct from [`MOCK_SVN`], so a test can tell the image a walk +/// verified from the candidate an update authenticated. +const CANDIDATE_SVN: u32 = 6; + +/// The SVN `mock_board`'s verifier vouches for. Tests that read the floor +/// back assert against it. +const MOCK_SVN: u32 = 5; + +/// The SVN the self-trial fixtures record. Distinct from [`MOCK_SVN`] and +/// [`CANDIDATE_SVN`], so a test reading the floor back can tell which +/// write moved it. +const SELF_TRIAL_SVN: u32 = 7; + +/// How long a job may make no progress before the pump abandons it. +const STALL_BUDGET_MILLIS: u64 = 1_000; + +/// Happy-path wiring for the component at `index`. Tests override the one +/// capability they exercise with `..mock_component(index)`. +fn mock_component(index: usize) -> ComponentWiring { + let device = MOCK_DEVICES + .get(index) + .expect("a mock board wires at most MOCK_DEVICES.len() components"); + ComponentWiring { + device, + image: MemImage::holding(valid_image()), + boot_control: MockReset::new(), + boot_watch: MockWalk::idle(), + svn_floor: SvnFloorBinding::Erot(MockFloor::new()), + updatable: MockUpdatable::new(), + recovery: (), + trial: (), + } +} + +/// The mock chain's length, as the device table declares it. +const MOCK_N: usize = MOCK_DEVICES.len(); +/// The effect buffer `Rot` requires for `MOCK_N` components. +const MOCK_E: usize = 2 * MOCK_N + 2; +/// Consecutive failed restores before a component's failure policy applies. +const MOCK_MAX_RETRY: u8 = 3; + +/// Happy-path wiring for `N` components. Tests override the one field +/// they exercise with `..mock_board()`. +fn mock_board() -> Board { + Board { + components: core::array::from_fn(mock_component), + verifier: XorVerifier::accepting(), + report_sink: RecordingSink::new(), + update_staging: MemStaging::new(), + update_stall_budget_millis: STALL_BUDGET_MILLIS, + update_verifier: Some(StubVerifier::accepting()), + self_update: None, + } } fn driver(images: [MemImage; 1]) -> PlatformDriver { - PlatformDriver::new(Board { - images, - verifier: XorVerifier { - fault: false, - svn: 5, + PlatformDriver::new( + &passive_entries(), + Board { + components: images.map(|image| ComponentWiring { + image, + ..mock_component(0) + }), + ..mock_board() }, - boot_controls: [MockReset::new()], - boot_watches: [MockWalk::idle()], - component_kinds: [ComponentKind::Passive], - svn_floors: [SvnFloorBinding::Erot(MockFloor::new())], - }) + ) } fn orchestrator() -> Orchestrator<1, 4> { @@ -338,29 +1036,108 @@ fn boot_verifies_the_first_component() { assert_eq!(orch.state(), State::Ready); } +/// A driver whose verifier measures what it verifies. +fn measuring_driver(measurement: Measurement) -> PlatformDriver { + PlatformDriver::new( + &passive_entries(), + Board { + components: [ComponentWiring { + image: MemImage::holding(valid_image()), + ..mock_component(0) + }], + verifier: XorVerifier::measuring(measurement), + ..mock_board() + }, + ) +} + +// A board that measures gets the digest out through the report sink, as +// part of the same pass that verified the image. #[test] -fn corrupt_image_fails_verification() { - let mut corrupt = valid_image(); - corrupt[7] ^= 0x01; - let mut driver = driver([MemImage::holding(corrupt)]); +fn a_measured_image_is_reported() { + let measurement = Measurement([0xAB; Measurement::LEN]); + let mut driver = measuring_driver(measurement); - driver.stage_firmware(C0).unwrap(); + driver.stage_firmware(C0).expect("stage failed"); assert_eq!( driver.verify_firmware(C0), - Ok(Event::VerificationFailed(C0)) + Ok(Event::VerificationPassed(C0)) + ); + assert_eq!( + driver.board().report_sink.seen, + [Report::Measured { + id: C0, + measurement + }] ); } +// Measuring is optional. A board that composes no hash engine reports +// None, and the driver says nothing rather than inventing a digest. #[test] -fn verify_without_read_is_refused() { +fn a_board_that_does_not_measure_reports_nothing() { let mut driver = driver([MemImage::holding(valid_image())]); - assert_eq!(driver.verify_firmware(C0), Err(DriverError::NotStaged)); + driver.stage_firmware(C0).expect("stage failed"); + + assert_eq!( + driver.verify_firmware(C0), + Ok(Event::VerificationPassed(C0)) + ); + assert!(driver.board().report_sink.seen.is_empty()); } -// An unopenable source is a failed actuation, not a verdict: the SM -// latches Locked instead of getting a forged VerificationFailed. +// A measurement is a reading of an image the verifier vouched for. +// A rejected image has none, however far the hashing got. +#[test] +fn a_rejected_image_is_not_measured() { + let mut corrupt = valid_image(); + corrupt[7] ^= 0x01; + let mut driver = PlatformDriver::::new( + &passive_entries(), + Board { + components: [ComponentWiring { + image: MemImage::holding(corrupt), + ..mock_component(0) + }], + verifier: XorVerifier::measuring(Measurement([0xAB; Measurement::LEN])), + ..mock_board() + }, + ); + + driver.stage_firmware(C0).expect("stage failed"); + + assert_eq!( + driver.verify_firmware(C0), + Ok(Event::VerificationFailed(C0)) + ); + assert!(driver.board().report_sink.seen.is_empty()); +} + +#[test] +fn corrupt_image_fails_verification() { + let mut corrupt = valid_image(); + corrupt[7] ^= 0x01; + let mut driver = driver([MemImage::holding(corrupt)]); + + driver.stage_firmware(C0).unwrap(); + + assert_eq!( + driver.verify_firmware(C0), + Ok(Event::VerificationFailed(C0)) + ); +} + +#[test] +fn verify_without_read_is_refused() { + let mut driver = driver([MemImage::holding(valid_image())]); + + assert_eq!(driver.verify_firmware(C0), Err(DriverError::NotStaged)); +} + +// An unopenable source is a failed actuation, not a verdict: the SM +// latches Locked instead of getting a forged VerificationFailed. #[test] fn unopenable_source_fails_closed() { let mut orch = orchestrator(); @@ -391,17 +1168,13 @@ fn unreadable_source_fails_closed() { #[test] fn verifier_fault_fails_closed() { let mut orch = orchestrator(); - let mut driver = PlatformDriver::::new(Board { - images: [MemImage::holding(valid_image())], - verifier: XorVerifier { - fault: true, - svn: 5, + let mut driver = PlatformDriver::::new( + &passive_entries(), + Board { + verifier: XorVerifier::faulting(), + ..mock_board() }, - boot_controls: [MockReset::new()], - boot_watches: [MockWalk::idle()], - component_kinds: [ComponentKind::Passive], - svn_floors: [SvnFloorBinding::Erot(MockFloor::new())], - }); + ); orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); @@ -412,23 +1185,7 @@ const C1: ComponentId = ComponentId::new(1); #[test] fn verify_for_a_different_component_is_refused() { - let mut driver = PlatformDriver::::new(Board { - images: [ - MemImage::holding(valid_image()), - MemImage::holding(valid_image()), - ], - verifier: XorVerifier { - fault: false, - svn: 5, - }, - boot_controls: [MockReset::new(), MockReset::new()], - boot_watches: [MockWalk::idle(), MockWalk::idle()], - component_kinds: [ComponentKind::Passive, ComponentKind::Passive], - svn_floors: [ - SvnFloorBinding::Erot(MockFloor::new()), - SvnFloorBinding::Erot(MockFloor::new()), - ], - }); + let mut driver = PlatformDriver::::new(&passive_entries(), mock_board()); driver.stage_firmware(C0).unwrap(); @@ -458,23 +1215,13 @@ fn verify_of_unknown_component_is_refused() { #[test] fn reset_release_and_assert_reach_the_boot_control() { - let mut driver = PlatformDriver::::new(Board { - images: [MemImage::holding(valid_image())], - verifier: XorVerifier { - fault: false, - svn: 5, - }, - boot_controls: [MockReset::new()], - boot_watches: [MockWalk::idle()], - component_kinds: [ComponentKind::Passive], - svn_floors: [SvnFloorBinding::Erot(MockFloor::new())], - }); + let mut driver = PlatformDriver::::new(&passive_entries(), mock_board()); driver.release_reset(C0).unwrap(); - assert!(!driver.board().boot_controls[0].held.get()); + assert!(!driver.board().components[0].boot_control.held.get()); driver.assert_reset(C0).unwrap(); - assert!(driver.board().boot_controls[0].held.get()); + assert!(driver.board().components[0].boot_control.held.get()); } #[test] @@ -495,17 +1242,16 @@ fn reset_of_unknown_component_is_refused() { fn reset_line_fault_is_reported() { let mut control = MockReset::new(); control.fail = true; - let mut driver = PlatformDriver::::new(Board { - images: [MemImage::holding(valid_image())], - verifier: XorVerifier { - fault: false, - svn: 5, + let mut driver = PlatformDriver::::new( + &passive_entries(), + Board { + components: [ComponentWiring { + boot_control: control, + ..mock_component(0) + }], + ..mock_board() }, - boot_controls: [control], - boot_watches: [MockWalk::idle()], - component_kinds: [ComponentKind::Passive], - svn_floors: [SvnFloorBinding::Erot(MockFloor::new())], - }); + ); assert_eq!(driver.release_reset(C0), Err(DriverError::BootControlFault)); assert_eq!(driver.assert_reset(C0), Err(DriverError::BootControlFault)); @@ -520,7 +1266,7 @@ fn emit_is_refused() { let mut driver = driver([MemImage::holding(valid_image())]); assert_eq!( - driver.execute(Effect::Emit(Event::UpdateRequest)), + driver.execute(Effect::Emit(Event::UpdateRequest(C0))), Err(EffectError) ); } @@ -568,6 +1314,17 @@ impl BoardCapabilities for WatchBoard { type BootControl = MockReset; type BootWatch = MockWalk; type SvnFloor = MockFloor; + // A board with nothing to tell: exercises the no-op sink. + type ReportSink = (); + type Updatable = MockUpdatable; + type Recovery = (); + type DeviceTrial = (); + type Staging = MemStaging; + type UpdateVerifier = StubVerifier; + type SelfUpdate = MockSelfUpdate; + type SelfReset = MockSelfReset; + type ResetSignal = u8; + type Probe = u8; } // The at-rest guarantee end to end: the component is still held while its @@ -577,21 +1334,31 @@ fn release_follows_verification() { let control = MockReset::new(); let held = control.held.clone(); let held_during_verify = std::rc::Rc::new(core::cell::Cell::new(false)); - let mut driver = PlatformDriver::::new(Board { - images: [MemImage::holding(valid_image())], - verifier: LineWatchingVerifier { - inner: XorVerifier { - fault: false, - svn: 5, + let mut driver = PlatformDriver::::new( + &passive_entries(), + Board { + components: [ComponentWiring { + device: &MOCK_DEVICES[0], + image: MemImage::holding(valid_image()), + boot_control: control, + boot_watch: MockWalk::idle(), + svn_floor: SvnFloorBinding::Erot(MockFloor::new()), + updatable: MockUpdatable::new(), + recovery: (), + trial: (), + }], + verifier: LineWatchingVerifier { + inner: XorVerifier::accepting(), + line: held.clone(), + held_during_verify: held_during_verify.clone(), }, - line: held.clone(), - held_during_verify: held_during_verify.clone(), + report_sink: (), + update_staging: MemStaging::new(), + update_stall_budget_millis: STALL_BUDGET_MILLIS, + update_verifier: Some(StubVerifier::accepting()), + self_update: None, }, - boot_controls: [control], - boot_watches: [MockWalk::idle()], - component_kinds: [ComponentKind::Passive], - svn_floors: [SvnFloorBinding::Erot(MockFloor::new())], - }); + ); let mut orch = orchestrator(); orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); @@ -611,17 +1378,16 @@ fn failed_release_fails_closed() { let mut control = MockReset::new(); control.fail = true; let held = control.held.clone(); - let mut driver = PlatformDriver::::new(Board { - images: [MemImage::holding(valid_image())], - verifier: XorVerifier { - fault: false, - svn: 5, + let mut driver = PlatformDriver::::new( + &passive_entries(), + Board { + components: [ComponentWiring { + boot_control: control, + ..mock_component(0) + }], + ..mock_board() }, - boot_controls: [control], - boot_watches: [MockWalk::idle()], - component_kinds: [ComponentKind::Passive], - svn_floors: [SvnFloorBinding::Erot(MockFloor::new())], - }); + ); let mut orch = orchestrator(); orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); @@ -640,23 +1406,25 @@ fn walk_driver( walks: [MockWalk; 2], component_kinds: [ComponentKind; 2], ) -> PlatformDriver { - PlatformDriver::new(Board { - images: [ - MemImage::holding(valid_image()), - MemImage::holding(valid_image()), - ], - verifier: XorVerifier { - fault: false, - svn: 5, + PlatformDriver::new( + &entries_with_kinds(component_kinds), + Board { + components: { + let [first, second] = walks; + [ + ComponentWiring { + boot_watch: first, + ..mock_component(0) + }, + ComponentWiring { + boot_watch: second, + ..mock_component(1) + }, + ] + }, + ..mock_board() }, - boot_controls: [MockReset::new(), MockReset::new()], - boot_watches: walks, - component_kinds, - svn_floors: [ - SvnFloorBinding::Erot(MockFloor::new()), - SvnFloorBinding::Erot(MockFloor::new()), - ], - }) + ) } // A completed walk becomes ComponentReady for Active, Booted for Passive. @@ -685,12 +1453,10 @@ fn completed_walks_report_by_kind() { assert_eq!(quiet.next_deadline_millis, None, "no walk left waiting"); } -// A failed walk becomes Timeout(id) regardless of cause — the retry -// decision is the SM's. -// TODO: the SM only knows Timeout, so DeviceFatal still spends retry -// budget. Add a fatal, unrecoverable-error event to the SM in a later PR. +// A failed walk becomes BootFailed, preserving the checkpoint name and +// classified cause so the SM can differentiate retry decisions later. #[test] -fn failed_walks_map_to_timeout() { +fn failed_walks_map_to_boot_failed() { let mut driver = walk_driver( [ MockWalk::scripted(std::vec![WalkVerdict::Failed { @@ -707,8 +1473,22 @@ fn failed_walks_map_to_timeout() { driver.release_reset(C0).unwrap(); driver.release_reset(C1).unwrap(); - assert_eq!(driver.poll_boot_walks(0).event, Some(Event::Timeout(C0))); - assert_eq!(driver.poll_boot_walks(0).event, Some(Event::Timeout(C1))); + assert_eq!( + driver.poll_boot_walks(0).event, + Some(Event::BootFailed { + id: C0, + checkpoint: "heartbeat", + kind: BootFailureKind::TimedOut, + }) + ); + assert_eq!( + driver.poll_boot_walks(0).event, + Some(Event::BootFailed { + id: C1, + checkpoint: "self-test", + kind: BootFailureKind::DeviceFatal, + }) + ); assert_eq!(driver.poll_boot_walks(0).event, None); } @@ -797,7 +1577,7 @@ fn only_released_components_are_watched() { assert_eq!(driver.poll_boot_walks(0).event, Some(Event::Booted(C0))); } -// Every release re-arms the walk: a retry judges a new attempt from the +// Every release starts the walk again: a retry judges a new attempt from // first checkpoint, not the failed one resumed. With a script of // [Failed, Complete], a resumed walk would report Complete on the second // attempt; a fresh one reports Failed again. @@ -818,12 +1598,23 @@ fn rerelease_arms_a_fresh_walk() { ); driver.release_reset(C0).unwrap(); - assert_eq!(driver.poll_boot_walks(0).event, Some(Event::Timeout(C0))); + assert_eq!( + driver.poll_boot_walks(0).event, + Some(Event::BootFailed { + id: C0, + checkpoint: "heartbeat", + kind: BootFailureKind::TimedOut, + }) + ); driver.release_reset(C0).unwrap(); assert_eq!( driver.poll_boot_walks(0).event, - Some(Event::Timeout(C0)), + Some(Event::BootFailed { + id: C0, + checkpoint: "heartbeat", + kind: BootFailureKind::TimedOut, + }), "fresh attempt from the first checkpoint, not the old walk resumed" ); } @@ -833,17 +1624,16 @@ fn rerelease_arms_a_fresh_walk() { #[test] fn booted_walk_settles_in_ready() { let mut orch = orchestrator(); - let mut driver = PlatformDriver::::new(Board { - images: [MemImage::holding(valid_image())], - verifier: XorVerifier { - fault: false, - svn: 5, + let mut driver = PlatformDriver::::new( + &passive_entries(), + Board { + components: [ComponentWiring { + boot_watch: MockWalk::scripted(std::vec![WalkVerdict::Complete]), + ..mock_component(0) + }], + ..mock_board() }, - boot_controls: [MockReset::new()], - boot_watches: [MockWalk::scripted(std::vec![WalkVerdict::Complete])], - component_kinds: [ComponentKind::Passive], - svn_floors: [SvnFloorBinding::Erot(MockFloor::new())], - }); + ); orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); assert_eq!(orch.state(), State::Ready); @@ -855,36 +1645,238 @@ fn booted_walk_settles_in_ready() { assert_eq!(orch.state(), State::Ready); } -// End to end, failure path: the released component never reports in, its -// Timeout enters recovery, and with no recovery capability composed yet -// the machine fails closed. The Recovery PR replaces this test with the -// recovery-path one — its failure there is the reminder. +// End to end, failure path: the released component's walk fails, its +// BootFailed enters recovery. The `()` recovery reports source +// exhaustion immediately, and a Required component locks down. #[test] -fn boot_timeout_fails_closed_without_recovery() { +fn boot_failure_locks_when_recovery_is_exhausted() { let mut orch = orchestrator(); - let mut driver = PlatformDriver::::new(Board { - images: [MemImage::holding(valid_image())], - verifier: XorVerifier { - fault: false, - svn: 5, + let mut driver = PlatformDriver::::new( + &passive_entries(), + Board { + components: [ComponentWiring { + boot_watch: MockWalk::scripted(std::vec![WalkVerdict::Failed { + checkpoint: "heartbeat", + cause: FailureCause::TimedOut, + }]), + ..mock_component(0) + }], + ..mock_board() }, - boot_controls: [MockReset::new()], - boot_watches: [MockWalk::scripted(std::vec![WalkVerdict::Failed { - checkpoint: "heartbeat", - cause: FailureCause::TimedOut, - }])], - component_kinds: [ComponentKind::Passive], - svn_floors: [SvnFloorBinding::Erot(MockFloor::new())], - }); + ); orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); assert_eq!(orch.state(), State::Ready); let event = driver.poll_boot_walks(0).event.expect("walk failed"); - assert_eq!(event, Event::Timeout(C0)); + assert_eq!( + event, + Event::BootFailed { + id: C0, + checkpoint: "heartbeat", + kind: BootFailureKind::TimedOut, + } + ); orch.dispatch(&mut driver, event); assert_eq!(orch.state(), State::Locked); + assert!( + driver + .board() + .report_sink + .seen + .contains(&Report::RecoveryFailed(C0)), + "lock came via exhaust_recovery, not a raw actuation fault" + ); +} + +// --------------------------------------------------------------------------- +// Recovery executor. +// --------------------------------------------------------------------------- + +struct MockRecovery { + sources: u8, + fail_on: Option, +} + +#[derive(Debug)] +struct RecoveryActuationFault; + +impl core::fmt::Display for RecoveryActuationFault { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.write_str("recovery actuation fault") + } +} + +impl core::error::Error for RecoveryActuationFault {} + +impl Recovery for MockRecovery { + type Error = RecoveryActuationFault; + + fn restore(&mut self, attempt: u8) -> Result { + if self.fail_on == Some(attempt) { + return Err(RecoveryActuationFault); + } + if attempt >= self.sources { + return Ok(RestoreOutcome::SourceExhausted); + } + Ok(RestoreOutcome::Restored) + } +} + +struct RecoverableBoard; + +impl BoardCapabilities for RecoverableBoard { + type Image = MemImage; + type Verifier = XorVerifier; + type BootControl = MockReset; + type BootWatch = MockWalk; + type SvnFloor = MockFloor; + type ReportSink = RecordingSink; + type Updatable = MockUpdatable; + type Recovery = MockRecovery; + type DeviceTrial = (); + type Staging = MemStaging; + type UpdateVerifier = StubVerifier; + type SelfUpdate = MockSelfUpdate; + type SelfReset = MockSelfReset; + type ResetSignal = u8; + type Probe = u8; +} + +/// Happy-path wiring for one component of a board that can recover. +fn recoverable_component(sources: u8, index: usize) -> ComponentWiring { + ComponentWiring { + device: &MOCK_DEVICES[index], + image: MemImage::holding(valid_image()), + boot_control: MockReset::new(), + boot_watch: MockWalk::idle(), + svn_floor: SvnFloorBinding::Erot(MockFloor::new()), + updatable: MockUpdatable::new(), + recovery: MockRecovery { + sources, + fail_on: None, + }, + trial: (), + } +} + +fn recoverable_board(sources: u8) -> Board { + Board { + components: core::array::from_fn(|i| recoverable_component(sources, i)), + verifier: XorVerifier::accepting(), + report_sink: RecordingSink::new(), + update_staging: MemStaging::new(), + update_stall_budget_millis: STALL_BUDGET_MILLIS, + update_verifier: Some(StubVerifier::accepting()), + self_update: None, + } +} + +// RecoverComponent with a successful restore returns Restored(id). +#[test] +fn recover_component_returns_restored() { + let mut driver = + PlatformDriver::::new(&passive_entries(), recoverable_board(2)); + + assert_eq!(driver.recover_component(C0, 0), Ok(Event::Restored(C0))); + assert_eq!(driver.recover_component(C0, 1), Ok(Event::Restored(C0))); +} + +// RecoverComponent past the last source returns RecoveryUnavailable(id). +#[test] +fn recover_component_returns_unavailable_when_exhausted() { + let mut driver = + PlatformDriver::::new(&passive_entries(), recoverable_board(1)); + + assert_eq!(driver.recover_component(C0, 0), Ok(Event::Restored(C0))); + assert_eq!( + driver.recover_component(C0, 1), + Ok(Event::RecoveryUnavailable(C0)) + ); +} + +// A faulting mechanism returns RecoveryFault; the next attempt still +// succeeds, so a fault does not poison the path. +#[test] +fn recovery_fault_is_reported() { + let mut driver = PlatformDriver::::new( + &passive_entries(), + Board { + components: [ComponentWiring { + recovery: MockRecovery { + sources: 2, + fail_on: Some(0), + }, + ..recoverable_component(2, 0) + }], + ..recoverable_board(2) + }, + ); + + assert_eq!( + driver.recover_component(C0, 0), + Err(DriverError::RecoveryFault) + ); + // The next attempt succeeds: a fault does not poison the path. + assert_eq!(driver.recover_component(C0, 1), Ok(Event::Restored(C0))); +} + +// An unknown component is refused before the mechanism is consulted. +#[test] +fn recover_unknown_component_is_refused() { + let mut driver = + PlatformDriver::::new(&passive_entries(), recoverable_board(2)); + + assert_eq!( + driver.recover_component(ComponentId::new(9), 0), + Err(DriverError::UnknownComponent) + ); +} + +// The `()` impl reports exhaustion on every attempt: no sources exist. +#[test] +fn unit_recovery_always_exhausted() { + let mut driver = PlatformDriver::::new(&passive_entries(), mock_board()); + + assert_eq!( + driver.recover_component(C0, 0), + Ok(Event::RecoveryUnavailable(C0)) + ); +} + +// RecoverComponent through the Platform seam: a successful restore returns +// Some(Restored), a faulting mechanism returns EffectError. +#[test] +fn execute_routes_recover_component() { + use openprot_orchestrator_sm::{Effect, EffectError, Platform}; + + let mut driver = + PlatformDriver::::new(&passive_entries(), recoverable_board(2)); + + assert_eq!( + driver.execute(Effect::RecoverComponent { id: C0, attempt: 0 }), + Ok(Some(Event::Restored(C0))) + ); + + let mut faulting_driver = PlatformDriver::::new( + &passive_entries(), + Board { + components: [ComponentWiring { + recovery: MockRecovery { + sources: 2, + fail_on: Some(0), + }, + ..recoverable_component(2, 0) + }], + ..recoverable_board(2) + }, + ); + + assert_eq!( + faulting_driver.execute(Effect::RecoverComponent { id: C0, attempt: 0 }), + Err(EffectError) + ); } // --------------------------------------------------------------------------- @@ -892,16 +1884,15 @@ fn boot_timeout_fails_closed_without_recovery() { // --------------------------------------------------------------------------- /// Records what it is handed: the seam satisfied without a management -/// transport. +/// transport. Tests read `seen` back through `PlatformDriver::board`. +#[derive(Default)] struct RecordingSink { seen: std::vec::Vec, } impl RecordingSink { fn new() -> Self { - Self { - seen: std::vec::Vec::new(), - } + Self::default() } } @@ -911,11 +1902,17 @@ impl ReportSink for RecordingSink { } } -/// One of each report, so a test covers the whole enum. -fn every_report() -> [Report; 4] { +/// One of each report the SM commands through an Effect. The driver +/// raises the rest itself, so they are not in the list. +fn every_report() -> [Report; 5] { [ Report::Isolated(C0), Report::RecoveryFailed(C0), + Report::BootFailed { + id: C0, + checkpoint: "self-test", + kind: BootFailureKind::DeviceFatal, + }, Report::UpdateDeferred, Report::UpdateAborted, ] @@ -925,7 +1922,7 @@ fn every_report() -> [Report; 4] { // over; the unit sink is a wiring choice and satisfies the same caller. #[test] fn every_report_reaches_a_sink() { - fn tell(sink: &mut S, reports: [Report; 4]) { + fn tell(sink: &mut S, reports: [Report; 5]) { for report in reports { sink.report(report); } @@ -946,17 +1943,7 @@ fn every_report_reaches_a_sink() { // after a verification has passed — the two halves of the commit contract. #[test] fn commit_advances_the_floor_to_the_verified_svn() { - let mut driver = PlatformDriver::::new(Board { - images: [MemImage::holding(valid_image())], - verifier: XorVerifier { - fault: false, - svn: 5, - }, - boot_controls: [MockReset::new()], - boot_watches: [MockWalk::idle()], - component_kinds: [ComponentKind::Passive], - svn_floors: [SvnFloorBinding::Erot(MockFloor::new())], - }); + let mut driver = PlatformDriver::::new(&passive_entries(), mock_board()); driver .execute(Effect::ReadFirmware(C0)) @@ -967,12 +1954,12 @@ fn commit_advances_the_floor_to_the_verified_svn() { assert_eq!(driver.execute(Effect::CommitSvnFloor(C0)), Ok(None)); // Read back through the capability's own seam. - let SvnFloorBinding::Erot(floor) = &driver.board().svn_floors[0] else { + let SvnFloorBinding::Erot(floor) = &driver.board().components[0].svn_floor else { panic!("C0 is wired with an eRoT floor"); }; assert_eq!( floor.floor(), - Ok(Svn(5)), + Ok(Svn(MOCK_SVN)), "floor advanced to the verifier's SVN" ); } @@ -982,17 +1969,16 @@ fn commit_advances_the_floor_to_the_verified_svn() { // mis-advance. #[test] fn commit_without_an_erot_floor_is_a_no_op() { - let mut driver = PlatformDriver::::new(Board { - images: [MemImage::holding(valid_image())], - verifier: XorVerifier { - fault: false, - svn: 5, + let mut driver = PlatformDriver::::new( + &passive_entries(), + Board { + components: [ComponentWiring { + svn_floor: SvnFloorBinding::SelfManaged, + ..mock_component(0) + }], + ..mock_board() }, - boot_controls: [MockReset::new()], - boot_watches: [MockWalk::idle()], - component_kinds: [ComponentKind::Passive], - svn_floors: [SvnFloorBinding::SelfManaged], - }); + ); assert_eq!(driver.execute(Effect::CommitSvnFloor(C0)), Ok(None)); } @@ -1013,17 +1999,16 @@ fn commit_without_a_verified_image_fails_closed() { fn rejected_image_clears_the_verified_svn() { let mut corrupt = valid_image(); corrupt[7] ^= 0x01; - let mut driver = PlatformDriver::::new(Board { - images: [MemImage::holding(valid_image()).reflash_on_reopen(corrupt)], - verifier: XorVerifier { - fault: false, - svn: 5, + let mut driver = PlatformDriver::::new( + &passive_entries(), + Board { + components: [ComponentWiring { + image: MemImage::holding(valid_image()).reflash_on_reopen(corrupt), + ..mock_component(0) + }], + ..mock_board() }, - boot_controls: [MockReset::new()], - boot_watches: [MockWalk::idle()], - component_kinds: [ComponentKind::Passive], - svn_floors: [SvnFloorBinding::Erot(MockFloor::new())], - }); + ); driver.stage_firmware(C0).expect("stage failed"); assert_eq!( @@ -1049,20 +2034,2249 @@ fn rejected_image_clears_the_verified_svn() { fn floor_fault_is_reported() { let mut mock = MockFloor::new(); mock.fail = true; - let mut driver = PlatformDriver::::new(Board { - images: [MemImage::holding(valid_image())], - verifier: XorVerifier { - fault: false, - svn: 5, + let mut driver = PlatformDriver::::new( + &passive_entries(), + Board { + components: [ComponentWiring { + svn_floor: SvnFloorBinding::Erot(mock), + ..mock_component(0) + }], + ..mock_board() }, - boot_controls: [MockReset::new()], - boot_watches: [MockWalk::idle()], - component_kinds: [ComponentKind::Passive], - svn_floors: [SvnFloorBinding::Erot(mock)], - }); + ); driver.stage_firmware(C0).expect("stage failed"); driver.verify_firmware(C0).expect("verify failed"); assert_eq!(driver.commit_svn_floor(C0), Err(DriverError::SvnFloorFault)); } + +// Every report effect reaches the board's sink, in emission order, and none +// hands back an error for the SM to fail secure on. +#[test] +fn reports_reach_the_board_sink() { + let mut driver = PlatformDriver::::new(&passive_entries(), mock_board()); + + for effect in [ + Effect::ReportIsolated(C0), + Effect::ReportRecoveryFailed(C0), + Effect::ReportBootFailed { + id: C0, + checkpoint: "self-test", + kind: BootFailureKind::DeviceFatal, + }, + Effect::ReportUpdateDeferred, + Effect::ReportUpdateAborted, + ] { + assert_eq!(driver.execute(effect), Ok(None)); + } + + assert_eq!(driver.board().report_sink.seen, every_report()); +} + +// An Isolable component is contained and reported, and the platform keeps +// running: executing a report returns no error, so it never reaches the +// fail-secure path. +#[test] +fn reporting_an_isolated_component_does_not_lock_the_platform() { + let mut driver = PlatformDriver::::new(&passive_entries(), mock_board()); + let mut chain = heapless::Vec::<_, 2>::new(); + chain + .push((C0, ComponentAttrs::passive_required())) + .unwrap(); + chain + .push((C1, ComponentAttrs::passive_isolable())) + .unwrap(); + let mut orch = Orchestrator::<2, 6>::new(chain.try_into().unwrap(), 3); + + orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); + assert_eq!(orch.state(), State::Ready, "both components verified"); + + orch.dispatch(&mut driver, Event::CorruptionDetected(C1)); + + assert_eq!(orch.state(), State::Ready, "contained, not locked"); + assert_eq!(driver.board().report_sink.seen, [Report::Isolated(C1)]); +} + +#[test] +fn submit_update_refuses_an_unknown_component() { + let mut driver = driver([MemImage::holding(valid_image())]); + + assert_eq!( + driver.submit_update(ComponentId::new(9), CANDIDATE_LEN), + Err(DriverError::UnknownComponent) + ); + assert_eq!(driver.pending_update(), None); +} + +// Single update in flight by construction: a second submit is refused and +// the first job's target survives untouched. +#[test] +fn submit_update_refuses_a_second_in_flight() { + let mut driver = driver([MemImage::holding(valid_image())]); + + driver.submit_update(C0, CANDIDATE_LEN).unwrap(); + assert_eq!( + driver.submit_update(C0, CANDIDATE_LEN), + Err(DriverError::UpdateBusy) + ); + assert_eq!(driver.pending_update(), Some(C0)); +} + +// The frontend connection end to end: request_update records the job and +// the SM receives UpdateRequest. Ready accepts it and enters Updating, +// whose sole entry effect AuthenticateStageUpdate has an executor, so +// the SM stays in Updating (no latch). +#[test] +fn request_update_reaches_the_sm() { + let mut orch = orchestrator(); + let mut driver = driver([MemImage::holding(valid_image())]); + orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); + assert_eq!(orch.state(), State::Ready); + + request_update(&mut orch, &mut driver, C0, CANDIDATE_LEN).unwrap(); + + assert_eq!(driver.pending_update(), Some(C0)); + assert_eq!(orch.state(), State::Updating(C0)); +} + +// A refused submit injects nothing: no job, no event, the SM stays Ready. +#[test] +fn refused_request_update_injects_no_event() { + let mut orch = orchestrator(); + let mut driver = driver([MemImage::holding(valid_image())]); + orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); + + assert_eq!( + request_update(&mut orch, &mut driver, ComponentId::new(9), CANDIDATE_LEN), + Err(DriverError::UnknownComponent) + ); + + assert_eq!(driver.pending_update(), None); + assert_eq!(orch.state(), State::Ready); +} + +// The candidate is described by the offer, not by the region it sits +// in: a length past the end of the staging region is refused before +// anything is recorded. +#[test] +fn submit_update_refuses_a_candidate_past_the_staging_region() { + let mut driver = driver([MemImage::holding(valid_image())]); + + assert_eq!( + driver.submit_update(C0, STAGING_LEN as u64 + 1), + Err(DriverError::CandidateOutOfRange) + ); + assert_eq!(driver.pending_update(), None); +} + +// The job is recorded by the frontend before the SM emits anything, so a +// prepare with no job means the two have drifted apart. +#[test] +fn prepare_update_without_a_job_is_refused() { + let mut driver = driver([MemImage::holding(valid_image())]); + + assert_eq!(driver.prepare_update(), Err(DriverError::NoUpdateJob)); +} + +// DiscardStaged is the SM's way back to Ready: the job is gone, the +// device dropped what it staged, and the next update can proceed. +#[test] +fn discard_staged_clears_the_job_and_abandons_the_device() { + let mut driver = driver([MemImage::holding(valid_image())]); + driver.submit_update(C0, CANDIDATE_LEN).unwrap(); + + driver.discard_staged().expect("discard failed"); + + assert_eq!(driver.pending_update(), None); + assert_eq!(driver.board().components[0].updatable.abandons, 1); +} + +// Same drift as the authenticate case: the SM only emits DiscardStaged +// with an update in flight. +#[test] +fn discard_staged_without_a_job_is_refused() { + let mut driver = driver([MemImage::holding(valid_image())]); + + assert_eq!(driver.discard_staged(), Err(DriverError::NoUpdateJob)); +} + +// ReportUpdateDeferred clears pending_update so the next request is not +// permanently blocked. +#[test] +fn deferred_report_clears_pending_update() { + let mut driver = driver([MemImage::holding(valid_image())]); + driver.submit_update(C0, CANDIDATE_LEN).unwrap(); + assert_eq!(driver.pending_update(), Some(C0)); + + driver.execute(Effect::ReportUpdateDeferred).unwrap(); + + assert_eq!( + driver.pending_update(), + None, + "deferred report must clear the pending job" + ); + + // A subsequent submit succeeds: the slot is free. + driver.submit_update(C0, CANDIDATE_LEN).unwrap(); + assert_eq!(driver.pending_update(), Some(C0)); +} + +// ReportUpdateAborted clears pending_update so an update superseded by +// recovery does not block future requests. +#[test] +fn aborted_update_clears_pending_update() { + let mut driver = driver([MemImage::holding(valid_image())]); + driver.submit_update(C0, CANDIDATE_LEN).unwrap(); + + driver.execute(Effect::ReportUpdateAborted).unwrap(); + + assert_eq!( + driver.pending_update(), + None, + "aborted report must clear the pending job" + ); + + driver.submit_update(C0, CANDIDATE_LEN).unwrap(); + assert_eq!(driver.pending_update(), Some(C0)); +} + +fn update_driver(updatable: MockUpdatable) -> PlatformDriver { + PlatformDriver::new( + &passive_entries(), + Board { + components: [ComponentWiring { + updatable, + ..mock_component(0) + }], + ..mock_board() + }, + ) +} + +/// Does what entry to `State::Updating` does: record the job, then run +/// `prepare_update`, the executor for `Effect::AuthenticateStageUpdate`. +fn enter_updating(driver: &mut PlatformDriver) { + driver.submit_update(C0, CANDIDATE_LEN).unwrap(); + driver.prepare_update().unwrap(); +} + +/// A one-component driver whose board verifies with `verifier`. +fn verifying_driver(verifier: StubVerifier) -> PlatformDriver { + PlatformDriver::new( + &passive_entries(), + Board { + update_verifier: Some(verifier), + ..mock_board() + }, + ) +} + +/// Pumps until the pump answers with an event, one millisecond per +/// call so the stall budget never runs out. `None` means no event came, +/// which every caller treats as a failure. +fn pump_to_event(driver: &mut PlatformDriver, first_tick: u64) -> Option { + for tick in first_tick..first_tick + 12 { + if let Some(event) = driver.pump_update(tick).event { + return Some(event); + } + } + None +} + +#[test] +fn pumping_without_a_job_is_idle() { + let mut driver = driver([MemImage::holding(valid_image())]); + + let poll = driver.pump_update(0); + + assert_eq!(poll.event, None); + assert_eq!(poll.progress, None); +} + +#[test] +fn pumping_a_submitted_job_is_idle() { + let mut driver = driver([MemImage::holding(valid_image())]); + driver.submit_update(C0, CANDIDATE_LEN).unwrap(); + + assert_eq!(driver.pump_update(0).event, None); +} + +// A device that stages in one step verifies and emits UpdateVerified. +#[test] +fn a_pumped_job_verifies_after_staging() { + let mut driver = update_driver(MockUpdatable::new()); + enter_updating(&mut driver); + + assert_eq!(pump_to_event(&mut driver, 0), Some(Event::UpdateVerified)); + assert!(driver.board().components[0].updatable.ready); +} + +// Staging is polled too: a device that takes four steps is not waited +// out inside one pump call. +#[test] +fn staging_advances_one_bounded_step_per_pump() { + let mut driver = update_driver(MockUpdatable::stepping(4)); + enter_updating(&mut driver); + + // Tick 0: Submitted -> Staging transition, device not staged yet. + driver.pump_update(0); + assert!( + !driver.board().components[0].updatable.ready, + "tick 0: still staging" + ); + + // Ticks 1..4: one transfer step each. + for tick in 1..5 { + driver.pump_update(tick); + assert!( + !driver.board().components[0].updatable.ready, + "tick {tick}: still staging" + ); + } + + // Tick 5: final step stages the device. + driver.pump_update(5); + assert!( + driver.board().components[0].updatable.ready, + "tick 5: device staged" + ); + + // After staging, the next pumps start and complete verification. + assert_eq!(pump_to_event(&mut driver, 6), Some(Event::UpdateVerified)); +} + +// A device that fails a staging step ends the job. +#[test] +fn a_device_fault_rejects_the_update() { + let mut driver = update_driver(MockUpdatable::faulting()); + enter_updating(&mut driver); + + let mut event = None; + for tick in 0..8 { + if let Some(e) = driver.pump_update(tick).event { + event = Some(e); + break; + } + } + + assert_eq!(event, Some(Event::UpdateRejected)); + assert_eq!(driver.board().components[0].updatable.abandons, 1); +} + +// A transfer that stops moving is abandoned once the budget is spent, +// rather than held open for a device that stopped answering. +#[test] +fn a_stalled_transfer_is_rejected_at_the_budget() { + let mut driver = update_driver(MockUpdatable::stalling()); + enter_updating(&mut driver); + + // The device answers Transferring without moving. + assert_eq!(driver.pump_update(0).event, None); + assert_eq!(driver.pump_update(STALL_BUDGET_MILLIS - 1).event, None); + + let poll = driver.pump_update(STALL_BUDGET_MILLIS); + + assert_eq!(poll.event, Some(Event::UpdateRejected)); + assert_eq!(driver.board().components[0].updatable.abandons, 1); +} + +// Progress restarts the budget: a slow transfer that keeps moving is not +// a stalled one. +#[test] +fn progress_restarts_the_stall_budget() { + let mut driver = update_driver(MockUpdatable::stepping(4)); + enter_updating(&mut driver); + + // One step per budget window: every call moves `written`, so the + // budget never runs out even though each step takes nearly all of it. + let mut tick = 0; + for _ in 0..8 { + tick += STALL_BUDGET_MILLIS - 1; + let poll = driver.pump_update(tick); + assert_ne!( + poll.event, + Some(Event::UpdateRejected), + "no rejection during staging" + ); + } + + assert!( + driver.board().components[0].updatable.ready, + "device staged" + ); +} + +// The SM emits AuthenticateStageUpdate on entry to Updating. A job +// missing the prepare flag means the two sides drifted, so the pump +// refuses rather than pushing bytes the SM never commanded. +#[test] +fn a_job_the_sm_never_commanded_stays_idle() { + let mut driver = update_driver(MockUpdatable::new()); + driver.submit_update(C0, CANDIDATE_LEN).unwrap(); + // No prepare_update call. + + let mut event = None; + for tick in 0..8 { + if let Some(e) = driver.pump_update(tick).event { + event = Some(e); + break; + } + } + + // Submitted phase returns idle, not rejected. + assert_eq!(event, None); +} + +// Same drift as the other update executors: the SM only emits +// ActivateUpdate with an update in flight. +#[test] +fn activate_update_without_a_job_is_refused() { + let mut driver = driver([MemImage::holding(valid_image())]); + + assert_eq!(driver.activate_update(), Err(DriverError::NoUpdateJob)); +} + +// Activation requires the candidate to have passed verification, not +// just staging. A Submitted job that has not been pumped to +// Authenticated is refused. +#[test] +fn activate_update_requires_authentication() { + let mut driver = update_driver(MockUpdatable::new()); + enter_updating(&mut driver); + + assert_eq!( + driver.activate_update(), + Err(DriverError::CandidateNotAuthenticated) + ); + assert_eq!( + driver.pending_update(), + Some(C0), + "the job survives, so DiscardStaged still finds it" + ); +} + +// The device has every byte, but nothing has checked them yet. +// activate_update refuses that. +#[test] +fn activate_update_refuses_an_unverified_candidate() { + let mut driver = update_driver(MockUpdatable::new()); + enter_updating(&mut driver); + driver.pump_update(0); // Submitted -> Staging + driver.pump_update(1); // Staging -> device Ready -> Staged + assert!( + driver.board().components[0].updatable.ready, + "bytes are staged" + ); + assert_eq!( + driver.activate_update(), + Err(DriverError::CandidateNotAuthenticated) + ); +} + +// Verification is polled the way staging is: one step per call, with +// the bytes read so far reported as progress. The verdict comes on the +// poll that finishes the payload. +#[test] +fn verification_advances_one_bounded_step_per_pump() { + let mut driver = verifying_driver(StubVerifier::chunked(4)); + enter_updating(&mut driver); + + assert_eq!(driver.pump_update(0).event, None, "tick 0: Submitted"); + assert_eq!(driver.pump_update(1).event, None, "tick 1: staging"); + assert!( + driver.board().components[0].updatable.ready, + "tick 1: device staged" + ); + + let opened = driver.pump_update(2); + assert_eq!(opened.event, None, "tick 2: the session only opens"); + assert_eq!(opened.progress, Some(Progress::start(CANDIDATE_LEN))); + + for (tick, written) in [(3, 8), (4, 16), (5, 24)] { + let poll = driver.pump_update(tick); + assert_eq!(poll.event, None, "tick {tick}: a verdict before the end"); + assert_eq!( + poll.progress, + Some(Progress { + written, + total: CANDIDATE_LEN + }) + ); + } + + assert_eq!(driver.pump_update(6).event, Some(Event::UpdateVerified)); +} + +// A verifier that rejects the candidate produces UpdateRejected and the +// device throws away what it staged. The job stays, so the SM can still +// end it with DiscardStaged. +#[test] +fn a_rejected_candidate_emits_update_rejected() { + let mut driver = verifying_driver(StubVerifier::rejecting()); + enter_updating(&mut driver); + + assert_eq!(pump_to_event(&mut driver, 0), Some(Event::UpdateRejected)); + assert_eq!( + driver.board().components[0].updatable.abandons, + 1, + "device abandons the staged image after rejection" + ); + assert!( + driver.pending_update().is_some(), + "the job waits for DiscardStaged" + ); + assert!( + driver.board().report_sink.seen.is_empty(), + "a bad image is the verifier working, not faulting" + ); +} + +// A verifier that cannot run its check ends the job, the same as one +// that rejects the image. Nothing activates. The SM sees UpdateRejected +// both times, so the report is the only place the difference shows. +#[test] +fn a_verifier_fault_rejects_the_candidate_and_is_reported() { + let mut driver = verifying_driver(StubVerifier::faulting()); + enter_updating(&mut driver); + + assert_eq!(pump_to_event(&mut driver, 0), Some(Event::UpdateRejected)); + assert_eq!(driver.board().components[0].updatable.abandons, 1); + assert_eq!( + driver.board().report_sink.seen, + [Report::UpdateVerifierFault] + ); +} + +// A verifier that stops getting through the payload is dropped on the +// same budget as a stalled transfer. +#[test] +fn a_stalled_verification_is_rejected_at_the_budget() { + let mut driver = verifying_driver(StubVerifier::stalling()); + enter_updating(&mut driver); + + driver.pump_update(0); + driver.pump_update(1); + driver.pump_update(2); // opens the session, which restarts the budget + assert_eq!(driver.pump_update(3).event, None, "budget not spent yet"); + + let poll = driver.pump_update(2 + STALL_BUDGET_MILLIS); + + assert_eq!(poll.event, Some(Event::UpdateRejected)); + assert_eq!(driver.board().components[0].updatable.abandons, 1); +} + +// The verifier comes back after a rejection. If it did not, the next +// update would find no verifier and never finish. +#[test] +fn the_verifier_is_reusable_after_a_rejection() { + let mut driver = verifying_driver(StubVerifier::rejecting_then_accepting()); + + enter_updating(&mut driver); + assert_eq!(pump_to_event(&mut driver, 0), Some(Event::UpdateRejected)); + driver.discard_staged().expect("discard failed"); + + enter_updating(&mut driver); + assert_eq!(pump_to_event(&mut driver, 20), Some(Event::UpdateVerified)); +} + +// Discarding mid-verification returns the verifier too, not just a +// finished session. The verdicts are ordered so only a second session +// can authenticate: a leftover session still carries Reject, and would +// end the next update instead. +#[test] +fn the_verifier_is_reusable_after_a_discard_mid_verification() { + let mut driver = verifying_driver(StubVerifier::chunked_verdicts( + 4, + &[StubVerdict::Reject, StubVerdict::Authenticate], + )); + + enter_updating(&mut driver); + driver.pump_update(0); + driver.pump_update(1); + driver.pump_update(2); + driver.pump_update(3); // one chunk in, session still live + driver.discard_staged().expect("discard failed"); + + enter_updating(&mut driver); + assert_eq!(pump_to_event(&mut driver, 20), Some(Event::UpdateVerified)); +} + +// The job ends at activation: the device runs the candidate on its next +// boot, tentatively, and the driver is free for the next update. +#[test] +fn activate_update_ends_the_job() { + let mut driver = update_driver(MockUpdatable::new()); + enter_updating(&mut driver); + pump_to_event(&mut driver, 0); + + driver.activate_update().expect("activate failed"); + + assert!(driver.board().components[0].updatable.active); + assert_eq!(driver.pending_update(), None); +} + +// The verifier survives a full cycle and can verify a second update. +// Detects any path that silently destroys the verifier (leaves it None). +#[test] +fn verifier_survives_two_update_cycles() { + let mut driver = update_driver(MockUpdatable::new()); + + for cycle in 0..2u64 { + enter_updating(&mut driver); + assert_eq!( + pump_to_event(&mut driver, cycle * 20), + Some(Event::UpdateVerified), + "cycle {cycle}" + ); + driver.activate_update().expect("activate failed"); + } +} + +// The path through the SM end to end: a request, the pump, staging and +// verification complete, the verdict activates, and the walk that follows +// resets the component into what it just activated. +// +// The verdict comes off the pump rather than being dispatched by hand: +// the verifier is wired, so inventing one here would stop testing the +// path that produces it. +#[test] +fn an_update_runs_through_the_sm_and_rewalks() { + let mut orch = orchestrator(); + let mut driver = update_driver(MockUpdatable::stepping(2)); + orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); + assert_eq!(orch.state(), State::Ready); + + let resets_before = driver.board().components[0].boot_control.holds.get(); + + request_update(&mut orch, &mut driver, C0, CANDIDATE_LEN).unwrap(); + assert_eq!(orch.state(), State::Updating(C0)); + + let mut verdict = None; + for tick in 0..16 { + if let Some(event) = driver.pump_update(tick).event { + verdict = Some(event); + break; + } + } + assert!(driver.board().components[0].updatable.ready, "never staged"); + assert_eq!( + verdict, + Some(Event::UpdateVerified), + "no verdict from the pump" + ); + + orch.dispatch(&mut driver, Event::UpdateVerified); + + assert_eq!(orch.state(), State::Ready); + assert!(driver.board().components[0].updatable.active); + assert_eq!(driver.pending_update(), None); + // The activation only proposed the image; the walk that followed is + // what reset the device into it. + assert!( + driver.board().components[0].boot_control.holds.get() > resets_before, + "the updated component was never reset" + ); +} + +// The rejection path through the SM: DiscardStaged runs and the platform +// is back in Ready. +#[test] +fn a_rejected_update_returns_the_platform_to_ready() { + let mut orch = orchestrator(); + let mut driver = update_driver(MockUpdatable::faulting()); + orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); + + request_update(&mut orch, &mut driver, C0, CANDIDATE_LEN).unwrap(); + + for tick in 0..16 { + if let Some(event) = driver.pump_update(tick).event { + orch.dispatch(&mut driver, event); + break; + } + } + + assert_eq!(orch.state(), State::Ready); + assert_eq!(driver.pending_update(), None, "DiscardStaged cleared it"); + assert!(!driver.board().components[0].updatable.active); +} + +// bring_up takes a ChainEntries, the validated output of chain_of. The +// machine and the driver cannot be holding different component lists +// because the entries come from one const-validated device table. +#[test] +fn bring_up_builds_both_halves_from_one_chain() { + use orchestrator_config::{chain_of, ChainEntries}; + + // chain_of requires the eRoT at position 0, which MOCK_DEVICES carries. + const CHAIN: ChainEntries = chain_of(&MOCK_DEVICES); + + let (orch, driver) = + bring_up::(&CHAIN, &MOCK_DEVICES, mock_board(), MOCK_MAX_RETRY); + + assert_eq!(orch.state(), State::PowerOnReset); + assert!(driver.pending_update().is_none()); +} + +// A wiring that names someone else's table row would drive that component's +// reset line and flash. Nothing in the type system says otherwise, because +// the wiring holds runtime handles, so bring_up checks it. +#[test] +#[should_panic(expected = "must name its own device table entry")] +fn bring_up_refuses_a_wiring_that_names_another_components_entry() { + use orchestrator_config::{chain_of, ChainEntries}; + + const CHAIN: ChainEntries = chain_of(&MOCK_DEVICES); + + let mut board = mock_board::(); + board.components[0].device = &MOCK_DEVICES[1]; + board.components[1].device = &MOCK_DEVICES[0]; + + let _ = bring_up::(&CHAIN, &MOCK_DEVICES, board, MOCK_MAX_RETRY); +} + +// The driver indexes every per-component array by id, so an entry out of +// position would address the wrong component's reset line and flash. +#[test] +#[should_panic(expected = "id must be its position")] +fn an_entry_out_of_position_is_refused() { + let entries = [(ComponentId::new(3), ComponentAttrs::passive_required())]; + let _ = PlatformDriver::::new(&entries, mock_board()); +} + +// Before the platform is in service nothing would report the request +// deferred, so it is refused and no job is recorded. +#[test] +fn a_request_before_the_platform_is_in_service_is_refused() { + let mut orch = orchestrator(); + let mut driver = driver([MemImage::holding(valid_image())]); + + assert_eq!(orch.state(), State::PowerOnReset); + assert_eq!( + request_update(&mut orch, &mut driver, C0, CANDIDATE_LEN), + Err(DriverError::Unsupervised) + ); + assert_eq!(driver.pending_update(), None); +} + +// Same for a locked platform, which can neither run the update nor report +// it deferred. +#[test] +fn a_request_to_a_locked_platform_is_refused() { + let mut orch = orchestrator(); + let mut driver = PlatformDriver::::new( + &passive_entries(), + Board { + verifier: XorVerifier::faulting(), + ..mock_board() + }, + ); + orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); + assert_eq!(orch.state(), State::Locked); + + assert_eq!( + request_update(&mut orch, &mut driver, C0, CANDIDATE_LEN), + Err(DriverError::Unsupervised) + ); + assert_eq!(driver.pending_update(), None); +} + +// The driver refuses a second request itself: its single-job rule answers +// before the state machine is asked, and the running update is left alone. +#[test] +fn a_second_request_while_an_update_runs_is_refused_as_busy() { + let mut orch = orchestrator(); + let mut driver = update_driver(MockUpdatable::stepping(2)); + orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); + request_update(&mut orch, &mut driver, C0, CANDIDATE_LEN).unwrap(); + assert_eq!(orch.state(), State::Updating(C0)); + + assert_eq!( + request_update(&mut orch, &mut driver, C0, CANDIDATE_LEN), + Err(DriverError::UpdateBusy) + ); + assert!( + driver.pending_update().is_some(), + "the running job survives" + ); +} + +// --------------------------------------------------------------------------- +// Settling the eRoT's own last update at boot +// --------------------------------------------------------------------------- + +// No session: the ordinary boot changes nothing. +#[test] +fn settle_with_no_session_changes_nothing() { + let mut session = MockSelfUpdate::idle(); + + assert_eq!( + settle_self_update(&mut session, &MockFloor::new()), + Ok(SelfUpdateSettlement::Settled) + ); + + assert_eq!(session.state, SelfUpdateState::Idle); +} + +// The trial image is running. The chain walk judges it, so the session +// stays as it is. +#[test] +fn settle_reports_a_running_trial_and_leaves_the_session() { + let pending = SelfUpdateState::TrialPending { svn: Svn(7) }; + let mut session = MockSelfUpdate::with_session(pending, RunningImage::Trial); + + assert_eq!( + settle_self_update(&mut session, &MockFloor::new()), + Ok(SelfUpdateSettlement::TrialRunning { svn: Svn(7) }) + ); + + assert_eq!(session.state, pending); +} + +// The trial ran and the platform fell back, so nothing will confirm it. +// The session is reverted and the update has to be done again. +#[test] +fn settle_reverts_a_trial_that_fell_back() { + let mut session = MockSelfUpdate::with_session( + SelfUpdateState::TrialPending { svn: Svn(7) }, + RunningImage::Confirmed, + ); + + assert_eq!( + settle_self_update(&mut session, &MockFloor::new()), + Ok(SelfUpdateSettlement::Settled), + "the confirmed image booted, so there is nothing to judge" + ); + + assert_eq!(session.state, SelfUpdateState::Idle); +} + +// Confirmed, floor still below the session's SVN. The advance is the +// one the Update Agent requests, so this boot keeps the session and +// moves nothing. +#[test] +fn settle_keeps_a_confirmed_session_the_floor_has_not_taken() { + let committed = SelfUpdateState::Committed { svn: Svn(7) }; + let mut session = MockSelfUpdate::with_session(committed, RunningImage::Trial); + let floor = MockFloor::with_floor(Svn(3)); + + assert_eq!( + settle_self_update(&mut session, &floor), + Ok(SelfUpdateSettlement::AwaitingFloorAdvance { svn: Svn(7) }) + ); + + assert_eq!(session.state, committed); + assert_eq!(floor.floor(), Ok(Svn(3))); +} + +// The crash point between advancing the floor and closing the session. +// The floor already reads the session's SVN, so the advance landed and the +// session is closed here. +#[test] +fn settle_completes_a_session_whose_floor_already_moved() { + let mut session = MockSelfUpdate::with_session( + SelfUpdateState::Committed { svn: Svn(7) }, + RunningImage::Trial, + ); + + assert_eq!( + settle_self_update(&mut session, &MockFloor::with_floor(Svn(7))), + Ok(SelfUpdateSettlement::Settled) + ); + + assert_eq!(session.state, SelfUpdateState::Idle); +} + +// A floor above the session's SVN closes it too: something moved the floor +// further after the advance landed. +#[test] +fn settle_completes_a_session_whose_floor_moved_past_it() { + let mut session = MockSelfUpdate::with_session( + SelfUpdateState::Committed { svn: Svn(7) }, + RunningImage::Trial, + ); + + assert_eq!( + settle_self_update(&mut session, &MockFloor::with_floor(Svn(9))), + Ok(SelfUpdateSettlement::Settled) + ); + + assert_eq!(session.state, SelfUpdateState::Idle); +} + +// An unreadable session fails secure rather than guessing: without it the +// eRoT cannot tell a confirmed update from a reverted one. The storage +// error comes back with it. +#[test] +fn settle_with_an_unreadable_session_fails_secure() { + let mut session = MockSelfUpdate::idle(); + session.fail = true; + + assert_eq!( + settle_self_update(&mut session, &MockFloor::new()), + Err(SettleError::Session(SelfSessionFault)) + ); +} + +// A floor that does not answer fails secure in the same way. The session +// stays confirmed and the next boot tries again. +#[test] +fn settle_with_an_unreadable_floor_fails_secure() { + let committed = SelfUpdateState::Committed { svn: Svn(7) }; + let mut session = MockSelfUpdate::with_session(committed, RunningImage::Trial); + + assert_eq!( + settle_self_update(&mut session, &MockFloor::faulting()), + Err(SettleError::Floor(FloorFaultInjected)) + ); + + assert_eq!(session.state, committed); +} + +// A trial image is running that no session claims. The session is +// reverted, which clears the pending mark, so the confirmed image runs +// after a reset. +#[test] +fn settle_reports_an_unclaimed_image_and_reverts_the_session() { + let mut session = MockSelfUpdate::with_session(SelfUpdateState::Idle, RunningImage::Trial); + + assert_eq!( + settle_self_update(&mut session, &MockFloor::new()), + Ok(SelfUpdateSettlement::UnclaimedImageRunning) + ); + + assert_eq!(session.state, SelfUpdateState::Idle); +} + +// The ordinary case. The trial boot was confirmed, so the floor moves up to +// the SVN the session recorded and the session ends. +#[test] +fn commit_advances_the_floor_and_closes_the_session() { + let mut session = MockSelfUpdate::with_session( + SelfUpdateState::Committed { svn: Svn(7) }, + RunningImage::Trial, + ); + let mut floor = MockFloor::with_floor(Svn(3)); + + assert_eq!(commit_self_svn_floor(&mut session, &mut floor), Ok(())); + + assert_eq!(floor.floor(), Ok(Svn(7))); + assert_eq!(session.state, SelfUpdateState::Idle); +} + +// There is no session, so no image has run at any SVN. The floor stays where +// it was and the caller tells the Update Agent no. +#[test] +fn commit_without_a_session_is_refused() { + let mut session = MockSelfUpdate::idle(); + let mut floor = MockFloor::with_floor(Svn(3)); + + assert_eq!( + commit_self_svn_floor(&mut session, &mut floor), + Err(CommitFloorError::NotConfirmed(SelfUpdateState::Idle)) + ); + + assert_eq!(floor.floor(), Ok(Svn(3))); +} + +// The trial is still running, so nothing has judged it yet. The floor waits +// for the boot that does. +#[test] +fn commit_during_a_trial_is_refused() { + let pending = SelfUpdateState::TrialPending { svn: Svn(7) }; + let mut session = MockSelfUpdate::with_session(pending, RunningImage::Trial); + let mut floor = MockFloor::with_floor(Svn(3)); + + assert_eq!( + commit_self_svn_floor(&mut session, &mut floor), + Err(CommitFloorError::NotConfirmed(pending)) + ); + + assert_eq!(floor.floor(), Ok(Svn(3))); +} + +// The eRoT crashed after the floor moved to 7 but before the session closed. +// The Update Agent requests again: advancing to 7 a second time changes +// nothing, and this run closes the session. A third request has no +// session left to commit, so it is refused. +#[test] +fn commit_repeated_after_a_crash_finishes_the_close() { + let mut session = MockSelfUpdate::with_session( + SelfUpdateState::Committed { svn: Svn(7) }, + RunningImage::Trial, + ); + let mut floor = MockFloor::with_floor(Svn(7)); + + assert_eq!(commit_self_svn_floor(&mut session, &mut floor), Ok(())); + + assert_eq!(floor.floor(), Ok(Svn(7))); + assert_eq!(session.state, SelfUpdateState::Idle); + assert_eq!( + commit_self_svn_floor(&mut session, &mut floor), + Err(CommitFloorError::NotConfirmed(SelfUpdateState::Idle)), + "the session is closed, so the floor cannot move again" + ); + assert_eq!(floor.floor(), Ok(Svn(7))); +} + +// Writing the floor fails. The session has to stay as it was, so the update +// agent's next request can advance the floor instead of the advance being +// lost. +#[test] +fn commit_with_a_floor_that_cannot_advance_leaves_the_session_open() { + let committed = SelfUpdateState::Committed { svn: Svn(7) }; + let mut session = MockSelfUpdate::with_session(committed, RunningImage::Trial); + + assert_eq!( + commit_self_svn_floor(&mut session, &mut MockFloor::faulting()), + Err(CommitFloorError::Floor(FloorFaultInjected)) + ); + + assert_eq!( + session.state, committed, + "the floor still owes this SVN, so the agent's next request can retry" + ); +} + +// The session cannot be read, so nothing says which SVN to advance to. +// Refuse and leave the floor alone rather than guess. +#[test] +fn commit_with_an_unreadable_session_fails_secure() { + let mut session = MockSelfUpdate::with_session( + SelfUpdateState::Committed { svn: Svn(7) }, + RunningImage::Trial, + ); + session.fail = true; + let mut floor = MockFloor::with_floor(Svn(3)); + + assert_eq!( + commit_self_svn_floor(&mut session, &mut floor), + Err(CommitFloorError::Session(SelfSessionFault)) + ); + + assert_eq!(floor.floor(), Ok(Svn(3))); +} + +// --------------------------------------------------------------------------- +// Bringing the spare slot up to date after a commit +// --------------------------------------------------------------------------- + +/// Runs an update up to activation. Requests it, pumps until the pump +/// reaches a verdict, then dispatches that verdict. +/// +/// The verdict comes off the pump rather than being dispatched by hand: +/// activation refuses a candidate that has not reached `Authenticated`, +/// so a hand-fed `UpdateVerified` would leave the job unactivated. These +/// tests are about what happens after activation. +fn activated(driver: &mut PlatformDriver, orch: &mut Orchestrator<1, 4>) { + orch.dispatch(driver, Event::PowerGood(PowerOnResult::Provisioned)); + request_update(orch, driver, C0, CANDIDATE_LEN).unwrap(); + let mut verdict = None; + for tick in 0..16 { + if let Some(event) = driver.pump_update(tick).event { + verdict = Some(event); + break; + } + } + assert!(driver.board().components[0].updatable.ready, "never staged"); + assert_eq!( + verdict, + Some(Event::UpdateVerified), + "no verdict from the pump" + ); + orch.dispatch(driver, Event::UpdateVerified); + assert!( + driver.board().components[0].updatable.active, + "never activated" + ); +} + +// A commit sends the committed image to the device a second time. The +// device writes it into the slot it stopped booting from, which this +// mock does not model, so what is checked here is the pass itself and +// that nothing activates again. +#[test] +fn a_commit_runs_a_second_staging_pass() { + let mut orch = orchestrator(); + let mut driver = update_driver(MockUpdatable::new()); + + // An update, staged and activated. The device is running the new + // image and the spare slot still holds the old one. + activated(&mut driver, &mut orch); + let staged_before = driver.board().components[0].updatable.stagings; + + // The boot is confirmed and the Update Agent requests the SVN, which + // commits the floor and is where the re-sync comes from. + orch.dispatch(&mut driver, Event::BootConfirmed(C0)); + orch.dispatch(&mut driver, Event::SvnCommitRequest(C0)); + + // Queued, not transferred: the executor returned without sending + // anything, and the job is waiting for the pump. + assert_eq!(driver.pending_update(), Some(C0)); + + // The pump runs the pass. 16 ticks is slack; this device finishes + // in one. + for tick in 0..16 { + if driver.pending_update().is_none() { + break; + } + let poll = driver.pump_update(tick); + assert_eq!(poll.event, None, "the SM is not told"); + assert_eq!(poll.progress, None, "nobody asked for this transfer"); + } + + assert_eq!(driver.pending_update(), None, "the re-sync ended"); + + // The device was sent the image a second time. + assert!(driver.board().components[0].updatable.stagings > staged_before); + + // And it was not activated a second time. `active` is already true + // from the update, so counting activations is the only way to see + // this. + assert_eq!( + driver.board().components[0].updatable.activations, + 1, + "the device keeps running what it committed" + ); + + // A clean pass reports nothing. + assert!(!driver + .board() + .report_sink + .seen + .contains(&Report::SlotResyncFailed(C0))); + + // The SM sat in Ready throughout. It never learned a job existed. + assert_eq!(orch.state(), State::Ready); +} + +// The component keeps its own SVN. A device that owns its anti-rollback +// owns its slot metadata too, so the eRoT has no floor to move here and +// no slot of its own to fill. +#[test] +fn a_commit_leaves_a_component_that_tracks_its_own_svn_alone() { + let mut orch = orchestrator(); + let mut driver = PlatformDriver::::new( + &passive_entries(), + Board { + components: [ComponentWiring { + updatable: MockUpdatable::new(), + svn_floor: SvnFloorBinding::SelfManaged, + ..mock_component(0) + }], + ..mock_board() + }, + ); + activated(&mut driver, &mut orch); + let staged_before = driver.board().components[0].updatable.stagings; + + driver.commit_svn_floor(C0).expect("commit failed"); + + assert_eq!(driver.pending_update(), None, "nothing was queued"); + for tick in 0..4 { + driver.pump_update(tick); + } + assert_eq!( + driver.board().components[0].updatable.stagings, + staged_before, + "the device was sent the image a second time" + ); +} + +/// Reads `C0`'s floor back through the capability's own seam. +fn floor_of(driver: &PlatformDriver) -> Svn { + let SvnFloorBinding::Erot(floor) = &driver.board().components[0].svn_floor else { + panic!("C0 is wired with an eRoT floor"); + }; + floor.floor().expect("floor unreadable") +} + +// The commit queues the re-sync and holds the SVN floor advance until +// the re-sync has written the confirmed image into the spare slot. If the +// floor moved first, the spare slot would still hold the old image, whose +// SVN is below the new floor, and the ROM refuses an image below the +// floor, so a fallback to the spare slot would not boot. +#[test] +fn the_floor_waits_for_the_spare_slot() { + let mut orch = orchestrator(); + let mut driver = update_driver(MockUpdatable::stepping(4)); + activated(&mut driver, &mut orch); + let before = floor_of(&driver); + + orch.dispatch(&mut driver, Event::BootConfirmed(C0)); + orch.dispatch(&mut driver, Event::SvnCommitRequest(C0)); + + assert_eq!(driver.pending_update(), Some(C0), "the re-sync is queued"); + assert_eq!( + floor_of(&driver), + before, + "the floor moved before the spare" + ); + + for tick in 0..16 { + if driver.pending_update().is_none() { + break; + } + driver.pump_update(tick); + } + + assert_eq!(floor_of(&driver), Svn(MOCK_SVN), "the floor never moved"); +} + +// The same commit arriving twice while the pass runs. The second one +// must not write the floor: the spare is still being written, and the +// first commit already left the advance waiting for it. +#[test] +fn a_commit_replayed_mid_pass_does_not_jump_the_floor() { + let mut orch = orchestrator(); + let mut driver = update_driver(MockUpdatable::stepping(4)); + activated(&mut driver, &mut orch); + + orch.dispatch(&mut driver, Event::BootConfirmed(C0)); + orch.dispatch(&mut driver, Event::SvnCommitRequest(C0)); + driver.commit_svn_floor(C0).expect("replayed commit failed"); + + assert_eq!(floor_of(&driver), Svn(0), "the floor jumped the pass"); + + for tick in 0..16 { + if driver.pending_update().is_none() { + break; + } + driver.pump_update(tick); + } + + assert_eq!(floor_of(&driver), Svn(MOCK_SVN)); +} + +// The pass failed, so the spare still holds the old image. Moving the +// floor now would put the spare below it, and a fallback would have +// nothing to boot. +#[test] +fn a_failed_resync_leaves_the_floor_alone() { + let mut orch = orchestrator(); + let mut driver = update_driver(MockUpdatable::faulting_on_the_second_pass()); + activated(&mut driver, &mut orch); + let before = floor_of(&driver); + + orch.dispatch(&mut driver, Event::BootConfirmed(C0)); + orch.dispatch(&mut driver, Event::SvnCommitRequest(C0)); + driver.pump_update(0); + + assert_eq!(driver.pending_update(), None, "the re-sync ended"); + assert_eq!(floor_of(&driver), before); + assert!(driver + .board() + .report_sink + .seen + .contains(&Report::SlotResyncFailed(C0))); +} + +// Both slots hold the new image but the floor could not be written. The +// component is fine and the old image is still installable, which is +// what the report says. +#[test] +fn a_floor_that_cannot_be_written_after_the_pass_is_reported() { + let mut orch = orchestrator(); + let mut driver = PlatformDriver::::new( + &passive_entries(), + Board { + components: [ComponentWiring { + updatable: MockUpdatable::new(), + svn_floor: SvnFloorBinding::Erot(MockFloor::faulting()), + ..mock_component(0) + }], + ..mock_board() + }, + ); + activated(&mut driver, &mut orch); + + orch.dispatch(&mut driver, Event::BootConfirmed(C0)); + orch.dispatch(&mut driver, Event::SvnCommitRequest(C0)); + for tick in 0..16 { + if driver.pending_update().is_none() { + break; + } + driver.pump_update(tick); + } + + assert!(driver + .board() + .report_sink + .seen + .contains(&Report::SvnFloorCommitFailed(C0))); +} + +// A confirmed boot with no update behind it. There is nothing to +// re-sync. +#[test] +fn a_commit_without_an_activation_queues_nothing() { + let mut orch = orchestrator(); + let mut driver = update_driver(MockUpdatable::new()); + + // Boot the machine and nothing else. No update, so no activation + // and no claim on the staging region. + orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); + + driver.commit_svn_floor(C0).expect("commit failed"); + + // Nothing to copy, so no job. This is the ordinary confirmed boot. + assert_eq!(driver.pending_update(), None); +} + +// The boot proves the image runs; it does not move the SVN floor. +// Nothing reaches the board until the Update Agent sends +// UpdateSecurityRevision, because the eRoT's SVN floor for a device may +// not run ahead of the device's own. +#[test] +fn a_confirmed_boot_alone_leaves_the_floor_where_it_is() { + let mut orch = orchestrator(); + let mut driver = update_driver(MockUpdatable::new()); + + activated(&mut driver, &mut orch); + let floor_before = floor_of(&driver); + + orch.dispatch(&mut driver, Event::BootConfirmed(C0)); + + assert_eq!(floor_of(&driver), floor_before, "the agent has not asked"); + assert_eq!(driver.pending_update(), None, "and no re-sync was queued"); + + // The ask runs the commit. This board's spare still holds the old + // image, so the advance waits for the re-sync pass that the commit + // queues, which `the_floor_waits_for_the_spare_slot` follows to the + // end. What is pinned here is that the commit ran at all. + orch.dispatch(&mut driver, Event::SvnCommitRequest(C0)); + + assert_eq!(driver.pending_update(), Some(C0)); +} + +// One re-sync per activation. The second confirmed boot sends nothing, +// because the device already holds that image in both slots. +#[test] +fn a_second_commit_does_not_restage_again() { + let mut orch = orchestrator(); + let mut driver = update_driver(MockUpdatable::new()); + + // Update, confirm, and let the re-sync run to the end. Both slots + // now hold the same image. + activated(&mut driver, &mut orch); + orch.dispatch(&mut driver, Event::BootConfirmed(C0)); + orch.dispatch(&mut driver, Event::SvnCommitRequest(C0)); + for tick in 0..16 { + if driver.pending_update().is_none() { + break; + } + driver.pump_update(tick); + } + let staged_after_resync = driver.board().components[0].updatable.stagings; + + // A second confirmed boot for the same component. + orch.dispatch(&mut driver, Event::BootConfirmed(C0)); + orch.dispatch(&mut driver, Event::SvnCommitRequest(C0)); + + assert_eq!(driver.pending_update(), None); + assert_eq!( + driver.board().components[0].updatable.stagings, + staged_after_resync + ); + assert_eq!(driver.board().components[0].updatable.activations, 1); + + // Straight at the driver, with no commit window to gate it. + driver.commit_svn_floor(C0).expect("commit failed"); + + assert_eq!(driver.pending_update(), None); + assert_eq!( + driver.board().components[0].updatable.stagings, + staged_after_resync + ); +} + +// The device fails the second transfer. The image it is running was +// committed already, so this is a report, not something the SM has to +// act on. The job is cleared as well, or the pump would keep retrying +// the same failure. +#[test] +fn a_failed_resync_is_reported_and_ends() { + let mut orch = orchestrator(); + + // This device transfers the update fine and fails every step of the + // re-sync. + let mut driver = update_driver(MockUpdatable::faulting_on_the_second_pass()); + activated(&mut driver, &mut orch); + + orch.dispatch(&mut driver, Event::BootConfirmed(C0)); + orch.dispatch(&mut driver, Event::SvnCommitRequest(C0)); + + // One pump is enough: the device errors on the first step. + let poll = driver.pump_update(0); + + // No UpdateRejected. The update succeeded; this is the housekeeping + // after it. + assert_eq!(poll.event, None, "no verdict reaches the SM"); + + // The job is gone. Nobody else would clear it, and the pump would + // otherwise hit the same error on every tick forever. + assert_eq!(driver.pending_update(), None); + + // The stale slot is reported instead. + assert!(driver + .board() + .report_sink + .seen + .contains(&Report::SlotResyncFailed(C0))); + + // Still running the image it committed, and the SM never moved. + assert_eq!(driver.board().components[0].updatable.activations, 1); + assert_eq!(orch.state(), State::Ready); +} + +// A re-sync is writing the region to a device. A new candidate would +// overwrite those bytes halfway through, so the request is refused and +// the frontend answers the requester itself. An update in flight gets +// the same answer. The SM never hears about either. +#[test] +fn a_resync_in_flight_refuses_the_next_update() { + let mut orch = orchestrator(); + let mut driver = update_driver(MockUpdatable::stepping(4)); + activated(&mut driver, &mut orch); + orch.dispatch(&mut driver, Event::BootConfirmed(C0)); + orch.dispatch(&mut driver, Event::SvnCommitRequest(C0)); + assert_eq!(driver.pending_update(), Some(C0), "the re-sync is queued"); + + // A device that needs 4 steps, so the pass is still running here. + // request_update is the frontend's entry, the same call a real + // update request comes through. + assert_eq!( + request_update(&mut orch, &mut driver, C0, CANDIDATE_LEN), + Err(DriverError::UpdateBusy) + ); + + // Ready, not Updating: the refusal happened before the SM was + // dispatched to, so it never saw the request. + assert_eq!(orch.state(), State::Ready, "the SM never saw the request"); + + // Once the pass is done the frontend gets in. + for tick in 0..16 { + if driver.pending_update().is_none() { + break; + } + driver.pump_update(tick); + } + + assert_eq!(driver.submit_update(C0, CANDIDATE_LEN), Ok(())); +} + +// The device goes quiet during the second transfer. That is not an +// update failure: the SM hears nothing, and the stale spare slot is +// reported. +#[test] +fn a_stalled_resync_is_reported_not_rejected() { + let mut orch = orchestrator(); + + // This device transfers the update fine, then answers the re-sync + // with Transferring forever without moving a byte. + let mut driver = update_driver(MockUpdatable::stalling_on_the_second_pass()); + activated(&mut driver, &mut orch); + orch.dispatch(&mut driver, Event::BootConfirmed(C0)); + orch.dispatch(&mut driver, Event::SvnCommitRequest(C0)); + + // First pump at t=0 starts the stall clock. The device looks busy, + // so the pass stays open. + let mid_pass = driver.pump_update(0); + assert_eq!(mid_pass.event, None); + assert_eq!(mid_pass.progress, None, "nobody asked for this transfer"); + assert_eq!( + floor_of(&driver), + Svn(0), + "the floor moved while the spare was still being written" + ); + + // Second pump once the budget has passed with no bytes written. + let poll = driver.pump_update(STALL_BUDGET_MILLIS); + + // Same answer as a fault: report, do not reject. Rejecting would + // keep the job waiting for a DiscardStaged the SM never sends, + // because it never saw a request. Every later update would then be + // refused as busy. + assert_eq!(poll.event, None, "no verdict reaches the SM"); + assert_eq!(driver.pending_update(), None); + assert!(driver + .board() + .report_sink + .seen + .contains(&Report::SlotResyncFailed(C0))); + assert_eq!(driver.board().components[0].updatable.activations, 1); + assert_eq!(orch.state(), State::Ready); +} + +// An update came and went between the activation and the confirmed +// boot. The region holds different bytes now, so the commit must not +// re-stage from it. +#[test] +fn a_discarded_update_cancels_the_pending_resync() { + let mut orch = orchestrator(); + let mut driver = update_driver(MockUpdatable::new()); + + // Update one: staged, activated, and now owed a re-sync. Its bytes + // are the ones sitting in the staging region. + activated(&mut driver, &mut orch); + + // Update two takes the region over, then goes away again. Either + // call on its own cancels what update one was owed, so this covers + // the pair rather than each one. + driver.submit_update(C0, CANDIDATE_LEN).unwrap(); + driver.discard_staged().unwrap(); + + // Staging passes so far: update one's. A re-sync would add another. + let staged_before = driver.board().components[0].updatable.stagings; + + // Update one's boot is confirmed and the Update Agent requests the + // SVN. With no second update in between, this is what would queue + // the re-sync. + orch.dispatch(&mut driver, Event::BootConfirmed(C0)); + orch.dispatch(&mut driver, Event::SvnCommitRequest(C0)); + + // Nothing was queued. + assert_eq!( + driver.pending_update(), + None, + "no re-sync from a region that changed hands" + ); + + // And nothing ran: the pump finds no job, so the device is sent + // nothing. Without this the test would pass even if the re-sync + // never queued for any reason. + for tick in 0..4 { + driver.pump_update(tick); + } + assert_eq!( + driver.board().components[0].updatable.stagings, + staged_before, + "and no bytes went to the device" + ); +} + +/// A one-component driver whose board keeps `session` as the eRoT's own +/// update session. +fn self_trial_driver(session: MockSelfUpdate) -> PlatformDriver { + PlatformDriver::new( + &passive_entries(), + Board { + self_update: Some(ErotUpdate { + session, + floor: MockFloor::new(), + reset: MockSelfReset::new(), + }), + ..mock_board() + }, + ) +} + +/// The eRoT's own session in the state the test needs, with the trial +/// image running. +fn trial_session(state: SelfUpdateState) -> MockSelfUpdate { + MockSelfUpdate::with_session(state, RunningImage::Trial) +} + +/// What the board's self-update session reads. +fn session_state(driver: &PlatformDriver) -> SelfUpdateState { + driver + .board() + .self_update + .as_ref() + .expect("the test wired a self-update") + .session + .state +} + +/// What the floor next to that session reads. +fn self_floor(driver: &PlatformDriver) -> Svn { + driver + .board() + .self_update + .as_ref() + .expect("the test wired a self-update") + .floor + .floor() + .expect("the mock does not fault") +} + +// The trial image booted and the chain came up behind it, so the machine +// confirms the session on its way into Ready. The SVN floor stays where +// it is: the Update Agent requests the advance. +#[test] +fn a_trial_that_reaches_ready_is_confirmed() { + let mut orch = orchestrator(); + let mut driver = + self_trial_driver(trial_session(SelfUpdateState::TrialPending { svn: Svn(7) })); + let floor_before = self_floor(&driver); + + orch.dispatch(&mut driver, Event::SelfTrialBooted); + orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); + + assert_eq!(orch.state(), State::Ready); + assert_eq!( + session_state(&driver), + SelfUpdateState::Committed { svn: Svn(7) } + ); + assert_eq!( + self_floor(&driver), + floor_before, + "confirming is not committing" + ); +} + +// An ordinary boot on the same board. Nothing said a trial was running, so +// the session is left where it is. +#[test] +fn a_boot_with_no_trial_leaves_the_session_alone() { + let mut orch = orchestrator(); + let mut driver = self_trial_driver(MockSelfUpdate::idle()); + + orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); + + assert_eq!(orch.state(), State::Ready); + assert_eq!(session_state(&driver), SelfUpdateState::Idle); +} + +// The event says the settle call produced it and the board has +// none, so the +// two disagree about whether this eRoT updates itself. The effect fails and +// the platform locks down rather than carrying on with a trial nothing can +// confirm. +#[test] +fn confirming_a_trial_with_no_self_update_locks_down() { + let mut orch = orchestrator(); + let mut driver = driver([MemImage::holding(valid_image())]); + + orch.dispatch(&mut driver, Event::SelfTrialBooted); + orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); + + assert_eq!(orch.state(), State::Locked); +} + +// The session write fails. Same fail-secure answer: the trial is not +// confirmed and the platform locks down. +#[test] +fn a_session_that_cannot_be_written_locks_down() { + let mut orch = orchestrator(); + let mut driver = self_trial_driver(MockSelfUpdate { + fail: true, + ..trial_session(SelfUpdateState::TrialPending { svn: Svn(7) }) + }); + + orch.dispatch(&mut driver, Event::SelfTrialBooted); + orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); + + assert_eq!(orch.state(), State::Locked); +} + +// The boot that runs a trial image. The driver reads the board's own +// session and names the event the state machine needs in order to judge +// the trial. +#[test] +fn settling_a_running_trial_names_the_event_to_dispatch() { + let mut driver = + self_trial_driver(trial_session(SelfUpdateState::TrialPending { svn: Svn(7) })); + + let settlement = driver + .settle_self_update_session() + .expect("the mock does not fault"); + + assert_eq!( + settlement, + SelfUpdateSettlement::TrialRunning { svn: Svn(7) } + ); + assert_eq!(settlement.event(), Some(Event::SelfTrialBooted)); + assert_eq!( + session_state(&driver), + SelfUpdateState::TrialPending { svn: Svn(7) }, + "settling judges nothing" + ); +} + +// A board that never updates itself wires no self-update. There is no +// session to settle and nothing to tell the machine. +#[test] +fn a_board_with_no_self_update_is_already_settled() { + let mut driver = driver([MemImage::holding(valid_image())]); + + let settlement = driver + .settle_self_update_session() + .expect("nothing to read"); + + assert_eq!(settlement, SelfUpdateSettlement::Settled); + assert_eq!(settlement.event(), None); +} + +// A confirmed session the floor has not taken yet. The advance is the +// one the Update Agent requests, and no trial is running, so the +// settlement names no event. +#[test] +fn settling_an_awaited_floor_advance_names_no_event() { + let mut driver = self_trial_driver(trial_session(SelfUpdateState::Committed { svn: Svn(7) })); + + let settlement = driver + .settle_self_update_session() + .expect("the mock does not fault"); + + assert_eq!( + settlement, + SelfUpdateSettlement::AwaitingFloorAdvance { svn: Svn(7) } + ); + assert_eq!(settlement.event(), None); +} + +// The session reads `Idle` while the trial image is still running. That is +// what a revert leaves behind: it puts the slot metadata back but cannot +// unrun the image, so the part keeps running what it booted until the next +// reset. No trial is open, so the settlement names no event. +#[test] +fn settling_an_unclaimed_image_names_no_event() { + let mut driver = self_trial_driver(trial_session(SelfUpdateState::Idle)); + + let settlement = driver + .settle_self_update_session() + .expect("the mock does not fault"); + + assert_eq!(settlement, SelfUpdateSettlement::UnclaimedImageRunning); + assert_eq!(settlement.event(), None); +} + +// The boot-time call: settling a running trial dispatches the event, so +// the machine knows the trial is being judged before the walk starts. +#[test] +fn settling_at_boot_dispatches_the_trial_event() { + let mut orch = orchestrator(); + let mut driver = + self_trial_driver(trial_session(SelfUpdateState::TrialPending { svn: Svn(7) })); + + let settlement = settle_self_update_at_boot(&mut orch, &mut driver).expect("no fault"); + + assert_eq!( + settlement, + SelfUpdateSettlement::TrialRunning { svn: Svn(7) } + ); + // The machine has not walked yet, so nothing is confirmed. The first + // `Ready` is what does that. + assert_eq!( + session_state(&driver), + SelfUpdateState::TrialPending { svn: Svn(7) } + ); + + orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); + + assert_eq!(orch.state(), State::Ready); + assert_eq!( + session_state(&driver), + SelfUpdateState::Committed { svn: Svn(7) } + ); +} + +// Nothing was in flight, so no event reaches the state machine and the +// boot walks as any other. +#[test] +fn settling_at_boot_with_no_session_dispatches_nothing() { + let mut orch = orchestrator(); + let mut driver = self_trial_driver(MockSelfUpdate::idle()); + + let settlement = settle_self_update_at_boot(&mut orch, &mut driver).expect("no fault"); + + assert_eq!(settlement, SelfUpdateSettlement::Settled); + + orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); + + assert_eq!(orch.state(), State::Ready); + assert_eq!(session_state(&driver), SelfUpdateState::Idle); +} + +// The session could not be read. The boot has no honest answer about the +// last self-update, so nothing is dispatched and the fault is the +// caller's to act on. +#[test] +fn settling_at_boot_passes_a_storage_fault_back() { + let mut orch = orchestrator(); + let mut driver = self_trial_driver(MockSelfUpdate { + fail: true, + ..trial_session(SelfUpdateState::TrialPending { svn: Svn(7) }) + }); + + assert!(settle_self_update_at_boot(&mut orch, &mut driver).is_err()); + + orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); + + assert_eq!( + orch.state(), + State::Ready, + "no trial was declared, so the walk is an ordinary boot" + ); +} + +// The authenticated pass reads the candidate's SVN, and the floor must +// not take it. The floor takes what the post-activation walk read back +// from the image the device is now running, which is the only evidence +// that the new image is the one booting. The two values differ here, so +// a change that wired the candidate's SVN through would fail this. +#[test] +fn the_floor_takes_the_walk_svn_and_not_the_candidate_svn() { + let mut orch = orchestrator(); + let mut driver = update_driver(MockUpdatable::new()); + + // An update whose candidate authenticates at CANDIDATE_SVN. + activated(&mut driver, &mut orch); + + // The walk that follows the activation reads the image back, and the + // commit takes what it read. + driver + .execute(Effect::ReadFirmware(C0)) + .expect("stage failed"); + driver + .execute(Effect::VerifyFirmware(C0)) + .expect("verify failed"); + assert_eq!(driver.execute(Effect::CommitSvnFloor(C0)), Ok(None)); + + // The commit queues the spare-slot re-sync and holds the floor until + // that pass finishes, so the floor only moves once the pump has run. + for tick in 0..16 { + if driver.pending_update().is_none() { + break; + } + driver.pump_update(tick); + } + + assert_eq!( + floor_of(&driver), + Svn(MOCK_SVN), + "the floor took the SVN the walk verified" + ); + assert_ne!( + MOCK_SVN, CANDIDATE_SVN, + "the fixtures have to differ for this test to say anything" + ); +} + +// A verifier that authenticates without reading a manifest. The image is +// fine, so the commit succeeds; there is no version to move the floor to, +// so the floor stays where it is and the report says so. Locking here +// would turn a legal image into a halt, and DSP0267's own comparison +// stamp is optional. +#[test] +fn a_versionless_image_holds_the_floor_and_reports_it() { + let mut driver = PlatformDriver::::new( + &passive_entries(), + Board { + verifier: XorVerifier::unversioned(), + ..mock_board() + }, + ); + let before = floor_of(&driver); + + driver + .execute(Effect::ReadFirmware(C0)) + .expect("stage failed"); + assert_eq!( + driver.execute(Effect::VerifyFirmware(C0)), + Ok(Some(Event::VerificationPassed(C0))), + "the image authenticated; only its version is missing" + ); + + assert_eq!( + driver.execute(Effect::CommitSvnFloor(C0)), + Ok(None), + "a versionless image is not a fault" + ); + assert_eq!( + floor_of(&driver), + before, + "the floor had nothing to move to" + ); + assert!(driver + .board() + .report_sink + .seen + .contains(&Report::SvnFloorHeld(C0))); +} + +// The commit follows a walk that verifies, so reaching it with no verdict +// recorded means the driver and the machine disagree about what happened. +// That is drift, not a versionless image, and it fails secure. +#[test] +fn committing_with_no_verdict_recorded_fails_closed() { + use openprot_orchestrator_sm::EffectError; + + let mut driver = PlatformDriver::::new(&passive_entries(), mock_board()); + + assert_eq!( + driver.execute(Effect::CommitSvnFloor(C0)), + Err(EffectError), + "no verification has run" + ); +} + +// The spare slot holds the same firmware as the active one whether or +// not a floor moves behind it, so a versionless image still queues the +// re-sync the commit path queues for a versioned one. +#[test] +fn a_versionless_image_still_resyncs_the_spare_slot() { + let mut orch = orchestrator(); + let mut driver = PlatformDriver::::new( + &passive_entries(), + Board { + components: [ComponentWiring { + updatable: MockUpdatable::new(), + ..mock_component(0) + }], + verifier: XorVerifier::unversioned(), + ..mock_board() + }, + ); + activated(&mut driver, &mut orch); + let staged_before = driver.board().components[0].updatable.stagings; + + driver + .execute(Effect::ReadFirmware(C0)) + .expect("stage failed"); + driver + .execute(Effect::VerifyFirmware(C0)) + .expect("verify failed"); + assert_eq!(driver.execute(Effect::CommitSvnFloor(C0)), Ok(None)); + assert!(driver + .board() + .report_sink + .seen + .contains(&Report::SvnFloorHeld(C0))); + + // Queued, not transferred: the executor returned without sending + // anything, and the job is waiting for the pump. + assert_eq!(driver.pending_update(), Some(C0), "the re-sync is queued"); + + // 16 ticks is slack; this device finishes in one. + for tick in 0..16 { + if driver.pending_update().is_none() { + break; + } + driver.pump_update(tick); + } + + assert_eq!(driver.pending_update(), None, "the re-sync ended"); + assert!( + driver.board().components[0].updatable.stagings > staged_before, + "the spare was never sent the image" + ); +} + +/// The eRoT at position 0, where `chain_of` puts it, and a passive device +/// behind it. The eRoT alone never leaves `PreSupervision`, so driving the +/// machine needs the device too. +/// +/// The component kind decides which update path runs, in the state +/// machine and in the driver alike. These tests build the two separately, +/// so both take their chain from this helper and cannot disagree about +/// which component is the eRoT. +fn erot_chain() -> [(ComponentId, ComponentAttrs); EROT_N] { + entries_with_kinds([ComponentKind::Erot, ComponentKind::Passive]) +} + +/// Length of the eRoT chain: the eRoT and the one device behind it. +const EROT_N: usize = 2; +/// The effect buffer `Rot` requires for `EROT_N` components. +const EROT_E: usize = 2 * EROT_N + 2; + +fn erot_orchestrator() -> Orchestrator { + let chain = heapless::Vec::<_, EROT_N>::from_slice(&erot_chain()).expect("two fits"); + Orchestrator::new(chain.try_into().unwrap(), MOCK_MAX_RETRY) +} + +/// A driver over that chain with `session` as the eRoT's update session. +fn erot_driver(session: MockSelfUpdate) -> PlatformDriver { + erot_driver_with(session, StubVerifier::accepting()) +} + +fn erot_driver_with( + session: MockSelfUpdate, + update_verifier: StubVerifier, +) -> PlatformDriver { + PlatformDriver::new( + &erot_chain(), + Board { + self_update: Some(ErotUpdate { + session, + floor: MockFloor::new(), + reset: MockSelfReset::new(), + }), + update_verifier: Some(update_verifier), + ..mock_board() + }, + ) +} + +/// Brings the state machine to `Ready`: the walk steps past the eRoT and +/// the device behind it boots. +fn erot_chain_up( + orch: &mut Orchestrator, + driver: &mut PlatformDriver, +) { + orch.dispatch(driver, Event::PowerGood(PowerOnResult::Provisioned)); + orch.dispatch(driver, Event::Booted(ComponentId::new(1))); + assert_eq!(orch.state(), State::Ready, "the chain is up"); +} + +/// Pumps the update until the verifier reaches a verdict: +/// `UpdateVerified` for a candidate the eRoT may install, +/// `UpdateRejected` for one it may not. +fn pump_to_verdict(driver: &mut PlatformDriver) -> Event { + for tick in 0..16 { + if let Some(event) = driver.pump_update(tick).event { + return event; + } + } + panic!("the pump reached no verdict"); +} + +// `prepare` records the SVN before `set_trial_pending` marks the trial, +// the order SelfUpdate states. A crash between the two leaves a pending +// trial the next boot reads as unconfirmed; the other order would boot a +// trial with no session to judge it. +// +// The SVN recorded is the candidate image's, the only one the eRoT ever +// reads of itself. See "Where the SVN comes from" in +// docs/src/design/erot-self-verification.md. +#[test] +fn activating_the_erots_own_update_records_the_session_then_reaches_the_reset() { + assert_ne!( + CANDIDATE_SVN, MOCK_SVN, + "the two SVN fixtures have to differ or this test proves nothing" + ); + let mut driver = erot_driver(MockSelfUpdate::idle()); + driver.submit_update(C0, CANDIDATE_LEN).unwrap(); + driver.prepare_update().unwrap(); + assert_eq!(pump_to_verdict(&mut driver), Event::UpdateVerified); + + assert_eq!( + driver.activate_update(), + Err(DriverError::SelfResetFault), + "the mock cannot reset the process it runs in" + ); + + let self_update = driver.board().self_update.as_ref().expect("wired above"); + assert_eq!( + self_update.session.state(), + Ok(SelfUpdateState::TrialPending { + svn: Svn(CANDIDATE_SVN) + }), + "the session holds the candidate's own SVN, marked pending" + ); + assert_eq!(self_update.reset.attempts, 1, "the reset was reached"); +} + +// The candidate for the eRoT authenticated with no manifest SVN, so there +// is no session to record. The pump rejects it, the update ends and the +// state machine returns to Ready. Rejecting at the activation would fail +// that effect and lock the platform, which a missing version does not +// warrant. +#[test] +fn a_versionless_self_candidate_ends_the_update_without_locking() { + let mut orch = erot_orchestrator(); + let mut driver = erot_driver_with(MockSelfUpdate::idle(), StubVerifier::unversioned()); + erot_chain_up(&mut orch, &mut driver); + + request_update(&mut orch, &mut driver, C0, CANDIDATE_LEN).expect("the request is accepted"); + assert_eq!(orch.state(), State::Updating(C0)); + + let verdict = pump_to_verdict(&mut driver); + assert_eq!(verdict, Event::UpdateRejected, "the pump rejected it"); + assert!(driver + .board() + .report_sink + .seen + .contains(&Report::SelfImageNoSvn)); + + orch.dispatch(&mut driver, verdict); + assert_eq!( + orch.state(), + State::Ready, + "the update ended and the platform is not locked" + ); + assert_eq!(driver.pending_update(), None, "and the job is gone"); + + let self_update = driver.board().self_update.as_ref().expect("wired above"); + assert_eq!( + self_update.session.state(), + Ok(SelfUpdateState::Idle), + "nothing was recorded" + ); + assert_eq!(self_update.reset.attempts, 0, "and nothing reset"); +} + +// One update at a time, whatever it targets. A request aimed at the eRoT +// while a device behind it is being updated is refused as `UpdateBusy`, +// and the job already in flight is untouched. +// +// The board wires no self-update either, so the self-update check would +// refuse the request too. The answer is `UpdateBusy` and not +// `NoErotUpdate` because the busy check in submit_update runs +// first. +#[test] +fn an_erot_update_is_refused_while_a_device_update_is_in_flight() { + let mut driver = PlatformDriver::::new(&erot_chain(), mock_board()); + driver + .submit_update(C1, CANDIDATE_LEN) + .expect("the device update starts"); + + assert_eq!( + driver.submit_update(C0, CANDIDATE_LEN), + Err(DriverError::UpdateBusy) + ); + assert_eq!( + driver.pending_update(), + Some(C1), + "the device update is still the one in flight" + ); +} + +// A board with no `ErotUpdate` cannot record the session the +// update needs. +// Accepting would run it to the activation, where the effect fails and +// locks the platform. Refused at submit, the state machine never leaves +// Ready. +#[test] +fn an_update_aimed_at_the_erot_is_refused_when_the_board_wires_no_self_update() { + let mut orch = erot_orchestrator(); + let mut driver = PlatformDriver::::new(&erot_chain(), mock_board()); + erot_chain_up(&mut orch, &mut driver); + + assert_eq!( + request_update(&mut orch, &mut driver, C0, CANDIDATE_LEN), + Err(DriverError::NoErotUpdate) + ); + assert_eq!(orch.state(), State::Ready, "the request reached nothing"); + assert_eq!(driver.pending_update(), None, "and stored nothing"); +} + +// A trial was confirmed but its SVN has not reached the floor. A second +// update would overwrite the session holding it, and the floor would +// never get it. +#[test] +fn a_second_self_update_is_refused_while_the_first_awaits_its_floor() { + let mut driver = erot_driver(MockSelfUpdate::with_session( + SelfUpdateState::Committed { svn: Svn(7) }, + RunningImage::Confirmed, + )); + + assert_eq!( + driver.submit_update(C0, CANDIDATE_LEN), + Err(DriverError::UpdateBusy) + ); + assert_eq!(driver.pending_update(), None, "nothing was stored"); + let self_update = driver.board().self_update.as_ref().expect("wired above"); + assert_eq!( + self_update.session.state(), + Ok(SelfUpdateState::Committed { svn: Svn(7) }), + "and the session still holds the confirmed SVN" + ); +} + +// The same while the trial is being judged: this boot is the trial, and a +// new record would overwrite the session that judges it. +#[test] +fn a_self_update_is_refused_while_the_trial_is_being_judged() { + let mut driver = erot_driver(trial_session(SelfUpdateState::TrialPending { svn: Svn(7) })); + + assert_eq!( + driver.submit_update(C0, CANDIDATE_LEN), + Err(DriverError::UpdateBusy) + ); +} + +// A trial image that booted once and was not confirmed: the reset after +// booted the old image again, so no boot that could confirm the trial +// will come, and settlement drops the session either way. A new +// self-update must not be refused for a session that can only be +// discarded. +#[test] +fn a_self_update_may_start_over_a_trial_that_fell_back() { + let mut driver = erot_driver(MockSelfUpdate::with_session( + SelfUpdateState::TrialPending { svn: Svn(7) }, + RunningImage::Confirmed, + )); + + assert_eq!(driver.submit_update(C0, CANDIDATE_LEN), Ok(())); +} + +/// The eRoT's own floor, as [`self_floor`] reads it for the one-component +/// boards. +fn erot_floor(driver: &PlatformDriver) -> Svn { + driver + .board() + .self_update + .as_ref() + .expect("the test wired a self-update") + .floor + .floor() + .expect("floor unreadable") +} + +/// The state the eRoT's own update session reads. +fn erot_session_state(driver: &PlatformDriver) -> SelfUpdateState { + driver + .board() + .self_update + .as_ref() + .expect("the test wired a self-update") + .session + .state() + .expect("session unreadable") +} + +// The agent requests the eRoT's floor the way it requests any other +// component's: `Event::SvnCommitRequest` in, `Effect::CommitSvnFloor` +// out. The driver reads the eRoT's floor out of the `ErotUpdate` rather +// than the component wiring, because that is where it lives, next to +// the session that says which SVN the trial confirmed. +#[test] +fn the_request_advances_the_erot_svn_floor() { + let mut orch = erot_orchestrator(); + let mut driver = erot_driver(trial_session(SelfUpdateState::TrialPending { + svn: Svn(SELF_TRIAL_SVN), + })); + + orch.dispatch(&mut driver, Event::SelfTrialBooted); + orch.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); + orch.dispatch(&mut driver, Event::Booted(ComponentId::new(1))); + assert_eq!(orch.state(), State::Ready); + assert_ne!( + erot_floor(&driver), + Svn(SELF_TRIAL_SVN), + "confirming the trial does not move the floor" + ); + + orch.dispatch(&mut driver, Event::SvnCommitRequest(C0)); + + assert_eq!( + erot_floor(&driver), + Svn(SELF_TRIAL_SVN), + "the floor took the SVN the confirmed trial recorded" + ); + assert_eq!( + erot_session_state(&driver), + SelfUpdateState::Idle, + "and the session closed behind it" + ); +} + +// A request with no confirmed self-update behind it. No trial confirmed +// an SVN, so there is none to move the floor to and the effect fails +// rather than quietly succeeding. +#[test] +fn a_request_with_no_confirmed_self_update_is_refused() { + use openprot_orchestrator_sm::EffectError; + + let mut driver = erot_driver(MockSelfUpdate::idle()); + let before = erot_floor(&driver); + + assert_eq!( + driver.execute(Effect::CommitSvnFloor(C0)), + Err(EffectError), + "no trial has been confirmed" + ); + assert_eq!(erot_floor(&driver), before, "and the floor did not move"); +} diff --git a/services/orchestrator/sm/BUILD.bazel b/services/orchestrator/sm/BUILD.bazel index 6707f9fa0..689c3b9df 100644 --- a/services/orchestrator/sm/BUILD.bazel +++ b/services/orchestrator/sm/BUILD.bazel @@ -8,6 +8,11 @@ rust_library( srcs = [ "src/lib.rs", "src/model.rs", + "src/orchestrator.rs", + "src/platform.rs", + "src/rot.rs", + "src/sink.rs", + "src/status.rs", "src/tests.rs", ], crate_name = "openprot_orchestrator_sm", diff --git a/services/orchestrator/sm/src/lib.rs b/services/orchestrator/sm/src/lib.rs index 07f9f4d3c..12ad6e2b3 100644 --- a/services/orchestrator/sm/src/lib.rs +++ b/services/orchestrator/sm/src/lib.rs @@ -14,1078 +14,33 @@ //! visible in the trace; used for the retry cap (INV7). //! 3. **Reads as events** — outside information arrives in [`Event`] payloads; //! the core never reads anything directly. +//! +//! The crate is split by role: `model` holds the vocabulary (states, events, +//! effects, chain config), [`sink`] the effect buffer and its capacities, +//! `status` the per-component service record, [`rot`] the storage and the +//! transition handlers, [`platform`] the executor seam, and [`orchestrator`] +//! the event loop a caller drives. #![no_std] #![forbid(unsafe_code)] -use core::marker::PhantomData; - mod model; -pub use model::*; - -// Internal capacities — these follow from how the machine works, not from the -// deployment. The board owns `N` (chain length), `E` (effect-buffer size) and -// max_retry. - -/// Upper bound on events queued at once inside `dispatch_with`. The queue -/// pops as it settles, so this bounds *in-flight* events, not a run's total -/// length: one batch can queue at most one `Emit` follow-up plus one returned -/// event per external effect. Executors that return an event for many effects -/// of one batch can overflow this; overflow is fail-closed (see -/// `dispatch_with`), never silent loss. -const PENDING_CAP: usize = 8; - -/// Compile-time floor: room for an `Emit` follow-up, a returned event, and -/// the injected `EffectFailed`. Evaluated at build time (an anonymous -/// `const`), so an under-sized `PENDING_CAP` fails to compile. -const _: () = assert!( - PENDING_CAP >= 3, - "PENDING_CAP must hold an Emit follow-up + a returned event + EffectFailed", -); - -/// Result of dispatching one event to a state (or its superstate). -enum Outcome { - /// Event consumed; state unchanged; no entry action runs. - Handled, - /// Change to this state and run its entry action. - Transition(State), - /// Not handled here; defer to the superstate (or discard if none). - Super, -} - -/// The effect buffer handed to every handler, sized to `E`. -/// -/// The only thing a handler can do to the outside world is call `emit`. The -/// orchestrator gives each event a fresh `Sink` and drains it afterward. -/// -/// `E` is bounded from below by the chain length: the worst single event is a -/// full cascade (up to `N` `AssertReset`s, each paired with a `ReportIsolated`) -/// plus the destination `PreSupervision` entry's `ReadFirmware`/`VerifyFirmware` -/// (2), all landing in one `Sink`. The re-walk quiesce (an `AssertReset` per -/// live component) never pushes past this bound, because gating and quiescing -/// are mutually exclusive per component: a component the cascade isolates is not -/// also live, so the two counts never sum above the full-cascade worst case. -/// `Rot::new` refuses to compile unless `E >= 2 * N + 2`, so a machine that -/// builds can never overflow this buffer. -pub struct Sink { - effects: heapless::Vec, -} - -impl Sink { - fn new() -> Self { - Self { - effects: heapless::Vec::new(), - } - } - - /// Append one effect. `E` is sized so overflow is impossible for a machine - /// that compiles: `Rot::EFFECT_CAP_OK` proves `E >= 2 * N + 2` and no - /// handler emits more than `2 * N + 2` effects into one `Sink`, so the push - /// below can never fail. The `Err` arm is therefore dead — dropped rather - /// than panicked, since a runtime panic here would be unreachable code - /// shipped in the binary. - /// - /// The driver runs the effects from one handler in the order they were - /// emitted, and it does not run them as a single all-or-nothing group: if - /// one effect fails, the ones before it have already happened. When an - /// effect fails, the driver stops there — it skips the rest and injects - /// `EffectFailed` so the machine locks down. Stopping partway is still safe - /// no matter what order the effects were in: a component is only ever - /// released after it has passed verification, and every other effect either - /// tightens things (holds a component in reset, or latches lockdown) or just - /// reports what happened. So a batch that stops early can only leave the - /// platform more locked down, never less. A skipped report costs information, - /// not containment — and the batch was cut short by a failure that latches - /// lockdown anyway, which is the louder signal. - pub fn emit(&mut self, effect: Effect) { - // Dead Err arm: overflow is proved impossible by `Rot::EFFECT_CAP_OK` - // (`E >= 2 * N + 2`) plus the state machine never emitting more than - // `2 * N + 2` effects into one Sink. - let _ = self.effects.push(effect); - } - - pub fn effects(&self) -> &[Effect] { - &self.effects - } -} - -/// Outcome of [`Rot::gate_by_policy`]: whether a component was gated out of -/// service. Collapses the three [`FailurePolicy`] values into the two -/// control-flow outcomes the caller actually branches on — so the -/// runtime-corruption path and the recovery-exhaustion path decide on the same -/// result. -#[derive(Clone, Copy, PartialEq, Eq, Debug)] -enum Gating { - /// The component was gated (`Isolable` → itself; `Cascading` → itself and - /// its transitive dependents). Its reset is asserted and the walk skips it. - Gated, - /// Not a gating policy (`Required`, or an unknown/missing id). Nothing was - /// gated; the caller handles this in its own context — recover (at runtime) - /// or lock down (once recovery is exhausted). - NotGated, -} - -/// Per-component service lifecycle. Each chain component carries one of these -/// inside its [`ComponentStatus`], recording whether it is in normal service or -/// gated out. The walk-phase payloads (`AwaitingReady`/`Recovering`) stay on the -/// global [`State`] rather than here — those phases are properties of the whole -/// machine, not of one component. Named for the *component service* axis to keep -/// it distinct from orchestrator-capabilities's trial-boot/commit (update-slot) -/// lifecycle, which -/// is a separate concern. -#[derive(Clone, Copy, PartialEq, Eq, Debug)] -enum ComponentLifecycle { - /// In the normal flow: held, under verification, or released. The global - /// `State` carries which of those the walk is in. - Nominal, - /// Durably gated out of service: has a live `AssertReset` and is skipped on - /// every chain walk. - Isolated, -} - -/// One per-component record (see [`Rot::statuses`]). -#[derive(Clone, Copy, PartialEq, Eq, Debug)] -struct ComponentStatus { - lifecycle: ComponentLifecycle, - /// Consecutive failed-restore count (INV7: consecutive only). - retry: u8, - /// Set while this component has been released from reset but has not yet - /// reported its boot-progress signal ([`Event::ComponentReady`] for an - /// `Active` component, [`Event::Booted`] for a `Passive` one). The platform driver - /// arms a per-component watchdog on release; this bit is what a later - /// [`Event::Timeout`] consults to tell a real boot failure from a stale or - /// spurious timeout. Orthogonal to `lifecycle`: a gated component owes no - /// boot-progress signal, so gating clears it. - awaiting_boot: bool, - /// Set while this component has been released from reset and not since held - /// again — i.e. it is *live*, executing code. Set at every `ReleaseReset`, - /// cleared at every `AssertReset` (gating, recovery, or the pre-walk - /// quiesce). This is what makes recovery a genuine platform re-boot: on - /// re-entering [`State::PreSupervision`] the machine asserts reset on every - /// live component before re-verifying, so `VerifyFirmware` never runs - /// against code that is still executing (a live check says nothing about - /// what is running and is open to a post-check flash rewrite). Distinct from - /// `awaiting_boot`, which is cleared once the component reports in but stays - /// live: a booted component is `released` yet no longer `awaiting_boot`. - released: bool, -} - -impl Default for ComponentStatus { - fn default() -> Self { - Self { - lifecycle: ComponentLifecycle::Nominal, - retry: 0, - awaiting_boot: false, - released: false, - } - } -} - -/// Shared storage: data that persists across events. `N` is the chain capacity -/// and `E` the effect-buffer size — both board choices; the core sets no -/// default. `E` must be at least `2 * N + 2` (enforced in [`Rot::new`]). -pub struct Rot { - chain: heapless::Vec<(ComponentId, ComponentAttrs), N>, - cursor: u8, - /// One record per chain component (parallel to `chain` by index). Each - /// [`ComponentStatus`] holds the component's service `lifecycle` (`Isolated` - /// means gated out of the walk) and its consecutive failed-restore `retry` - /// count, kept per component so interleaved recoveries never share a budget. - /// Durable across a return to `Ready`; only a fresh `Rot` on `PowerOnReset` - /// resets it. - statuses: heapless::Vec, - max_retry: u8, - /// Set when an update has been activated ([`Effect::ActivateUpdate`]) but - /// its anti-rollback floor has not yet been committed, i.e. the machine is - /// in the *activated-but-not-committed* window inside [`State::Ready`]. A - /// [`Event::BootConfirmed`] commits the floor and clears this; a - /// [`Event::CommitTimeout`] fired while this is set latches - /// [`State::Locked`] (commit-or-lock: the floor is never advanced for an - /// image that has not proven healthy, and the downgrade window is never left - /// open indefinitely). Cleared on [`Event::BootConfirmed`] (the window - /// closes normally) and on entry to the two states that end the window by - /// leaving `Ready` while still running — [`State::Updating`] (a superseding - /// update) and [`State::Recovering`] (corruption/timeout) — so any path that - /// leaves and later re-enters `Ready` resets the window without per-branch - /// bookkeeping. (It is *not* cleared on `Ready` entry, because activation - /// sets it while transitioning *into* `Ready`.) - pending_commit: bool, - /// Ties the effect-buffer size `E` to this type (zero-sized). - _effect_cap: PhantomData<[u8; E]>, -} - -impl Rot { - /// Compile-time floor: the effect buffer must hold a full cascade (`N` - /// `AssertReset`s paired with `N` `ReportIsolated`s) plus the destination - /// `PreSupervision` entry's two effects. Forced by `new` below, so an - /// under-sized `E` fails to build. - const EFFECT_CAP_OK: () = assert!( - E >= 2 * N + 2, - "effect buffer E must be >= 2 * chain length N + 2", - ); - - pub fn new(chain: Chain, max_retry: u8) -> Self { - let () = Self::EFFECT_CAP_OK; - let chain = chain.into_entries(); - // One status record per chain component, parallel by index. - let mut statuses = heapless::Vec::new(); - for _ in 0..chain.len() { - let _ = statuses.push(ComponentStatus::default()); - } - Self { - chain, - cursor: 0, - statuses, - max_retry, - pending_commit: false, - _effect_cap: PhantomData, - } - } - - /// Look up a component's attributes by id. `None` if the id is not in the - /// chain (should never happen for ids the core itself produced). - fn attrs_of(&self, id: ComponentId) -> Option { - self.chain - .iter() - .find(|(cid, _)| *cid == id) - .map(|(_, a)| *a) - } - - /// Index of `id` in the parallel `chain`/`statuses` arrays. `None` if the - /// id is not in the chain (should never happen for core-produced ids). - fn status_index(&self, id: ComponentId) -> Option { - self.chain.iter().position(|(cid, _)| *cid == id) - } - - /// Whether `id` names a component in the configured chain. The core only - /// supervises chain components, so an event that names an id outside the - /// chain is dropped rather than acted on — it describes something the core - /// has no model of and never released. - fn in_chain(&self, id: ComponentId) -> bool { - self.status_index(id).is_some() - } - - fn is_gated(&self, id: ComponentId) -> bool { - self.status_index(id) - .is_some_and(|i| self.statuses[i].lifecycle == ComponentLifecycle::Isolated) - } - - /// Gate one component out of service, returning `true` if this newly gated - /// it (`false` if already `Isolated`). Emits the paired `AssertReset` + - /// `ReportIsolated` only on the newly-gated transition, so reporting is - /// idempotent per component. - fn gate_one(&mut self, ctx: &mut Sink, id: ComponentId) -> bool { - if self.is_gated(id) { - return false; - } - ctx.emit(Effect::AssertReset(id)); - ctx.emit(Effect::ReportIsolated(id)); - if let Some(i) = self.status_index(id) { - self.statuses[i].lifecycle = ComponentLifecycle::Isolated; - // A gated component is held in reset and no longer owes a - // boot-progress signal; drop any pending watchdog so a late - // `Timeout` can't drag an already-isolated component into recovery. - // It is also no longer live — the `AssertReset` above holds it. - self.statuses[i].awaiting_boot = false; - self.statuses[i].released = false; - } - true - } - - /// Increment `id`'s consecutive failed-restore count and return the new - /// value. Counts are kept per component so that interleaved recovery - /// episodes for different components never share a budget. - fn bump_retry(&mut self, id: ComponentId) -> u8 { - match self.status_index(id) { - Some(i) => { - self.statuses[i].retry = self.statuses[i].retry.saturating_add(1); - self.statuses[i].retry - } - None => 0, - } - } - - /// Drop `id`'s retry count. Called when the component recovers (passes - /// verification) or is gated — either way its consecutive-failure streak - /// ends, so a future failure starts counting fresh (INV7: consecutive only). - fn clear_retry(&mut self, id: ComponentId) { - if let Some(i) = self.status_index(id) { - self.statuses[i].retry = 0; - } - } - - /// Record that `id` has been released and now owes a boot-progress signal. - /// Paired with the `ReleaseReset` emitted at each release site: the platform driver - /// arms its per-component boot watchdog there, and this arms ours. Also - /// marks the component *live* (`released`), which a later re-entry to - /// [`State::PreSupervision`] uses to quiesce it before re-verifying. - fn mark_released(&mut self, id: ComponentId) { - if let Some(i) = self.status_index(id) { - self.statuses[i].awaiting_boot = true; - self.statuses[i].released = true; - } - } - - /// Clear `id`'s boot-progress watchdog because it reported in - /// ([`Event::ComponentReady`] or [`Event::Booted`]). Idempotent: a report - /// for a component not awaiting boot simply changes nothing. - fn clear_awaiting_boot(&mut self, id: ComponentId) { - if let Some(i) = self.status_index(id) { - self.statuses[i].awaiting_boot = false; - } - } - - /// Whether `id` has been released and still owes a boot-progress signal. - /// A [`Event::Timeout`] is a real boot failure only for such a component; - /// otherwise it is stale/spurious. - fn is_awaiting_boot(&self, id: ComponentId) -> bool { - self.status_index(id) - .is_some_and(|i| self.statuses[i].awaiting_boot) - } +pub mod orchestrator; +pub mod platform; +pub mod rot; +pub mod sink; +mod status; - /// Advance `cursor` from `start_idx` to the first component not in - /// `gated`, emitting its `ReadFirmware`/`VerifyFirmware`. Returns `true` if - /// found. If the rest of the chain is exhausted or entirely gated, sets - /// `cursor` to a past-the-end sentinel (`chain.len()`) and returns - /// `false` — the caller should treat that as "chain done". - fn advance_to_next_ungated(&mut self, ctx: &mut Sink, start_idx: usize) -> bool { - let mut idx = start_idx; - while let Some(&(id, _)) = self.chain.get(idx) { - if !self.is_gated(id) { - // `idx < chain.len() <= N`; chain capacity is board-chosen and - // assumed to fit `u8`, matching the existing `cursor: u8` contract. - self.cursor = idx as u8; - ctx.emit(Effect::ReadFirmware(id)); - ctx.emit(Effect::VerifyFirmware(id)); - return true; - } - idx += 1; - } - self.cursor = self.chain.len() as u8; - false - } - - /// Hold the whole platform for an at-rest re-verification: assert reset on - /// every component that is currently *live* (`released`) and drop its - /// boot-progress watchdog, so the walk that follows verifies code that is - /// quiesced rather than executing. This is what makes recovery a genuine - /// platform re-boot — no released component is ever re-verified while it is - /// still running (a live check says nothing about what is executing and is - /// open to a post-check flash rewrite). - /// - /// Lifecycle is untouched: these components are held for re-check, not gated - /// (`Nominal` stays `Nominal`), and each is released again by its - /// `ReleaseReset` once it re-passes verification. Isolated components are - /// already held (`released == false`) and are skipped, as is anything under - /// active recovery. At the initial power-on walk nothing is live yet, so - /// this emits nothing and cold boot is unchanged. - fn quiesce_all(&mut self, ctx: &mut Sink) { - for i in 0..self.chain.len() { - if !self.statuses[i].released { - continue; - } - let (id, _) = self.chain[i]; - ctx.emit(Effect::AssertReset(id)); - self.statuses[i].released = false; - self.statuses[i].awaiting_boot = false; - } - } - /// shared by both paths that take a component out of service — the - /// runtime-corruption path ([`handle_corruption`](Self::handle_corruption)) - /// and the recovery-exhaustion path — so the two can never disagree about - /// what a policy means (in particular, `Cascading` cascades in both). - /// - /// - `Isolable` → gate this component alone → [`Gating::Gated`]. - /// - `Cascading` → gate this component and every transitive dependent → - /// [`Gating::Gated`]. - /// - `Required`, or an unknown/missing id → gate nothing → - /// [`Gating::NotGated`], leaving the caller to handle the non-gating - /// outcome in its own context (recover, at runtime; lock down, once - /// recovery is exhausted). - /// - /// Every component this gates also gets an [`Effect::ReportIsolated`], so - /// management software learns the platform is degraded no matter which path - /// took the component out of service. - /// - /// Idempotent per component (guarded by `is_gated`) — so is the reporting: - /// a component already gated is neither re-reset nor re-reported. - fn gate_by_policy(&mut self, ctx: &mut Sink, id: ComponentId) -> Gating { - match self.attrs_of(id).map(|attrs| attrs.failure_policy) { - Some(FailurePolicy::Cascading) => { - self.cascade_hold(ctx, id); - Gating::Gated - } - Some(FailurePolicy::Isolable) => { - self.gate_one(ctx, id); - Gating::Gated - } - // `Required`, or an unknown/missing id: not a gating policy. - _ => Gating::NotGated, - } - } - - /// Shared `CorruptionDetected` handling, called from both `PreSupervision` - /// (directly) and `SupervisingPlatform` (via its superstate handler). - /// Delegates the policy interpretation to [`gate_by_policy`](Self::gate_by_policy) - /// so this path and the recovery-exhaustion path can never diverge: - /// `Isolable`/`Cascading` → gate the component (single or cascade) and stay - /// put, so a later re-walk skips it instead of silently re-releasing one we - /// already found corrupt; `Required` → recover first (the halt-on-exhaustion - /// decision happens later in `Recovering`). - fn handle_corruption(&mut self, id: ComponentId, ctx: &mut Sink) -> Outcome { - match self.gate_by_policy(ctx, id) { - Gating::Gated => Outcome::Handled, - Gating::NotGated => Outcome::Transition(State::Recovering(id)), - } - } - - /// Hold `root` and cascade-hold every component whose `depends_on` - /// (transitively) names it. Emits `AssertReset` and `ReportIsolated` for - /// each newly gated component, including `root` itself — every isolated - /// device is reported, not just the one that failed. - fn cascade_hold(&mut self, ctx: &mut Sink, root: ComponentId) { - // BFS over the growing isolation front. `frontier` holds the components - // gated so far whose dependents still need visiting; `statuses` records - // the durable `Isolated` mark for each. - let mut frontier: heapless::Vec = heapless::Vec::new(); - if self.gate_one(ctx, root) { - let _ = frontier.push(root); - } - let mut i = 0; - while let Some(&holder) = frontier.get(i) { - i += 1; - let mut newly_gated: heapless::Vec = heapless::Vec::new(); - for &(id, attrs) in self.chain.iter() { - if attrs.depends_on == Some(holder) && !self.is_gated(id) { - let _ = newly_gated.push(id); - } - } - for id in newly_gated { - if self.gate_one(ctx, id) { - let _ = frontier.push(id); - } - } - } - } -} - -/// The state machine proper: the per-state handlers, the superstate handler, and the -/// entry actions. These are pure functions of `(stored data, state, event)` — -/// they mutate [`Rot`]'s storage and push [`Effect`]s into the [`Sink`], and -/// return an [`Outcome`] describing what should happen to the current state. -/// Applying that outcome is the engine's job ([`Orchestrator::step`]). -impl Rot { - /// Dispatch `event` to the handler for `state` (the leaf state). An - /// [`Outcome::Super`] here means "not handled at this level" — the engine - /// forwards to [`handle_supervising`](Self::handle_supervising) if `state` - /// is supervised, and otherwise discards the event. - fn handle(&mut self, state: State, event: &Event, ctx: &mut Sink) -> Outcome { - match state { - State::PowerOnReset => match event { - Event::PowerGood(PowerOnResult::Provisioned) => { - Outcome::Transition(State::PreSupervision) - } - Event::PowerGood(PowerOnResult::Unprovisioned) => { - Outcome::Transition(State::Locked) - } - Event::PowerGood(PowerOnResult::SelfVerificationFailed) => { - Outcome::Transition(State::Locked) - } - Event::EffectFailed => Outcome::Transition(State::Locked), - _ => Outcome::Super, - }, - - // Cursor walk via Outcome::Handled — a self-transition would reset cursor. - State::PreSupervision => match event { - Event::VerificationPassed(id) => { - // Only the component currently under verification - // (`chain[cursor]`, whose `VerifyFirmware` was just emitted) - // may be released. A verdict for any other id is stale or - // out-of-turn and is dropped, so a misordered or hostile - // report cannot release an unverified component (cf. INV9 - // for `ComponentReady`). - if self.chain.get(self.cursor as usize).map(|(c, _)| c) != Some(id) { - return Outcome::Handled; - } - // The component passed its check — it has recovered, so its - // consecutive-failure streak ends (INV7: consecutive only). - self.clear_retry(*id); - ctx.emit(Effect::ReleaseReset(*id)); - // Released: it is now live, and owes a boot-progress signal - // (both tiers). - self.mark_released(*id); - let current_kind = self.chain.get(self.cursor as usize).map(|(_, a)| a.kind); - let next_idx = (self.cursor as usize).saturating_add(1); - if self.advance_to_next_ungated(ctx, next_idx) { - match current_kind { - Some(ComponentKind::Active) => { - Outcome::Transition(State::AwaitingReady(Some(*id))) - } - _ => Outcome::Handled, - } - } else { - Outcome::Transition(State::Ready) - } - } - Event::VerificationFailed(id) => { - // Recovery is attempted first for every failure, regardless - // of the component's recovery-failure policy (CSA: recover - // first, classify only once retries are exhausted). - Outcome::Transition(State::Recovering(*id)) - } - // Minimal fix: react to a corruption report if one arrives, - // even though `PreSupervision` isn't linked to - // `SupervisingPlatform`. Not acting on data we already have - // would be strictly worse than acting on it, regardless of - // whether CSA defines a mechanism that guarantees this event - // exists in the first place. `AttestationChallenge` is left - // unhandled here (falls through to `Outcome::Super` and is - // discarded) — that's a separate question. - Event::CorruptionDetected(id) => self.handle_corruption(*id, ctx), - // Boot-progress liveness for a passive component released - // speculatively earlier in this same walk. Clear its watchdog - // even though `PreSupervision` is unsupervised — acting on a - // report we already have is never worse than dropping it (same - // rationale as `CorruptionDetected` above). An `Active` - // component's `ComponentReady` cannot arrive here: releasing an - // active moves the machine straight to `AwaitingReady`. - Event::Booted(id) => { - self.clear_awaiting_boot(*id); - Outcome::Handled - } - // Device-agnostic boot-progress watchdog. A passive component - // released speculatively can miss its window while the walk is - // still in `PreSupervision`; treat that as a boot failure and - // recover it, exactly as the supervised states do. A timeout for - // a component not awaiting boot (e.g. still under verification) - // is spurious and dropped. - Event::Timeout(id) => { - if self.is_awaiting_boot(*id) { - Outcome::Transition(State::Recovering(*id)) - } else { - Outcome::Handled - } - } - Event::EffectFailed => Outcome::Transition(State::Locked), - _ => Outcome::Super, - }, - - // `awaiting` is the state's own payload, so changing it means - // re-entering the variant: `Outcome::Handled` leaves the payload - // untouched. That is correct only because `AwaitingReady` has no - // entry action — do not add one. - State::AwaitingReady(awaiting) => match event { - Event::ComponentReady(id) => { - // Clear this component's boot-progress watchdog whether or - // not it is the one this state's slot is tracking: a later - // `Active` released speculatively reports its readiness here - // too, and its watchdog must be cleared just the same. - self.clear_awaiting_boot(*id); - if awaiting != Some(*id) { - return Outcome::Handled; // not the tracked slot (INV9) - } - // If cursor is past the end, the eRoT side of the walk has - // already finished (chain done, or the remainder is held) — - // nothing left to verify, we're done. - if (self.cursor as usize) >= self.chain.len() { - Outcome::Transition(State::Ready) - } else { - // Readiness satisfied, chain not done: stay supervised, - // now awaiting nothing. - Outcome::Transition(State::AwaitingReady(None)) - } - } - Event::VerificationPassed(id) => { - // Only the component currently under verification - // (`chain[cursor]`) may be released; a verdict for any other - // id is stale or out-of-turn and is dropped (cf. INV9 for - // `ComponentReady`). - if self.chain.get(self.cursor as usize).map(|(c, _)| c) != Some(id) { - return Outcome::Handled; - } - // The component passed its check — it has recovered, so its - // consecutive-failure streak ends (INV7: consecutive only). - self.clear_retry(*id); - ctx.emit(Effect::ReleaseReset(*id)); - // Released: it is now live, and owes a boot-progress signal - // (both tiers). - self.mark_released(*id); - let next_idx = (self.cursor as usize).saturating_add(1); - if self.advance_to_next_ungated(ctx, next_idx) { - // `Handled` preserves the current payload: `awaiting` is - // cleared only by `ComponentReady` or `VerificationFailed`. - Outcome::Handled - } else { - Outcome::Transition(State::Ready) - } - } - Event::VerificationFailed(id) => { - // Recovery is attempted first for every failure, regardless - // of the component's recovery-failure policy. - Outcome::Transition(State::Recovering(*id)) - } - // `Timeout` is intentionally not handled here: it falls through - // to `handle_supervising`, which runs the device-agnostic - // boot-progress watchdog uniformly across every supervised state - // (an `AwaitingReady` timeout is no longer special-cased). - _ => Outcome::Super, - }, - - State::Ready => match event { - Event::UpdateRequest => Outcome::Transition(State::Updating), - // Proven-boot checkpoint: the image authenticated at - // `ActivateUpdate`, but the SVN floor only advances now, once - // the driver reports it healthy. Handled in place — confirming a - // running image is not a state change. Closing the window clears - // `pending_commit` so a later `CommitTimeout` cannot lock a - // device that has already committed. - Event::BootConfirmed(id) => { - ctx.emit(Effect::CommitSvnFloor(*id)); - self.pending_commit = false; - Outcome::Handled - } - // Commit watchdog. If the activated-but-not-committed window is - // still open, fail closed: never commit an unproven image, and - // never leave the downgrade window open indefinitely. Outside - // the window this is a stale watchdog fire and is dropped. - Event::CommitTimeout => { - if self.pending_commit { - Outcome::Transition(State::Locked) - } else { - Outcome::Handled - } - } - _ => Outcome::Super, - }, - - State::Updating => match event { - Event::UpdateVerified => { - ctx.emit(Effect::ActivateUpdate); - // Open the activated-but-not-committed window: the floor is - // NOT advanced here; it waits for `BootConfirmed`. The - // driver arms its commit watchdog on `ActivateUpdate`, and - // `CommitTimeout` bounds this window (commit-or-lock). - self.pending_commit = true; - Outcome::Transition(State::Ready) - } - Event::UpdateRejected => { - ctx.emit(Effect::DiscardStaged); - Outcome::Transition(State::Ready) - } - Event::CorruptionDetected(id) => { - let outcome = self.handle_corruption(*id, ctx); - // Only a *preemption* (transition out to recovery) orphans - // the staged image. An `Isolable`/`Cascading` corruption - // returns `Handled` and the update continues untouched, so - // its staged image must survive — do not discard then. - if matches!(outcome, Outcome::Transition(State::Recovering(_))) { - // Dispose of the orphaned image *and* answer the update - // requester: the update it was awaiting a verdict on has - // been superseded by recovery, not merely delayed. - ctx.emit(Effect::DiscardStaged); - ctx.emit(Effect::ReportUpdateAborted); - } - outcome - } - _ => Outcome::Super, - }, - - State::Recovering(failed) => match event { - Event::Restored(id) => { - // A `Restored` for a component other than the current - // recovery target (e.g. an episode displaced by a later - // corruption) must not be credited to this recovery. Drop - // it; the eventual re-walk re-verifies every component. - if *id != failed { - return Outcome::Handled; - } - // Count this attempt against the specific component in - // recovery, not a global budget (CSA: exhaustion is - // per-device). The recovery target is the state's payload, - // so it is always present — no defensive fallback needed. - let attempts = self.bump_retry(failed); - if attempts < self.max_retry { - Outcome::Transition(State::PreSupervision) - } else { - // Retries exhausted: gate via the same `gate_by_policy` - // the runtime-corruption path uses, so the two can never - // disagree. Gated → continue the walk; NotGated - // (Required/unknown) → lock down. - match self.gate_by_policy(ctx, failed) { - Gating::Gated => { - self.clear_retry(failed); - Outcome::Transition(State::PreSupervision) - } - // `Required`, or an unknown/missing id: report the - // component that forced the halt, then lock down. - // The report precedes the internal `Emit`, so it is - // actuated before the machine moves toward `Locked`. - Gating::NotGated => { - ctx.emit(Effect::ReportRecoveryFailed(failed)); - ctx.emit(Effect::Emit(Event::RecoveryFailed)); - Outcome::Handled - } - } - } - } - Event::RecoveryFailed => Outcome::Transition(State::Locked), - _ => Outcome::Super, - }, - - State::Locked => Outcome::Super, - } - } - - /// The supervising handler, reached only when [`handle`](Self::handle) - /// returns [`Outcome::Super`] from one of the four supervised states - /// ([`State::AwaitingReady`], [`State::Ready`], [`State::Updating`], - /// [`State::Recovering`] — see [`Orchestrator::is_supervised`]). It provides - /// two platform-wide guarantees that must hold across all four: - /// - /// - Attestation challenges are always answered. - /// - Corruption of a required component always triggers recovery. - /// - /// Note: [`State::PreSupervision`] is deliberately *not* supervised, so the - /// attestation guarantee does not hold while a component is still being - /// walked there — CSA defines no requirement to answer challenges before the - /// chain walk completes, so `AttestationChallenge` is left unhandled in - /// `PreSupervision` (falls through to [`Outcome::Super`] and, with no - /// supervisor, is discarded). - /// - /// The corruption guarantee, however, *does* hold in `PreSupervision`: that - /// state handles [`Event::CorruptionDetected`] directly (via - /// [`handle_corruption`](Self::handle_corruption)) rather than through this - /// handler, since routing it here would also pull in the attestation - /// behavior above. CSA defines no mechanism guaranteeing a corruption report - /// arrives for an already-released component's *live, executing* state (its - /// only at-rest mechanism — background NVM integrity polling — is explicitly - /// scoped to "at rest"/"between boots", not an in-progress boot's chain - /// walk), but that only means such a report isn't guaranteed to exist — it's - /// not a reason to discard one if it does arrive. See - /// `corruption_during_presupervision_selfloop_triggers_recovery` in - /// `tests.rs`. - fn handle_supervising(&mut self, event: &Event, ctx: &mut Sink) -> Outcome { - match event { - Event::AttestationChallenge => { - ctx.emit(Effect::SignAttestation); - Outcome::Handled - } - Event::CorruptionDetected(id) => self.handle_corruption(*id, ctx), - // Boot-progress signals arriving after the walk left `PreSupervision` - // / `AwaitingReady` (e.g. once the machine is already `Ready`): clear - // the component's watchdog. `ComponentReady` is the active tier, - // `Booted` the passive tier; both just retire the outstanding wait. - Event::ComponentReady(id) | Event::Booted(id) => { - self.clear_awaiting_boot(*id); - Outcome::Handled - } - // Device-agnostic boot-progress watchdog across every supervised - // state: a released component that never reported in before its - // window closed is recovered like any other boot failure. A timeout - // for a component not awaiting boot (already reported, gated, or - // never released) is stale/spurious and dropped. - Event::Timeout(id) => { - if self.is_awaiting_boot(*id) { - Outcome::Transition(State::Recovering(*id)) - } else { - Outcome::Handled - } - } - // A new update cannot start from any supervised state except - // `Ready` (the machine is mid-walk, mid-update, or mid-recovery). - // `Ready` accepts `UpdateRequest` upstream in `handle` (→ `Updating`) - // and so never reaches here; this arm therefore fires only for - // `AwaitingReady`, `Updating`, and `Recovering`. Report the refusal - // rather than dropping it silently, and leave the in-flight - // walk/update/recovery untouched (`Handled`, no transition). - Event::UpdateRequest => { - ctx.emit(Effect::ReportUpdateDeferred); - Outcome::Handled - } - Event::EffectFailed => Outcome::Transition(State::Locked), - _ => Outcome::Super, - } - } - - /// Run `state`'s entry action. Called by the engine only when a handler - /// returned [`Outcome::Transition`] — never on [`Outcome::Handled`]. That - /// distinction is load-bearing: `PreSupervision`'s cursor walk returns - /// `Handled` precisely so this does not re-run and reset the cursor. - fn entry_action(&mut self, state: State, ctx: &mut Sink) { - match state { - State::PreSupervision => { - // Recovery is a full platform re-boot: quiesce every live - // component before the walk, so verification always covers code - // at rest, never a component whose earlier pass says nothing - // about what it is currently running. Empty at the initial - // power-on walk (nothing live yet), so cold boot is unchanged. - self.quiesce_all(ctx); - let _ = self.advance_to_next_ungated(ctx, 0); - } - State::Updating => { - // A new update supersedes any activated-but-not-committed image; - // the prior commit window is void. - self.pending_commit = false; - ctx.emit(Effect::AuthenticateUpdate); - ctx.emit(Effect::StageUpdate); - } - State::Recovering(failed) => { - // Recovery voids any activated-but-not-committed image: the - // running image is now under suspicion, so its commit window - // ends here. - self.pending_commit = false; - // The component under recovery is being restored, not booting; - // drop any pending boot-progress watchdog so a late `Timeout` - // can't re-enter recovery for it. It is also held (not live) - // while the platform restores it, so it is not quiesced again on - // the re-walk. - self.clear_awaiting_boot(failed); - // `retry` here is the consecutive-recovery count for `failed` - // (0 on the first attempt); hand it to the driver so it need not - // track its own. It is bumped later, on `Restored`. - let attempt = match self.status_index(failed) { - Some(i) => { - self.statuses[i].released = false; - self.statuses[i].retry - } - None => 0, - }; - ctx.emit(Effect::RecoverComponent { - id: failed, - attempt, - }); - } - State::Locked => { - ctx.emit(Effect::LatchLockdown); - } - State::Ready => { - // NB: `gated` is intentionally NOT cleared here. It is a durable - // trust-boundary gate (each id has a live `AssertReset`); - // clearing it would let a later chain walk re-release a - // component that policy deliberately isolated. Only a fresh - // `Rot` on `PowerOnReset` clears it. - // - // Retry counts, by contrast, ARE cleared: a clean boot means no - // recovery episode is in flight, so every per-component streak - // resets to zero. (The `Isolated` lifecycle is preserved.) - for s in self.statuses.iter_mut() { - s.retry = 0; - } - } - _ => {} - } - } -} - -/// Signals that the platform driver could not carry out an [`Effect`]. The machine does -/// not need the driver's error detail — **every** actuation failure is treated -/// the same, fail-closed: the orchestrator injects [`Event::EffectFailed`] and the -/// machine latches to [`State::Locked`]. This blanket policy is deliberate and -/// is what lets the failure signal stay a payload-less marker; a future design -/// that needs per-effect recovery must add a *new*, descriptive event rather -/// than widen this type. The driver logs the specifics on its side. -#[derive(Clone, Copy, PartialEq, Eq, Debug)] -pub struct EffectError; - -/// Outward connection to the platform. Carry out one effect, reporting -/// [`EffectError`] if it could not be performed. Never called with -/// [`Effect::Emit`] — the orchestrator consumes those internally. -/// -/// `Ok(Some(event))` feeds back what the effect produced synchronously (e.g. -/// a verification verdict); the orchestrator queues it and settles it in the -/// same dispatch run. At most one event per effect. Synchronous results belong -/// here, not in a driver-side queue — one feedback path keeps ordering honest. -/// `execute` may block until the effect completes; results that only arrive -/// later (boot progress, timer expiry) are delivered as their own outside -/// events via `dispatch`. -/// -/// Failure stays on the error channel, never in a returned event: `Err` is -/// checked between effects, so a failed actuation aborts the rest of the -/// batch — a feedback event cannot do that. -/// -/// Contract the state machine relies on: -/// - **Honest, complete feedback.** The core's correctness rests entirely on -/// the event stream the driver feeds back; dropping, reordering, or -/// synthesizing events silently breaks the state machine's invariants. -/// - **Returned events quiesce.** Every returned event reports a result the -/// reducer consumes (its retry budgets bound re-verification cycles). An -/// executor that manufactures an event for every effect keeps one dispatch -/// run alive indefinitely. -/// - **`AssertReset` holds, it does not pulse.** A reset must keep the component -/// quiesced and non-executing until its matching `ReleaseReset`. The core's -/// at-rest verification guarantee depends on this: it re-asserts reset on -/// every live component before a recovery re-walk (`quiesce_all`) so that -/// `VerifyFirmware` covers code that cannot run or rewrite its own flash -/// between the check and the release. A reset that merely pulses would let a -/// component resume before verification and void that guarantee. -/// - **A failed [`Effect::LatchLockdown`] is a hard fault.** Lockdown is the top -/// of the escalation ladder — the core has nothing stronger to emit and -/// will *believe* it is `Locked`. The driver must treat that failure as -/// terminal (halt/reset), not a recoverable error. -pub trait Platform { - fn execute(&mut self, effect: Effect) -> Result, EffectError>; -} - -/// A handle for a caller's own event loop. Owns the machine's storage -/// ([`Rot`]) and its current [`State`], and drives them through [`step`]. -/// -/// [`step`]: Self::step -pub struct Orchestrator { - rot: Rot, - state: State, -} - -impl Orchestrator { - pub fn new(chain: Chain, max_retry: u8) -> Self { - Self { - rot: Rot::new(chain, max_retry), - // The initial state. `PowerOnReset` has no entry action, so there is - // nothing to run here before the first event. - state: State::PowerOnReset, - } - } - - pub fn state(&self) -> State { - self.state - } - - /// Whether `state` is nested under the supervising handler - /// ([`Rot::handle_supervising`]) — i.e. whether an [`Outcome::Super`] from - /// its leaf handler has anywhere to go. The four supervised states are the - /// ones the eRoT can be in after it has exited [`State::PreSupervision`], - /// and before it locks down. - const fn is_supervised(state: State) -> bool { - matches!( - state, - State::AwaitingReady(_) | State::Ready | State::Updating | State::Recovering(_) - ) - } - - /// Reduce one event: dispatch, fall through to the supervisor if needed, and - /// apply the resulting outcome. - /// - /// The machine defines no exit actions and no supervisor entry/exit actions, - /// so a transition's only side effect is the target state's entry action — - /// and it lands in the *same* `ctx` as the handler that caused it, which the - /// `E >= 2 * N + 2` bound relies on (a full gate cascade, with its paired - /// isolation reports, plus the destination `PreSupervision` entry's two - /// effects share one `Sink`). - fn step(&mut self, event: &Event, ctx: &mut Sink) { - // 0. Single point of id-membership enforcement. The core supervises - // only the components in the configured chain, so an event that names - // an id the chain does not contain is dropped here, before any - // handler runs — no handler needs its own membership check, and none - // can act on a component the core never modeled. Events that name no - // component (`component_id() == None`) always pass through. - if let Some(id) = event.component_id() - && !self.rot.in_chain(id) - { - return; - } - - // 1. Dispatch to the current (leaf) state. - let mut outcome = self.rot.handle(self.state, event, ctx); - - // 2. On `Super`, defer to the supervising handler if this state has one; - // otherwise the event is discarded. Discarding is what keeps `Locked` - // terminal: it is unsupervised, so its blanket `Super` drops every - // event — including the `EffectFailed` from a failed `LatchLockdown`, - // which would otherwise loop. - if let Outcome::Super = outcome - && Self::is_supervised(self.state) - { - outcome = self.rot.handle_supervising(event, ctx); - } - - // 3. Apply a transition. `Handled` and an unhandled `Super` both leave - // the state alone and run no entry action. - if let Outcome::Transition(target) = outcome { - self.state = target; - self.rot.entry_action(target, ctx); - } - } - - /// Handle one event all the way through — every [`Effect::Emit`] - /// follow-up and every event the executors return — calling `on_effect` - /// for each external effect in order. One call runs to quiescence. - /// - /// If `on_effect` reports an [`EffectError`], the orchestrator injects an - /// [`Event::EffectFailed`] at the *front* of the queue, so a failed - /// actuation is handled fail-closed: the latch settles next, and feedback - /// still queued behind it drains into [`State::Locked`] (discarded) - /// instead of actuating hardware after a failure. A pending-queue - /// overflow is handled the same way: losing a returned event would break - /// the honest-feedback contract, so the run latches instead. - pub fn dispatch_with( - &mut self, - event: Event, - mut on_effect: impl FnMut(Effect) -> Result, EffectError>, - ) { - // Fail-closed latch: `EffectFailed` goes to the *front*, so it settles - // next and everything still queued drains into `Locked` (discarded) - // instead of actuating hardware after a failure. Prefer evicting the - // newest queued event over losing the latch itself. - fn latch(pending: &mut heapless::Deque) { - if pending.is_full() { - pending.pop_back(); - } - // Dead Err arm: the eviction above guarantees room. - let _ = pending.push_front(Event::EffectFailed); - } - - let mut pending: heapless::Deque = heapless::Deque::new(); - // Dead Err arm: `pending` is empty and `PENDING_CAP >= 3` (asserted at - // build time), so the first push always fits. - let _ = pending.push_back(event); - // `EffectFailed` is injected at most once: it is idempotent and - // terminal (drives to `Locked`, which discards everything after). The - // only external effect executed after it settles is `Locked`'s own - // entry, whose failure must not inject again. - let mut failed = false; - - while let Some(ev) = pending.pop_front() { - let mut buf = Sink::::new(); - self.step(&ev, &mut buf); - - for &effect in buf.effects() { - let follow_up = match effect { - // Internal: handle next, never forwarded to the platform. - Effect::Emit(internal) => Some(internal), - external => match on_effect(external) { - Ok(follow_up) => follow_up, - Err(_) => { - // Fail-closed AND fail-fast: abandon the rest of - // this batch. `step` has already advanced the - // state as if the whole batch applied, and the - // latch overrides that transition, so nothing - // ordered after the failure may hit hardware. - if !failed { - failed = true; - latch(&mut pending); - } - break; - } - }, - }; - if let Some(next) = follow_up - && pending.push_back(next).is_err() - && !failed - { - // Queue full: `next` would be lost, breaking the - // honest-feedback contract. Fail closed instead. - failed = true; - latch(&mut pending); - break; - } - } - } - } - - /// Same as [`dispatch_with`] but routes effects to a [`Platform`]. - pub fn dispatch(&mut self, platform: &mut impl Platform, event: Event) { - self.dispatch_with(event, |effect| platform.execute(effect)); - } -} +#[doc(inline)] +pub use model::*; +#[doc(inline)] +pub use orchestrator::Orchestrator; +#[doc(inline)] +pub use platform::{EffectError, Platform}; +#[doc(inline)] +pub use rot::Rot; +#[doc(inline)] +pub use sink::Sink; #[cfg(test)] mod tests; diff --git a/services/orchestrator/sm/src/model.rs b/services/orchestrator/sm/src/model.rs index 64ac92b65..a01e8572a 100644 --- a/services/orchestrator/sm/src/model.rs +++ b/services/orchestrator/sm/src/model.rs @@ -29,8 +29,8 @@ impl From for ComponentId { /// How a component in the trust chain is classified. The board supplies one /// [`ComponentKind`] per [`ComponentId`] when building the chain. /// -/// Corresponds directly to the two-tier model in the CSA architecture document: -/// `Active` = eRoT gate + iRoT gate; `Passive` = eRoT gate only. +/// Two tiers, by how many gates an image passes: `Active` passes the eRoT +/// gate and the iRoT gate, `Passive` the eRoT gate alone. #[derive(Clone, Copy, PartialEq, Eq, Debug)] pub enum ComponentKind { /// Has an integrated iRoT (e.g. Caliptra). Both eRoT-side (signature + SVN) @@ -43,17 +43,33 @@ pub enum ComponentKind { /// still watched for boot-progress liveness ([`Event::Booted`]) under the /// same per-component watchdog as an `Active` component's /// [`Event::ComponentReady`]: a passive device that never reports in before - /// its [`Event::Timeout`] is recovered like any other boot failure. CSA - /// boot-progress checkpointing is device-agnostic — every released device - /// owes a boot-progress signal, iRoT or not. + /// its [`Event::Timeout`] is recovered like any other boot failure. + /// Every released device owes a boot-progress signal, iRoT or not. Passive, + /// The eRoT itself. It sits at chain position 0 and is already running + /// when the walk starts, so the walk steps past it the same way it + /// steps past a gated component. + /// + /// The orchestrator never releases, supervises or recovers the eRoT. + /// Nothing can reset it, since the eRoT is what drives the reset lines, + /// and if it had failed to boot this code would not be running. + /// + /// It is still part of the chain, because it is an update target like any + /// other component: `components[0].updatable` stages the eRoT's own image. + /// Its SVN floor is the one exception, held in the `ErotUpdate` the board + /// holds, next to the update session rather than in + /// `components[0].svn_floor`, because the floor and the session are + /// advanced together and neither is reached through a chain walk. What a + /// self-update needs on top is that durable session, because the reboot + /// that decides it wipes RAM. + Erot, } /// Recovery-failure classification: what the machine does once a required /// component's restore attempts are **exhausted** (its per-component retry /// count reaches `max_retry`). Every verification or corruption failure enters /// [`State::Recovering`] and is retried first, regardless of this -/// classification — CSA's "recover first" principle. This value is consulted +/// classification: recovery comes before the policy. This value is consulted /// only after retries are exhausted. /// /// (The narrative design docs sometimes call the `Required` outcome "platform @@ -110,6 +126,17 @@ pub struct ComponentAttrs { } impl ComponentAttrs { + /// Attributes for the eRoT itself, which is never released, walked or + /// recovered. The failure policy is `Required`, because a platform that + /// lost its own RoT has nothing left to supervise anything with. + pub const fn erot() -> Self { + Self { + kind: ComponentKind::Erot, + failure_policy: FailurePolicy::Required, + recovery_region: RegionId::new(0), + depends_on: None, + } + } pub const fn active_required() -> Self { Self { kind: ComponentKind::Active, @@ -185,6 +212,20 @@ pub enum PowerOnResult { SelfVerificationFailed, } +/// Why a boot walk failed at a checkpoint, as reported by the platform +/// driver. Mirrors `orchestrator_capabilities::FailureCause` without +/// coupling the state machine crate to the capabilities crate. +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub enum BootFailureKind { + /// The checkpoint's window expired; the device reported nothing. + TimedOut, + /// The device reported a failure worth another attempt. + DeviceRetriable, + /// The device reported a terminal failure; re-running the same image + /// cannot change the verdict. + DeviceFatal, +} + /// Everything the outside world can tell the state machine. #[derive(Clone, Copy, PartialEq, Eq, Debug)] pub enum Event { @@ -204,45 +245,132 @@ pub enum Event { Booted(ComponentId), /// A challenger has requested a signed attestation. AttestationChallenge, - /// A firmware update has been requested. - UpdateRequest, - /// The staged update authenticated successfully. + /// A firmware update has been requested for this component. + UpdateRequest(ComponentId), + /// The staged update authenticated and the device is holding it. No + /// component: [`State::Updating`] already names the one being updated. UpdateVerified, /// The staged update failed authentication. UpdateRejected, - /// The activated image proved itself healthy at runtime (supervised - /// health / attestation pass — not mere boot). Gates the anti-rollback - /// commit: only now is it safe to advance the SVN floor past this image, - /// because it has demonstrated it runs, not merely that it authenticated. + /// The requester withdrew the update it had requested. + /// + /// Distinct from [`UpdateRejected`](Event::UpdateRejected), which says the + /// candidate was judged and found wanting. A withdrawal judges nothing: the + /// image may have been perfectly good and the requester simply stopped + /// wanting it. Both end the update and dispose of what was staged, but only + /// a rejection is a verdict on the image, and only a rejection is worth + /// reporting to the requester, who in this case is the component that sent + /// the request. + /// + /// Carries no component, for the same reason the other two do not: + /// [`State::Updating`] already names the one being updated. + UpdateCancelled, + /// The activated image came up healthy at runtime (supervised health / + /// attestation pass, not mere boot). Gates the anti-rollback commit: only + /// after the confirm is it safe to advance the SVN floor past this image, + /// because the image has run, not merely authenticated. + /// + /// Closes the commit-or-lock window and keeps the SVN floor advance + /// outstanding until [`Event::SvnCommitRequest`] arrives. BootConfirmed(ComponentId), + /// The Update Agent requested that the SVN floor for `id` move, with + /// UpdateSecurityRevision (PLDM 0x22). Injected by the event loop when that + /// request arrives. The SVN floor it names is one the eRoT holds (the + /// driver's `SvnFloorBinding::Erot`); a component that tracks its own SVN + /// gets a no-op from the effect, so there is no device-side commit to wait + /// for. + /// + /// Honoured only while the SVN floor advance for `id` is outstanding, which + /// [`Event::BootConfirmed`] opens: an image no boot has confirmed has no + /// SVN floor advance coming. A request arriving for any other component, or + /// for the same component twice, is dropped, so the SVN floor takes the SVN + /// once. + /// + /// The event carries no SVN. The driver holds the one the manifest was + /// verified against, which is the only authenticated reading of it. + /// + /// Carries its component unlike [`Event::UpdateRequest`], whose + /// `component_id` is `None` so a recorded job gets an answer even for an + /// unknown id. Nothing is recorded before this one is dispatched, so an + /// unknown id is dropped and nothing is lost. + SvnCommitRequest(ComponentId), /// This component was found corrupt at runtime. CorruptionDetected(ComponentId), /// This component has been restored from its configured recovery source. Restored(ComponentId), + /// The platform has no remaining recovery source for `id` (its configured + /// images/slots are exhausted); reported in place of `Restored(id)` and + /// short-circuits the retry cap. See the verdict-vs-error contract on + /// [`Platform::execute`](crate::Platform::execute). + RecoveryUnavailable(ComponentId), /// A required component's recovery was exhausted. RecoveryFailed, + /// A boot walk failed at a specific checkpoint with a classified cause. + /// Produced by the platform driver when `CheckpointWalk::poll` returns + /// `WalkVerdict::Failed`. `TimedOut` and `DeviceRetriable` enter recovery + /// (the retry cap limits attempts). `DeviceFatal` gates + /// `Isolable`/`Cascading` components immediately (no recovery attempt) + /// and enters recovery for `Required` (halt-on-exhaustion still applies). + /// + /// The split is about what gating costs, not about whether a retry could + /// work. Recovery does not re-run the bad image: `attempt` rides on + /// [`Effect::RecoverComponent`] so the driver can try a different source + /// each time, and an untried golden image may fix any component. Gating an + /// `Isolable`/`Cascading` component holds it in reset and leaves the + /// platform running, so skipping straight there costs little. Gating a + /// `Required` one locks the platform down, so every recovery source is + /// tried first. + BootFailed { + id: ComponentId, + checkpoint: &'static str, + kind: BootFailureKind, + }, /// The platform driver's boot-progress watchdog fired: `id` did not report its /// boot-progress signal ([`Event::ComponentReady`] for an `Active` /// component, [`Event::Booted`] for a `Passive` one) within its configured - /// boot timeout. Treated as a verification failure — a component still + /// boot timeout. Treated as a verification failure, a component still /// awaiting boot-progress enters recovery. A timeout for a component that is /// not awaiting boot (never released, already reported in, or already gated) /// is stale/spurious and dropped. The watchdog is per component and - /// device-agnostic, matching CSA boot-progress checkpointing. + /// device-agnostic: every released device owes a boot-progress signal. Timeout(ComponentId), /// The driver's *commit* watchdog fired: an update was activated /// ([`Effect::ActivateUpdate`]) but did not report [`Event::BootConfirmed`] /// within the policy window. Distinct from [`Event::Timeout`], which is the /// per-component boot-progress watchdog; this one bounds the single - /// activated-but-not-committed window in [`State::Ready`]. Handled only while - /// that window is open: it latches [`State::Locked`] (commit-or-lock — the - /// anti-rollback floor is never advanced for an unproven image, and the - /// downgrade window may not stay open indefinitely). Outside the window - /// (nothing pending) it is stale and dropped. The driver arms this watchdog - /// when it executes [`Effect::ActivateUpdate`] and cancels it on - /// [`Effect::CommitSvnFloor`]. + /// activated-but-not-committed window in [`State::Ready`]. Handled only + /// while that window is open: it latches [`State::Locked`] (commit-or-lock: + /// the SVN floor keeps the SVN it has while no boot has confirmed the + /// image, and the downgrade window may not stay open indefinitely). Outside + /// the window (nothing pending) the event is stale and dropped. + /// + /// A platform that bounds the activated-but-not-committed window arms the + /// watchdog when it executes [`Effect::ActivateUpdate`] and cancels it when + /// it reports [`Event::BootConfirmed`], which is what closes the window. + /// The cancel point is [`Event::BootConfirmed`], not + /// [`Effect::CommitSvnFloor`]: the SVN floor moves only when the Update + /// Agent requests it, and an Update Agent that never requests would + /// otherwise lock a platform whose image booted. CommitTimeout, - /// The platform driver could not carry out an emitted [`Effect`]; fail-closed, it + /// This boot is the trial run of the eRoT's own update: the durable + /// session says an image was activated and the eRoT came up on it. + /// Injected at bring-up by `settle_self_update_at_boot` in the driver, + /// before [`Event::PowerGood`] and so handled in + /// [`State::PowerOnReset`] alone. Later in the boot it is stale: the + /// trial is judged once per boot. + /// + /// The verdict is reaching [`State::Ready`], which says the trial image + /// booted and brought the chain up. Entry there emits + /// [`Effect::ConfirmSelfTrial`]. A boot that never reaches `Ready` + /// confirms nothing, and the next boot settles the session as a trial + /// that fell back. + /// + /// Carries nothing. There is one self-update session, the eRoT's own, + /// and [`Event::BootConfirmed`] could not stand in for it: that one is + /// handled in `Ready` against `pending_commit`, which the reset deciding + /// the trial has already wiped. + SelfTrialBooted, + /// The platform driver could not carry out an emitted [`Effect`]; fail-secure, it /// latches to [`State::Locked`] from any state. Injected by the driver when /// a [`Platform::execute`](crate::Platform::execute) call fails; never /// produced by a handler. @@ -251,13 +379,19 @@ pub enum Event { impl Event { /// The component this event is about, or `None` for events that name no - /// component (`PowerGood`, `UpdateRequest`, `CommitTimeout`, …). + /// component (`PowerGood`, `CommitTimeout`, …). /// /// This is the single enumeration of the id-carrying events, consulted once /// at the dispatch boundary ([`Orchestrator::step`](crate::Orchestrator::step)) /// to drop any event that names a component outside the configured chain /// before a handler ever sees it. A new id-carrying variant must be listed /// here, or it will bypass that membership check. + /// + /// [`Event::UpdateRequest`] is the exception: it carries a component but + /// returns `None`. The caller records the job before dispatching it, so + /// dropping the event here would leave that job with nothing to answer it + /// and wedge every later request. An unknown target instead fails secure in + /// the executor, which has the board's component list to check against. pub(crate) fn component_id(&self) -> Option { match self { Event::VerificationPassed(id) @@ -265,22 +399,27 @@ impl Event { | Event::ComponentReady(id) | Event::Booted(id) | Event::BootConfirmed(id) + | Event::SvnCommitRequest(id) | Event::CorruptionDetected(id) | Event::Restored(id) + | Event::RecoveryUnavailable(id) + | Event::BootFailed { id, .. } | Event::Timeout(id) => Some(*id), Event::PowerGood(_) | Event::AttestationChallenge - | Event::UpdateRequest + | Event::UpdateRequest(_) | Event::UpdateVerified | Event::UpdateRejected + | Event::UpdateCancelled | Event::RecoveryFailed | Event::CommitTimeout + | Event::SelfTrialBooted | Event::EffectFailed => None, } } } -/// Everything the state machine can ask the outside world to do. +/// Everything the state machine can command the outside world to do. /// /// [`Effect::Emit`] is the sole internal effect: the orchestrator catches it and /// queues the carried event for immediate handling, making follow-up events @@ -296,17 +435,51 @@ pub enum Effect { /// component is gated without triggering (or continuing) a recovery cycle. AssertReset(ComponentId), SignAttestation, - AuthenticateUpdate, - StageUpdate, + /// Stage the candidate, then verify it. The driver knows the protocol + /// order; the SM does not split these into sub-phases. + AuthenticateStageUpdate, ActivateUpdate, DiscardStaged, - /// Advance the anti-rollback (SVN) floor past `id`'s now-confirmed image. - /// Deliberately decoupled from [`ActivateUpdate`]: activation happens on - /// authentication (`UpdateVerified`), but the floor may only move once the - /// image has proven healthy ([`Event::BootConfirmed`]). Committing the - /// floor earlier would burn anti-rollback on an image that authenticated - /// but has not yet demonstrated it can boot and run. + /// Advance the SVN floor (the anti-rollback floor) past the image `id` has + /// now confirmed. Decoupled from [`ActivateUpdate`] and from the confirmed + /// boot alike: activation happens on authentication (`UpdateVerified`), the + /// image runs unconfirmed until [`Event::BootConfirmed`] confirms it, and + /// the SVN floor moves later still, when [`Event::SvnCommitRequest`] says + /// the Update Agent requested it with UpdateSecurityRevision. Committing + /// earlier would burn anti-rollback on an image that authenticated but has + /// not run, or move the eRoT's mirror of a device's SVN floor ahead of the + /// device's own. CommitSvnFloor(ComponentId), + /// Confirm the eRoT's own update session: the trial image booted and + /// brought the chain up. Emitted on entry to [`State::Ready`] when this + /// boot started with [`Event::SelfTrialBooted`]. + /// + /// Confirming moves the session to `Committed`; the SVN floor does not move + /// here. `Committed` is the state the answer to UpdateSecurityRevision + /// checks: the Update Agent requests whenever it likes, and the eRoT + /// refuses the request while the session is not `Committed`. + /// [`Effect::CommitSvnFloor`] is the downstream counterpart and names a + /// component, which this one cannot: the eRoT's SVN floor is held in the + /// `ErotUpdate` the board holds, not in the per-component array. + ConfirmSelfTrial, + /// Keep the test image a managed device booted: close the trial and + /// make the activated slot the confirmed one. + /// + /// Emitted on [`Event::BootConfirmed`]: the device came up on the image it + /// was given and reported ready at its checkpoints. The effect moves slot + /// metadata; the SVN floor follows later on + /// [`CommitSvnFloor`](Self::CommitSvnFloor), so a revert always has an + /// image to go back to. + ConfirmDeviceTrial(ComponentId), + /// Throw away the test image a managed device was given: close the + /// trial without keeping the image, leaving the confirmed slot as it + /// was. + /// + /// Emitted on entry to `Updating`, where a newer update supersedes the + /// image, and on entry to `Recovering`, where the re-walk re-verifies + /// the chain. The revert clears the pending marker, so the next reset + /// boots the confirmed image. + RevertDeviceTrial(ComponentId), /// Recover `id` from its configured recovery source. The mechanism — /// golden image, A/B slot, streamed image, or vendor-specific scheme — is /// deferred to the [`Platform`](crate::Platform) driver, which resolves it @@ -320,6 +493,10 @@ pub enum Effect { /// attempt 0, slot B on 1, golden on 2) without counting attempts itself — /// a count of its own could drift from the core's, since the driver never /// sees when a recovery succeeds. + /// + /// The driver reports the verdict as an event, not an `execute` error — + /// see the verdict-vs-error contract on + /// [`Platform::execute`](crate::Platform::execute). RecoverComponent { id: ComponentId, attempt: u8, @@ -327,13 +504,21 @@ pub enum Effect { /// Report that a component has been isolated (held in reset and removed /// from the trust chain) so management software is aware the platform is /// running degraded. Emitted once per component, at the moment it is - /// gated — CSA's degraded-mode clause requires the failure to be reported - /// through the platform management interface, not just contained. + /// gated. Containing the failure is not enough: management software + /// has to hear that the platform runs degraded. ReportIsolated(ComponentId), /// Report that a `Required` component exhausted its recovery attempts, /// immediately before the machine latches to [`Locked`](crate::State::Locked). /// Names the component that forced the halt. ReportRecoveryFailed(ComponentId), + /// Report that a boot walk failed at a named checkpoint. Emitted before + /// the transition (recovery or gate) so management software learns where + /// in the boot sequence the failure occurred. + ReportBootFailed { + id: ComponentId, + checkpoint: &'static str, + kind: BootFailureKind, + }, /// Report that an [`Event::UpdateRequest`] was declined because the machine /// is busy in a supervised state other than [`Ready`](crate::State::Ready) /// — a chain walk is finishing ([`AwaitingReady`](crate::State::AwaitingReady)), @@ -344,6 +529,11 @@ pub enum Effect { /// "retry later" completion code). Advisory only: it changes no state and /// does not perturb the in-flight update or recovery. `Ready` never produces /// this — it accepts the request and transitions to `Updating`. + /// + /// The effect trace holds the refusals the state machine makes, not every + /// refusal the platform makes: the driver refuses some requests at submit, + /// before `UpdateRequest` is dispatched, and the frontend answers the + /// requester from the returned `DriverError`. ReportUpdateDeferred, /// Report that an update *already in flight* ([`Updating`](crate::State::Updating)) /// was aborted because a `Required` component was found corrupt and recovery @@ -383,7 +573,10 @@ pub enum State { /// is spurious. AwaitingReady(Option), Ready, - Updating, + /// An update is running on this component. The payload is the target the + /// request named, and it is what opens the commit window on + /// [`Event::UpdateVerified`]. + Updating(ComponentId), /// A component failed verification (or was found corrupt under a /// non-gating policy) and is being restored from its configured recovery /// source. The payload is @@ -393,13 +586,26 @@ pub enum State { Locked, } +impl State { + /// Whether an event this state does not handle itself falls through to + /// the shared handler. The unsupervised states drop it instead, so a + /// caller that owes someone an answer (the update frontend) has to check + /// this before handing the machine a request. + pub const fn is_supervised(self) -> bool { + matches!( + self, + State::AwaitingReady(_) | State::Ready | State::Updating(_) | State::Recovering(_) + ) + } +} + /// A validated **chain of trust**: the ordered list of components the eRoT /// walks, verifies, and supervises, in walk order. /// /// Build one with [`TryFrom`]/[`TryInto`] from a `heapless::Vec` of /// `(ComponentId, ComponentAttrs)` pairs. The conversion is the single place /// the state machine's structural invariants are enforced, so a malformed chain -/// fails closed at the boundary instead of misbehaving later: +/// fails secure at the boundary instead of misbehaving later: /// /// - the chain is non-empty, /// - every [`ComponentId`] is unique, @@ -408,10 +614,13 @@ pub enum State { /// dependency is always walked before its dependents), /// - the length fits `u8`, the `cursor` index type. /// +/// Boards build it from their device table rather than entry by entry, so the +/// table stays the only place a component is declared: +/// /// ```ignore -/// let mut v = heapless::Vec::<_, 4>::new(); -/// v.push((ComponentId::new(0), ComponentAttrs::passive_required())).unwrap(); -/// let chain: Chain<4> = v.try_into()?; +/// let validated = orchestrator_config::chain_of(&DEVICES); +/// let entries = heapless::Vec::from_slice(validated.entries())?; +/// let chain: Chain<2> = entries.try_into()?; /// ``` #[derive(Clone, Debug)] pub struct Chain { diff --git a/services/orchestrator/sm/src/orchestrator.rs b/services/orchestrator/sm/src/orchestrator.rs new file mode 100644 index 000000000..ff3897c75 --- /dev/null +++ b/services/orchestrator/sm/src/orchestrator.rs @@ -0,0 +1,156 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +use crate::model::{Chain, Effect, Event, State}; +use crate::platform::{EffectError, Platform}; +use crate::rot::Rot; +use crate::sink::{Outcome, Sink, PENDING_CAP}; + +/// A handle for a caller's own event loop. Owns the machine's storage +/// ([`Rot`]) and its current [`State`], and drives them through [`step`]. +/// +/// [`step`]: Self::step +pub struct Orchestrator { + rot: Rot, + state: State, +} + +impl Orchestrator { + pub fn new(chain: Chain, max_retry: u8) -> Self { + Self { + rot: Rot::new(chain, max_retry), + // The initial state. `PowerOnReset` has no entry action, so there is + // nothing to run here before the first event. + state: State::PowerOnReset, + } + } + + pub fn state(&self) -> State { + self.state + } + + /// Reduce one event: dispatch, fall through to the supervisor if needed, and + /// apply the resulting outcome. + /// + /// The machine defines no exit actions and no supervisor entry/exit actions, + /// so a transition's only side effect is the target state's entry action — + /// and it lands in the *same* `ctx` as the handler that caused it, which the + /// `E >= 2 * N + 2` bound relies on (a full gate cascade, with its paired + /// isolation reports, plus the destination `PreSupervision` entry's two + /// effects share one `Sink`). + fn step(&mut self, event: &Event, ctx: &mut Sink) { + // 0. Single point of id-membership enforcement. The core supervises + // only the components in the configured chain, so an event that names + // an id the chain does not contain is dropped here, before any + // handler runs — no handler needs its own membership check, and none + // can act on a component the core never modeled. Events that name no + // component (`component_id() == None`) always pass through. + if let Some(id) = event.component_id() + && !self.rot.in_chain(id) + { + return; + } + + // 1. Dispatch to the current (leaf) state. + let mut outcome = self.rot.handle(self.state, event, ctx); + + // 2. On `Super`, defer to the supervising handler if this state has one; + // otherwise the event is discarded. Discarding is what keeps `Locked` + // terminal: it is unsupervised, so its blanket `Super` drops every + // event — including the `EffectFailed` from a failed `LatchLockdown`, + // which would otherwise loop. + if let Outcome::Super = outcome + && self.state.is_supervised() + { + outcome = self.rot.handle_supervising(event, ctx); + } + + // 3. Apply a transition. `Handled` and an unhandled `Super` both leave + // the state alone and run no entry action. + if let Outcome::Transition(target) = outcome { + self.state = target; + self.rot.entry_action(target, ctx); + } + } + + /// Handle one event all the way through — every [`Effect::Emit`] + /// follow-up and every event the executors return — calling `on_effect` + /// for each external effect in order. One call runs to quiescence. + /// + /// If `on_effect` reports an [`EffectError`], the orchestrator injects an + /// [`Event::EffectFailed`] at the *front* of the queue, so a failed + /// actuation is handled fail-secure: the latch settles next, and feedback + /// still queued behind it drains into [`State::Locked`] (discarded) + /// instead of actuating hardware after a failure. A pending-queue + /// overflow is handled the same way: losing a returned event would break + /// the honest-feedback contract, so the run latches instead. + pub fn dispatch_with( + &mut self, + event: Event, + mut on_effect: impl FnMut(Effect) -> Result, EffectError>, + ) { + // Fail-secure latch: `EffectFailed` goes to the *front*, so it settles + // next and everything still queued drains into `Locked` (discarded) + // instead of actuating hardware after a failure. Prefer evicting the + // newest queued event over losing the latch itself. + fn latch(pending: &mut heapless::Deque) { + if pending.is_full() { + pending.pop_back(); + } + // Dead Err arm: the eviction above guarantees room. + let _ = pending.push_front(Event::EffectFailed); + } + + let mut pending: heapless::Deque = heapless::Deque::new(); + // Dead Err arm: `pending` is empty and `PENDING_CAP >= 3` (asserted at + // build time), so the first push always fits. + let _ = pending.push_back(event); + // `EffectFailed` is injected at most once: it is idempotent and + // terminal (drives to `Locked`, which discards everything after). The + // only external effect executed after it settles is `Locked`'s own + // entry, whose failure must not inject again. + let mut failed = false; + + while let Some(ev) = pending.pop_front() { + let mut buf = Sink::::new(); + self.step(&ev, &mut buf); + + for &effect in buf.effects() { + let follow_up = match effect { + // Internal: handle next, never forwarded to the platform. + Effect::Emit(internal) => Some(internal), + external => match on_effect(external) { + Ok(follow_up) => follow_up, + Err(_) => { + // Fail-secure AND fail-fast: abandon the rest of + // this batch. `step` has already advanced the + // state as if the whole batch applied, and the + // latch overrides that transition, so nothing + // ordered after the failure may hit hardware. + if !failed { + failed = true; + latch(&mut pending); + } + break; + } + }, + }; + if let Some(next) = follow_up + && pending.push_back(next).is_err() + && !failed + { + // Queue full: `next` would be lost, breaking the + // honest-feedback contract. Fail secure instead. + failed = true; + latch(&mut pending); + break; + } + } + } + } + + /// Same as [`dispatch_with`] but routes effects to a [`Platform`]. + pub fn dispatch(&mut self, platform: &mut impl Platform, event: Event) { + self.dispatch_with(event, |effect| platform.execute(effect)); + } +} diff --git a/services/orchestrator/sm/src/platform.rs b/services/orchestrator/sm/src/platform.rs new file mode 100644 index 000000000..cc1d0c201 --- /dev/null +++ b/services/orchestrator/sm/src/platform.rs @@ -0,0 +1,65 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +use crate::model::{Effect, Event}; + +/// Signals that the platform driver could not carry out an [`Effect`]. The machine does +/// not need the driver's error detail — **every** actuation failure is treated +/// the same, fail-secure: the orchestrator injects [`Event::EffectFailed`] and the +/// machine latches to [`State::Locked`]. This blanket policy is deliberate and +/// is what lets the failure signal stay a payload-less marker; a future design +/// that needs per-effect recovery must add a *new*, descriptive event rather +/// than widen this type. The driver logs the specifics on its side. +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub struct EffectError; + +/// Outward connection to the platform. Carry out one effect, reporting +/// [`EffectError`] if it could not be performed. Never called with +/// [`Effect::Emit`] — the orchestrator consumes those internally. +/// +/// `Ok(Some(event))` feeds back what the effect produced without blocking +/// (e.g. a verification verdict from an in-process check); the orchestrator +/// queues it and settles it in the same dispatch run. At most one event per +/// effect. Immediate results belong here, not in a driver-side queue, +/// so the orchestrator sees them in the order they were produced. +/// `execute` must return without blocking: +/// results that require I/O or arrive later (boot progress, timer expiry, +/// a verdict from a remote crypto service) are delivered as their own +/// outside events via `dispatch`. +/// +/// Failure stays on the error channel, never in a returned event: `Err` is +/// checked between effects, so a failed actuation aborts the rest of the +/// batch — a feedback event cannot do that. +/// +/// Contract the state machine relies on: +/// - **Honest, complete feedback.** The core's correctness rests entirely on +/// the event stream the driver feeds back; dropping, reordering, or +/// synthesizing events silently breaks the state machine's invariants. +/// - **Returned events quiesce.** Every returned event reports a result the +/// reducer consumes (its retry budgets bound re-verification cycles). An +/// executor that manufactures an event for every effect keeps one dispatch +/// run alive indefinitely. +/// - **`AssertReset` holds, it does not pulse.** A reset must keep the component +/// quiesced and non-executing until its matching `ReleaseReset`. The core's +/// at-rest verification guarantee depends on this: it re-asserts reset on +/// every live component before a recovery re-walk (`quiesce_all`) so that +/// `VerifyFirmware` covers code that cannot run or rewrite its own flash +/// between the check and the release. A reset that merely pulses would let a +/// component resume before verification and void that guarantee. +/// - **A failed [`Effect::LatchLockdown`] is a hard fault.** Lockdown is the top +/// of the escalation ladder — the core has nothing stronger to emit and +/// will *believe* it is `Locked`. The driver must treat that failure as +/// terminal (halt/reset), not a recoverable error. +/// - **[`Effect::RecoverComponent`] reports its verdict as an event, not an +/// `execute` error.** On success the driver feeds back +/// [`Event::Restored`]; when its configured recovery sources for that +/// component are exhausted, it feeds back [`Event::RecoveryUnavailable`] +/// instead — never [`EffectError`]. `EffectError` from a `RecoverComponent` +/// call is reserved for a genuine actuation fault (e.g. a bus error during +/// the image swap), which fails secure to [`State::Locked`] unconditionally. +/// Reporting "out of images" that way would lock the whole platform down +/// even for an `Isolable`/`Cascading` component, instead of letting it be +/// gated per [`FailurePolicy`] like the count-driven exhaustion path. +pub trait Platform { + fn execute(&mut self, effect: Effect) -> Result, EffectError>; +} diff --git a/services/orchestrator/sm/src/rot.rs b/services/orchestrator/sm/src/rot.rs new file mode 100644 index 000000000..326dba111 --- /dev/null +++ b/services/orchestrator/sm/src/rot.rs @@ -0,0 +1,1035 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +use core::marker::PhantomData; + +use crate::model::{ + BootFailureKind, Chain, ComponentAttrs, ComponentId, ComponentKind, Effect, Event, + FailurePolicy, PowerOnResult, State, +}; +use crate::sink::{Outcome, Sink}; +use crate::status::{ComponentLifecycle, ComponentStatus, Gating}; + +/// Shared storage: data that persists across events. `N` is the chain capacity +/// and `E` the effect-buffer size — both board choices; the core sets no +/// default. `E` must be at least `2 * N + 2` (enforced in [`Rot::new`]). +pub struct Rot { + chain: heapless::Vec<(ComponentId, ComponentAttrs), N>, + /// Index into `chain` of the component currently under verification, or the + /// past-the-end sentinel `chain.len()` once the walk is done. Only + /// `chain[cursor]` can be released: a `VerificationPassed` for any other id + /// is stale or out of turn and is dropped. + /// + /// While the walk runs (`PreSupervision` and `AwaitingReady`) the cursor + /// never points at a gated component. Gating the component under + /// verification therefore has to move the cursor past it, which + /// [`handle_corruption_advancing`](Self::handle_corruption_advancing) does: + /// a verdict already in flight then fails the `chain[cursor]` check and is + /// dropped instead of releasing a component the cascade just isolated. + /// `property_isolation_is_sticky_under_random_sequences` guards this. + /// + /// `Recovering` is the exception: `VerificationFailed` leaves the cursor on + /// the failed component and a corruption report can gate it there. Entry to + /// `PreSupervision` re-walks from 0, which restores the invariant. + cursor: u8, + /// One record per chain component (parallel to `chain` by index). Each + /// [`ComponentStatus`] holds the component's service `lifecycle` (`Isolated` + /// means gated out of the walk) and its consecutive failed-restore `retry` + /// count, kept per component so interleaved recoveries never share a budget. + /// Durable across a return to `Ready`; only a fresh `Rot` on `PowerOnReset` + /// resets it. + statuses: heapless::Vec, + max_retry: u8, + /// The component whose update was activated and whose SVN floor has not + /// been committed yet. `None` when nothing is waiting to commit. Its own + /// [`Event::BootConfirmed`] closes the window and clears this; a + /// [`Event::CommitTimeout`] while it is still set goes to + /// [`State::Locked`]. The SVN floor does not move there: `BootConfirmed` + /// records the component in `awaiting_floor_advance` instead. + /// + /// The window spans the walk that follows an activation: the device only + /// boots the candidate once it is reset, so the window cannot close before + /// that walk finishes. Every state it passes through answers + /// [`Event::CommitTimeout`], including the unsupervised + /// [`State::PreSupervision`], or a fire during the walk would be dropped + /// and never come again. In a multi-component chain, the updated device + /// can boot (and confirm) while the walk is still verifying later + /// neighbours; `BootConfirmed` is only handled in `Ready`, so the + /// emitter must re-raise or hold it until the walk finishes. + /// + /// Cleared on the matching [`Event::BootConfirmed`] (the window closes + /// normally) and on entry to the two states that end the window by leaving + /// `Ready` while still running, [`State::Updating`] (a superseding update) + /// and [`State::Recovering`] (the running image is now suspect). Not cleared + /// on `Ready` entry, because activation sets it on the way in. + pending_commit: Option, + /// The component whose image has booted and whose SVN floor is still + /// waiting for the Update Agent to request it. Set by + /// [`Event::BootConfirmed`], cleared by the matching + /// [`Event::SvnCommitRequest`], which emits [`Effect::CommitSvnFloor`]. + /// + /// No watchdog bounds this one. With an Update Agent that never sends + /// UpdateSecurityRevision the SVN floor keeps the SVN it has, which costs + /// anti-rollback coverage for that image and nothing else; locking the + /// platform because a remote agent stayed silent would be worse. That is + /// the posture the eRoT's own session takes with `AwaitingFloorAdvance`. + /// + /// Cleared on entry to [`State::Updating`] and [`State::Recovering`], as + /// `pending_commit` is. What the SVN floor would take is the driver's + /// reading of the image the update verified, and a superseding update + /// overwrites it, so a late `SvnCommitRequest` would otherwise advance the + /// floor past an image that has never booted. + awaiting_floor_advance: Option, + /// Set when this boot started with [`Event::SelfTrialBooted`]: the eRoT + /// is running the trial image of its own update. Entry to + /// [`State::Ready`] emits [`Effect::ConfirmSelfTrial`] and clears it, so + /// the trial is confirmed once, however many times the machine returns to + /// `Ready` afterwards. + /// + /// Only ever set at the start of a boot, so it holds no state across the + /// reset that decides the trial. The session in durable storage does, + /// and it is what the next boot reads. + self_trial_booted: bool, + /// Ties the effect-buffer size `E` to this type (zero-sized). + _effect_cap: PhantomData<[u8; E]>, +} + +impl Rot { + /// Compile-time floor: the effect buffer must hold a full cascade (`N` + /// `AssertReset`s paired with `N` `ReportIsolated`s) plus the destination + /// `PreSupervision` entry's two effects. Forced by `new` below, so an + /// under-sized `E` fails to build. + const EFFECT_CAP_OK: () = assert!( + E >= 2 * N + 2, + "effect buffer E must be >= 2 * chain length N + 2", + ); + + pub fn new(chain: Chain, max_retry: u8) -> Self { + let () = Self::EFFECT_CAP_OK; + let chain = chain.into_entries(); + // One status record per chain component, parallel by index. + let mut statuses = heapless::Vec::new(); + for _ in 0..chain.len() { + let _ = statuses.push(ComponentStatus::default()); + } + Self { + chain, + cursor: 0, + statuses, + max_retry, + pending_commit: None, + awaiting_floor_advance: None, + self_trial_booted: false, + _effect_cap: PhantomData, + } + } + + /// Look up a component's attributes by id. `None` if the id is not in the + /// chain (should never happen for ids the core itself produced). + fn attrs_of(&self, id: ComponentId) -> Option { + self.chain + .iter() + .find(|(cid, _)| *cid == id) + .map(|(_, a)| *a) + } + + /// Index of `id` in the parallel `chain`/`statuses` arrays. `None` if the + /// id is not in the chain (should never happen for core-produced ids). + fn status_index(&self, id: ComponentId) -> Option { + self.chain.iter().position(|(cid, _)| *cid == id) + } + + /// Whether `id` names a component in the configured chain. The core only + /// supervises chain components, so an event that names an id outside the + /// chain is dropped rather than acted on — it describes something the core + /// has no model of and never released. + pub(crate) fn in_chain(&self, id: ComponentId) -> bool { + self.status_index(id).is_some() + } + + fn is_gated(&self, id: ComponentId) -> bool { + self.status_index(id) + .is_some_and(|i| self.statuses[i].lifecycle == ComponentLifecycle::Isolated) + } + + /// Gate one component out of service, returning `true` if this newly gated + /// it (`false` if already `Isolated`). Emits the paired `AssertReset` + + /// `ReportIsolated` only on the newly-gated transition, so reporting is + /// idempotent per component. + fn gate_one(&mut self, ctx: &mut Sink, id: ComponentId) -> bool { + if self.is_gated(id) { + return false; + } + ctx.emit(Effect::AssertReset(id)); + ctx.emit(Effect::ReportIsolated(id)); + if let Some(i) = self.status_index(id) { + self.statuses[i].lifecycle = ComponentLifecycle::Isolated; + // A gated component is held in reset and no longer owes a + // boot-progress signal; drop any pending watchdog so a late + // `Timeout` can't drag an already-isolated component into recovery. + // It is also no longer live — the `AssertReset` above holds it. + self.statuses[i].awaiting_boot = false; + self.statuses[i].released = false; + } + if self.awaiting_floor_advance == Some(id) { + // Gating holds the component in reset as corrupt, which puts the + // image it booted under the same suspicion recovery does. The SVN + // floor advance the Update Agent has not requested yet is void too: + // a later `SvnCommitRequest` would advance the floor for an image + // the state machine has just taken out of service. + self.awaiting_floor_advance = None; + } + true + } + + /// Increment `id`'s consecutive failed-restore count and return the new + /// value. Counts are kept per component so that interleaved recovery + /// episodes for different components never share a budget. + fn bump_retry(&mut self, id: ComponentId) -> u8 { + match self.status_index(id) { + Some(i) => { + self.statuses[i].retry = self.statuses[i].retry.saturating_add(1); + self.statuses[i].retry + } + None => 0, + } + } + + /// Drop `id`'s retry count. Called when the component recovers (passes + /// verification) or is gated — either way its consecutive-failure streak + /// ends, so a future failure starts counting fresh (INV7: consecutive only). + fn clear_retry(&mut self, id: ComponentId) { + if let Some(i) = self.status_index(id) { + self.statuses[i].retry = 0; + } + } + + /// Record that `id` has been released and now owes a boot-progress signal. + /// Paired with the `ReleaseReset` emitted at each release site: the platform driver + /// arms its per-component boot watchdog there, and this arms ours. Also + /// marks the component *live* (`released`), which a later re-entry to + /// [`State::PreSupervision`] uses to quiesce it before re-verifying. + fn mark_released(&mut self, id: ComponentId) { + if let Some(i) = self.status_index(id) { + self.statuses[i].awaiting_boot = true; + self.statuses[i].released = true; + } + } + + /// Clear `id`'s boot-progress watchdog because it reported in + /// ([`Event::ComponentReady`] or [`Event::Booted`]). Idempotent: a report + /// for a component not awaiting boot simply changes nothing. + fn clear_awaiting_boot(&mut self, id: ComponentId) { + if let Some(i) = self.status_index(id) { + self.statuses[i].awaiting_boot = false; + } + } + + /// The chain's eRoT, which `chain_of` has already put at position 0 and + /// refused to accept anywhere else. `chain_of` is a `const fn` and its + /// assert is a build error, so a board whose table names no eRoT does + /// not compile. `None` reaches here only from a chain built through + /// `Chain::try_from`, which checks ids and dependencies but not the + /// kind, and the unit tests are what build one. + fn erot_id(&self) -> Option { + self.chain + .iter() + .find(|(_, attrs)| attrs.kind == ComponentKind::Erot) + .map(|&(id, _)| id) + } + + /// Whether `id` has been released and still owes a boot-progress signal. + /// A [`Event::Timeout`] is a real boot failure only for such a component; + /// otherwise it is stale/spurious. + fn is_awaiting_boot(&self, id: ComponentId) -> bool { + self.status_index(id) + .is_some_and(|i| self.statuses[i].awaiting_boot) + } + + /// Advance `cursor` from `start_idx` to the first component not in + /// `gated`, emitting its `ReadFirmware`/`VerifyFirmware`. Returns `true` if + /// found. If the rest of the chain is exhausted or entirely gated, sets + /// `cursor` to a past-the-end sentinel (`chain.len()`) and returns + /// `false` — the caller should treat that as "chain done". + fn advance_to_next_ungated(&mut self, ctx: &mut Sink, start_idx: usize) -> bool { + let mut idx = start_idx; + while let Some(&(id, attrs)) = self.chain.get(idx) { + // The eRoT is chain position 0 and is already running by the + // time the walk starts. It is what does the reading, verifying + // and releasing, so there is nothing here to read, verify at + // rest or release. Step past it, like a gated component. + if attrs.kind == ComponentKind::Erot { + idx += 1; + continue; + } + if !self.is_gated(id) { + // `idx < chain.len() <= N`; chain capacity is board-chosen and + // assumed to fit `u8`, matching the existing `cursor: u8` contract. + self.cursor = idx as u8; + ctx.emit(Effect::ReadFirmware(id)); + ctx.emit(Effect::VerifyFirmware(id)); + return true; + } + idx += 1; + } + self.cursor = self.chain.len() as u8; + false + } + + /// Hold the whole platform for an at-rest re-verification: assert reset on + /// every component that is currently *live* (`released`) and drop its + /// boot-progress watchdog, so the walk that follows verifies code that is + /// quiesced rather than executing. This is what makes recovery a genuine + /// platform re-boot — no released component is ever re-verified while it is + /// still running (a live check says nothing about what is executing and is + /// open to a post-check flash rewrite). + /// + /// Lifecycle is untouched: these components are held for re-check, not gated + /// (`Nominal` stays `Nominal`), and each is released again by its + /// `ReleaseReset` once it re-passes verification. Isolated components are + /// already held (`released == false`) and are skipped, as is anything under + /// active recovery. At the initial power-on walk nothing is live yet, so + /// this emits nothing and cold boot is unchanged. + fn quiesce_all(&mut self, ctx: &mut Sink) { + for i in 0..self.chain.len() { + if !self.statuses[i].released { + continue; + } + let (id, _) = self.chain[i]; + ctx.emit(Effect::AssertReset(id)); + self.statuses[i].released = false; + self.statuses[i].awaiting_boot = false; + } + } + /// shared by both paths that take a component out of service — the + /// runtime-corruption path ([`handle_corruption`](Self::handle_corruption)) + /// and the recovery-exhaustion path — so the two can never disagree about + /// what a policy means (in particular, `Cascading` cascades in both). + /// + /// - `Isolable` → gate this component alone → [`Gating::Gated`]. + /// - `Cascading` → gate this component and every transitive dependent → + /// [`Gating::Gated`]. + /// - `Required`, or an unknown/missing id → gate nothing → + /// [`Gating::NotGated`], leaving the caller to handle the non-gating + /// outcome in its own context (recover, at runtime; lock down, once + /// recovery is exhausted). + /// + /// Every component this gates also gets an [`Effect::ReportIsolated`], so + /// management software learns the platform is degraded no matter which path + /// took the component out of service. + /// + /// Idempotent per component (guarded by `is_gated`) — so is the reporting: + /// a component already gated is neither re-reset nor re-reported. + fn gate_by_policy(&mut self, ctx: &mut Sink, id: ComponentId) -> Gating { + match self.attrs_of(id).map(|attrs| attrs.failure_policy) { + Some(FailurePolicy::Cascading) => { + self.cascade_hold(ctx, id); + Gating::Gated + } + Some(FailurePolicy::Isolable) => { + self.gate_one(ctx, id); + Gating::Gated + } + // `Required`, or an unknown/missing id: not a gating policy. + _ => Gating::NotGated, + } + } + + /// Recovery is over for `failed` without success: gate per policy + /// (`Isolable`/`Cascading` skip; `Required` reports + latches `Locked`). + /// Shared by the retry-cap path (`Restored`, count exhausted) and the + /// platform's `RecoveryUnavailable` path, so the two can never diverge. + fn exhaust_recovery(&mut self, ctx: &mut Sink, failed: ComponentId) -> Outcome { + match self.gate_by_policy(ctx, failed) { + Gating::Gated => { + self.clear_retry(failed); + Outcome::Transition(State::PreSupervision) + } + // `Required`, or an unknown/missing id: report the component that + // forced the halt, then lock down. The report precedes the + // internal `Emit`, so it is actuated before the machine moves + // toward `Locked`. + Gating::NotGated => { + ctx.emit(Effect::ReportRecoveryFailed(failed)); + ctx.emit(Effect::Emit(Event::RecoveryFailed)); + Outcome::Handled + } + } + } + + /// Shared `CorruptionDetected` handling. Delegates the policy interpretation + /// to [`gate_by_policy`](Self::gate_by_policy) so this path and the + /// recovery-exhaustion path can never diverge: + /// `Isolable`/`Cascading` → gate the component (single or cascade) and stay + /// put, so a later re-walk skips it instead of silently re-releasing one we + /// already found corrupt; `Required` → recover first (the halt-on-exhaustion + /// decision happens later in `Recovering`). + fn handle_corruption(&mut self, id: ComponentId, ctx: &mut Sink) -> Outcome { + // Already isolated: it is held in reset and was reported. Recovering + // it restores a component the re-walk skips, and on exhaustion a + // `Required` one locks the platform down over a cascade that was + // already contained. + if self.is_gated(id) { + return Outcome::Handled; + } + match self.gate_by_policy(ctx, id) { + Gating::Gated => Outcome::Handled, + Gating::NotGated => Outcome::Transition(State::Recovering(id)), + } + } + + /// `CorruptionDetected` for `PreSupervision` and `AwaitingReady`, the two + /// states that release off `chain[cursor]`. Gates by policy, then keeps the + /// `cursor` invariant by moving it past the component under verification + /// when the cascade gated it. A `Required` corruption gates nothing and + /// returns `Transition(Recovering)` unchanged. + /// + /// Not called from `handle_supervising`: `Recovering`'s cursor is stale + /// (`VerificationFailed` left it on the failed component), so advancing + /// there would verify mid-recovery or reach `Ready` instead of re-walking. + fn handle_corruption_advancing(&mut self, id: ComponentId, ctx: &mut Sink) -> Outcome { + let outcome = self.handle_corruption(id, ctx); + let cursor_gated = self + .chain + .get(self.cursor as usize) + .is_some_and(|(c, _)| self.is_gated(*c)); + if !matches!(outcome, Outcome::Handled) || !cursor_gated { + return outcome; + } + let next_idx = (self.cursor as usize).saturating_add(1); + if self.advance_to_next_ungated(ctx, next_idx) { + Outcome::Handled + } else { + Outcome::Transition(State::Ready) + } + } + + /// Hold `root` and cascade-hold every component whose `depends_on` + /// (transitively) names it. Emits `AssertReset` and `ReportIsolated` for + /// each newly gated component, including `root` itself — every isolated + /// device is reported, not just the one that failed. + fn cascade_hold(&mut self, ctx: &mut Sink, root: ComponentId) { + // BFS over the components gated so far. `frontier` is also the visited + // set: a component already on it is never queued again, so the walk + // visits each component once and terminates even on a dependency + // cycle. + // + // Traversal must not skip a component that is already gated. Its own + // dependents may still be running, and they are only reachable through + // it, so stopping there would leave a component whose dependency is + // isolated out of reset. `gate_one` is idempotent, so re-visiting a + // gated component emits nothing and only continues the walk. + let mut frontier: heapless::Vec = heapless::Vec::new(); + self.gate_one(ctx, root); + let _ = frontier.push(root); + let mut i = 0; + while let Some(&holder) = frontier.get(i) { + i += 1; + let mut dependents: heapless::Vec = heapless::Vec::new(); + for &(id, attrs) in self.chain.iter() { + if attrs.depends_on == Some(holder) && !frontier.contains(&id) { + let _ = dependents.push(id); + } + } + for id in dependents { + self.gate_one(ctx, id); + let _ = frontier.push(id); + } + } + } +} + +/// The state machine proper: the per-state handlers, the superstate handler, and the +/// entry actions. These are pure functions of `(stored data, state, event)` — +/// they mutate [`Rot`]'s storage and push [`Effect`]s into the [`Sink`], and +/// return an [`Outcome`] describing what should happen to the current state. +/// Applying that outcome is the engine's job ([`Orchestrator::step`]). +impl Rot { + /// Dispatch `event` to the handler for `state` (the leaf state). An + /// [`Outcome::Super`] here means "not handled at this level" — the engine + /// forwards to [`handle_supervising`](Self::handle_supervising) if `state` + /// is supervised, and otherwise discards the event. + pub(crate) fn handle(&mut self, state: State, event: &Event, ctx: &mut Sink) -> Outcome { + match state { + State::PowerOnReset => match event { + Event::PowerGood(PowerOnResult::Provisioned) => { + Outcome::Transition(State::PreSupervision) + } + Event::PowerGood(PowerOnResult::Unprovisioned) => { + Outcome::Transition(State::Locked) + } + Event::PowerGood(PowerOnResult::SelfVerificationFailed) => { + Outcome::Transition(State::Locked) + } + // The boot that decides a self-update trial. Recorded here + // and acted on at `Ready` entry, because what confirms the + // trial is the chain coming up, not power-on itself. + Event::SelfTrialBooted => { + self.self_trial_booted = true; + Outcome::Handled + } + Event::EffectFailed => Outcome::Transition(State::Locked), + _ => Outcome::Super, + }, + + // Cursor walk via Outcome::Handled — a self-transition would reset cursor. + State::PreSupervision => match event { + // The commit window can span this walk: an activation enters + // `PreSupervision` with the window open. `PreSupervision` is + // unsupervised, so without this match arm the watchdog fire would be + // dropped and never come again, leaving commit-or-lock + // unenforced for the length of a boot. + Event::CommitTimeout => { + if self.pending_commit.is_some() { + Outcome::Transition(State::Locked) + } else { + Outcome::Handled + } + } + Event::VerificationPassed(id) => { + // Only the component currently under verification + // (`chain[cursor]`, whose `VerifyFirmware` was just emitted) + // may be released. A verdict for any other id is stale or + // out-of-turn and is dropped, so a misordered or hostile + // report cannot release an unverified component (cf. INV9 + // for `ComponentReady`). + if self.chain.get(self.cursor as usize).map(|(c, _)| c) != Some(id) { + return Outcome::Handled; + } + // The component passed its check — it has recovered, so its + // consecutive-failure streak ends (INV7: consecutive only). + self.clear_retry(*id); + ctx.emit(Effect::ReleaseReset(*id)); + // Released: it is now live, and owes a boot-progress signal + // (both tiers). + self.mark_released(*id); + let current_kind = self.chain.get(self.cursor as usize).map(|(_, a)| a.kind); + let next_idx = (self.cursor as usize).saturating_add(1); + if self.advance_to_next_ungated(ctx, next_idx) { + match current_kind { + Some(ComponentKind::Active) => { + Outcome::Transition(State::AwaitingReady(Some(*id))) + } + _ => Outcome::Handled, + } + } else { + Outcome::Transition(State::Ready) + } + } + Event::VerificationFailed(id) => { + // A verdict from before the gating, for a component the + // cascade has since isolated: recovering it re-walks the + // chain for a device that stays held. + if self.is_gated(*id) { + return Outcome::Handled; + } + // Recovery is attempted first for every failure, + // regardless of the component's recovery-failure policy: + // the policy is consulted once retries are exhausted. + Outcome::Transition(State::Recovering(*id)) + } + // Minimal fix: react to a corruption report if one arrives, + // even though `PreSupervision` isn't linked to + // `SupervisingPlatform`. Not acting on data we already have + // would be strictly worse than acting on it, whether or not + // any mechanism guarantees the event arrives in the first + // place. `AttestationChallenge` is left + // unhandled here (falls through to `Outcome::Super` and is + // discarded) — that's a separate question. + Event::CorruptionDetected(id) => self.handle_corruption_advancing(*id, ctx), + // Boot-progress liveness for a passive component released + // speculatively earlier in this same walk. Clear its watchdog + // even though `PreSupervision` is unsupervised — acting on a + // report we already have is never worse than dropping it (same + // rationale as `CorruptionDetected` above). An `Active` + // component's `ComponentReady` cannot arrive here: releasing an + // active moves the machine straight to `AwaitingReady`. + Event::Booted(id) => { + self.clear_awaiting_boot(*id); + Outcome::Handled + } + // Timeout always recovers: silence says nothing about the + // image, so a fresh attempt is never futile. Stale ids + // (component not awaiting boot) are dropped. + Event::Timeout(id) => { + if self.is_awaiting_boot(*id) { + Outcome::Transition(State::Recovering(*id)) + } else { + Outcome::Handled + } + } + // A device-reported boot failure. DeviceFatal means the + // device itself declared the image unrecoverable by retry, + // so Isolable/Cascading components are gated immediately + // (no recovery budget burned); Required still recovers + // because a different recovery source could help. + // Non-fatal kinds recover unconditionally, like Timeout. + Event::BootFailed { + id, + checkpoint, + kind, + } => { + if !self.is_awaiting_boot(*id) { + return Outcome::Handled; + } + ctx.emit(Effect::ReportBootFailed { + id: *id, + checkpoint, + kind: *kind, + }); + if *kind == BootFailureKind::DeviceFatal { + self.handle_corruption_advancing(*id, ctx) + } else { + Outcome::Transition(State::Recovering(*id)) + } + } + Event::EffectFailed => Outcome::Transition(State::Locked), + _ => Outcome::Super, + }, + + // `awaiting` is the state's own payload, so changing it means + // re-entering the variant: `Outcome::Handled` leaves the payload + // untouched. That is correct only because `AwaitingReady` has no + // entry action — do not add one. + State::AwaitingReady(awaiting) => match event { + Event::ComponentReady(id) => { + // Clear this component's boot-progress watchdog whether or + // not it is the one this state's slot is tracking: a later + // `Active` released speculatively reports its readiness here + // too, and its watchdog must be cleared just the same. + self.clear_awaiting_boot(*id); + if awaiting != Some(*id) { + return Outcome::Handled; // not the tracked slot (INV9) + } + // If cursor is past the end, the eRoT side of the walk has + // already finished (chain done, or the remainder is held) — + // nothing left to verify, we're done. + if (self.cursor as usize) >= self.chain.len() { + Outcome::Transition(State::Ready) + } else { + // Readiness satisfied, chain not done: stay supervised, + // now awaiting nothing. + Outcome::Transition(State::AwaitingReady(None)) + } + } + Event::VerificationPassed(id) => { + // Only the component currently under verification + // (`chain[cursor]`) may be released; a verdict for any other + // id is stale or out-of-turn and is dropped (cf. INV9 for + // `ComponentReady`). + if self.chain.get(self.cursor as usize).map(|(c, _)| c) != Some(id) { + return Outcome::Handled; + } + // The component passed its check — it has recovered, so its + // consecutive-failure streak ends (INV7: consecutive only). + self.clear_retry(*id); + ctx.emit(Effect::ReleaseReset(*id)); + // Released: it is now live, and owes a boot-progress signal + // (both tiers). + self.mark_released(*id); + let next_idx = (self.cursor as usize).saturating_add(1); + if self.advance_to_next_ungated(ctx, next_idx) { + // `Handled` preserves the current payload: `awaiting` is + // cleared only by `ComponentReady` or `VerificationFailed`. + Outcome::Handled + } else { + Outcome::Transition(State::Ready) + } + } + Event::VerificationFailed(id) => { + // Same in-flight verdict as above: an isolated component + // does not enter recovery. + if self.is_gated(*id) { + return Outcome::Handled; + } + // Recovery is attempted first for every failure, regardless + // of the component's recovery-failure policy. + Outcome::Transition(State::Recovering(*id)) + } + // Releases off `chain[cursor]` too, so the cursor must move + // off a component the cascade gated. `Handled` keeps `awaiting`. + Event::CorruptionDetected(id) => self.handle_corruption_advancing(*id, ctx), + // DeviceFatal: the device declared the image unrecoverable. + // Gate Isolable/Cascading immediately (cursor-advancing), + // recover Required. Non-fatal kinds and Timeout fall through + // to handle_supervising below. + Event::BootFailed { + id, + kind: BootFailureKind::DeviceFatal, + checkpoint, + } if self.is_awaiting_boot(*id) => { + ctx.emit(Effect::ReportBootFailed { + id: *id, + checkpoint, + kind: BootFailureKind::DeviceFatal, + }); + self.handle_corruption_advancing(*id, ctx) + } + // `Timeout` and non-fatal `BootFailed` fall through to + // `handle_supervising`, which runs the device-agnostic + // boot-progress watchdog uniformly across every supervised + // state. + _ => Outcome::Super, + }, + + State::Ready => match event { + // An open trial means a downstream device booted a test + // image and the confirmation is still on its way. Entry to + // `Updating` reverts whatever trial is open, so an update + // for a different component would throw that image away + // mid-flight. `Super` sends the request to + // `handle_supervising`, which reports it deferred and + // leaves the trial open. A request naming the component on + // trial is taken: that update replaces the image under + // trial anyway. + Event::UpdateRequest(id) => match self.pending_commit { + Some(open) if open != *id => Outcome::Super, + _ => Outcome::Transition(State::Updating(*id)), + }, + // Boot-confirmation checkpoint: the image authenticated at + // `ActivateUpdate` and has now run. Handled in place — + // confirming a running image is not a state change. Closing the + // window clears `pending_commit` so a later `CommitTimeout` + // cannot lock a device that has already booted, and records + // `id` in `awaiting_floor_advance`, where the SVN floor advance + // waits for the request. + Event::BootConfirmed(id) => { + if self.pending_commit == Some(*id) { + self.pending_commit = None; + self.awaiting_floor_advance = Some(*id); + // The device booted the test image and reported + // ready, so the trial closes with the image kept. + // Every other place that clears `pending_commit` + // reverts the trial instead. + ctx.emit(Effect::ConfirmDeviceTrial(*id)); + } + Outcome::Handled + } + // The Update Agent requested the SVN floor with + // UpdateSecurityRevision and the device took the SVN. This is + // the only thing that moves an eRoT-held SVN floor. A request + // for a component with no SVN floor advance outstanding is + // dropped: the SVN floor takes the SVN once. + Event::SvnCommitRequest(id) => { + if self.awaiting_floor_advance == Some(*id) { + ctx.emit(Effect::CommitSvnFloor(*id)); + self.awaiting_floor_advance = None; + } + Outcome::Handled + } + // Commit watchdog. If the activated-but-not-committed window is + // still open, fail secure: never commit an image no boot has + // confirmed, and never leave the downgrade window open + // indefinitely. Outside the window this is a stale watchdog + // fire and is dropped. + Event::CommitTimeout => { + if self.pending_commit.is_some() { + Outcome::Transition(State::Locked) + } else { + Outcome::Handled + } + } + _ => Outcome::Super, + }, + + State::Updating(target) => match event { + Event::UpdateVerified => { + ctx.emit(Effect::ActivateUpdate); + // Open the activated-but-not-committed window: the SVN + // floor does not move here; it waits for `BootConfirmed`. + // The driver arms its commit watchdog on `ActivateUpdate`, + // and `CommitTimeout` bounds this window (commit-or-lock). + self.pending_commit = Some(target); + // Re-walk rather than returning to `Ready`. Activation only + // proposes the image; the device runs the old one until it + // is reset, and `PreSupervision` entry quiesces every live + // component before verifying at rest. That reset is what + // boots the candidate, and the walk's `VerifyFirmware` is + // what records its SVN, which the SVN floor commit then + // takes. Without it a `BootConfirmed` would commit the + // previous image's SVN and leave the downgrade window open. + Outcome::Transition(State::PreSupervision) + } + Event::UpdateRejected => { + ctx.emit(Effect::DiscardStaged); + Outcome::Transition(State::Ready) + } + // Same disposal, no report. The requester withdrew this + // itself, so telling it the update is over says nothing it + // does not already know. + Event::UpdateCancelled => { + ctx.emit(Effect::DiscardStaged); + Outcome::Transition(State::Ready) + } + Event::CorruptionDetected(id) => { + let outcome = self.handle_corruption(*id, ctx); + // Only a *preemption* (transition out to recovery) orphans + // the staged image. An `Isolable`/`Cascading` corruption + // returns `Handled` and the update continues untouched, so + // its staged image must survive — do not discard then. + if matches!(outcome, Outcome::Transition(State::Recovering(_))) { + // Dispose of the orphaned image *and* answer the update + // requester: the update it was awaiting a verdict on has + // been superseded by recovery, not merely delayed. + ctx.emit(Effect::DiscardStaged); + ctx.emit(Effect::ReportUpdateAborted); + } + outcome + } + _ => Outcome::Super, + }, + + State::Recovering(failed) => match event { + Event::Restored(id) => { + // A `Restored` for a component other than the current + // recovery target (e.g. an episode displaced by a later + // corruption) must not be credited to this recovery. Drop + // it; the eventual re-walk re-verifies every component. + if *id != failed { + return Outcome::Handled; + } + // Count this attempt against the specific component in + // recovery, not a global budget: a component exhausts + // its own attempts, not a platform-wide budget. The + // recovery target is the payload `State::Recovering` + // carries, so it is always present and needs no + // defensive fallback. + let attempts = self.bump_retry(failed); + if attempts < self.max_retry { + Outcome::Transition(State::PreSupervision) + } else { + // Retries exhausted: gate via the same shared arm the + // platform's `RecoveryUnavailable` path uses, so the + // two can never disagree. + self.exhaust_recovery(ctx, failed) + } + } + Event::RecoveryUnavailable(id) => { + if *id != failed { + return Outcome::Handled; // same guard as Restored + } + // Authoritative: the platform is out of sources, so the + // machine does not wait for the retry count to run out + // (does not call `bump_retry`). + self.exhaust_recovery(ctx, failed) + } + Event::RecoveryFailed => Outcome::Transition(State::Locked), + _ => Outcome::Super, + }, + + State::Locked => Outcome::Super, + } + } + + /// The supervising handler, reached only when [`handle`](Self::handle) + /// returns [`Outcome::Super`] from one of the four supervised states + /// ([`State::AwaitingReady`], [`State::Ready`], [`State::Updating`], + /// [`State::Recovering`] — see [`Orchestrator::is_supervised`]). It provides + /// two platform-wide guarantees that must hold across all four: + /// + /// - Attestation challenges are always answered. + /// - Corruption of a required component always triggers recovery. + /// + /// Note: [`State::PreSupervision`] is deliberately *not* supervised, so the + /// attestation guarantee does not hold while a component is still being + /// walked there. Nothing requires an answer before the chain walk + /// completes, so `AttestationChallenge` is left unhandled in + /// `PreSupervision` (falls through to [`Outcome::Super`] and, with no + /// supervisor, is discarded). + /// + /// The corruption guarantee, however, *does* hold in `PreSupervision`: that + /// state handles [`Event::CorruptionDetected`] in its own arm, via + /// [`handle_corruption_advancing`](Self::handle_corruption_advancing), since + /// routing it here would also pull in the attestation behavior above. + /// `AwaitingReady` does the same; the cursor rationale is on the helper. + /// No mechanism guarantees a corruption report for an already-released + /// component's *live, executing* state: background NVM integrity polling + /// runs at rest, between boots, not during a chain walk. So the report + /// may never come; the state machine still acts on one that does. See + /// `corruption_during_presupervision_selfloop_triggers_recovery` in + /// `tests.rs`. + pub(crate) fn handle_supervising(&mut self, event: &Event, ctx: &mut Sink) -> Outcome { + match event { + Event::AttestationChallenge => { + ctx.emit(Effect::SignAttestation); + Outcome::Handled + } + // Reached from `Ready` and `Recovering` only: `PreSupervision`, + // `AwaitingReady` and `Updating` handle this in their own arms. + Event::CorruptionDetected(id) => self.handle_corruption(*id, ctx), + // Boot-progress signals arriving after the walk left `PreSupervision` + // / `AwaitingReady` (e.g. once the machine is already `Ready`): clear + // the component's watchdog. `ComponentReady` is the active tier, + // `Booted` the passive tier; both just retire the outstanding wait. + Event::ComponentReady(id) | Event::Booted(id) => { + self.clear_awaiting_boot(*id); + Outcome::Handled + } + // Timeout always recovers: silence is ambiguous, so retrying + // is never futile. Stale ids (already booted) are dropped. + Event::Timeout(id) => { + if self.is_awaiting_boot(*id) { + Outcome::Transition(State::Recovering(*id)) + } else { + Outcome::Handled + } + } + // Same DeviceFatal split as PreSupervision/AwaitingReady, but + // non-advancing: Ready/Recovering/Updating are not walking the + // chain, so the cursor is not the walk position. + Event::BootFailed { + id, + checkpoint, + kind, + } => { + if !self.is_awaiting_boot(*id) { + return Outcome::Handled; + } + ctx.emit(Effect::ReportBootFailed { + id: *id, + checkpoint, + kind: *kind, + }); + if *kind == BootFailureKind::DeviceFatal { + self.handle_corruption(*id, ctx) + } else { + Outcome::Transition(State::Recovering(*id)) + } + } + // A new update cannot start from any supervised state except + // `Ready` (the state machine is mid-walk, mid-update, or + // mid-recovery). The platform cannot take an update right now: a + // walk, an update or a recovery is running, or a trial is open for + // another component. Report the refusal rather than dropping the + // request; the work in flight continues (`Handled`, no transition). + Event::UpdateRequest(_) => { + ctx.emit(Effect::ReportUpdateDeferred); + Outcome::Handled + } + // Same window, same reason as `PreSupervision`'s match arm: the walk + // that follows an activation passes through the supervised + // states too, and a dropped watchdog fire never returns. + Event::CommitTimeout => { + if self.pending_commit.is_some() { + Outcome::Transition(State::Locked) + } else { + Outcome::Handled + } + } + Event::EffectFailed => Outcome::Transition(State::Locked), + _ => Outcome::Super, + } + } + + /// Run `state`'s entry action. Called by the engine only when a handler + /// returned [`Outcome::Transition`] — never on [`Outcome::Handled`]. That + /// distinction is load-bearing: `PreSupervision`'s cursor walk returns + /// `Handled` precisely so this does not re-run and reset the cursor. + pub(crate) fn entry_action(&mut self, state: State, ctx: &mut Sink) { + match state { + State::PreSupervision => { + // Recovery is a full platform re-boot: quiesce every live + // component before the walk, so verification always covers code + // at rest, never a component whose earlier pass says nothing + // about what it is currently running. Empty at the initial + // power-on walk (nothing live yet), so cold boot is unchanged. + self.quiesce_all(ctx); + let _ = self.advance_to_next_ungated(ctx, 0); + } + State::Updating(target) => { + // A new update supersedes any activated-but-not-committed + // image; the prior commit window is void. The superseded image + // was never confirmed, so the trial closes without keeping the + // image. + if let Some(superseded) = self.pending_commit.take() { + ctx.emit(Effect::RevertDeviceTrial(superseded)); + } + if self.awaiting_floor_advance == Some(target) { + // This update replaces the image whose SVN floor advance + // the Update Agent has not requested yet, so the SVN that + // floor advance would take belongs to the image being + // replaced. An SVN floor advance outstanding for another + // component names an image this update does not replace, so + // the clear does not run for that one. + self.awaiting_floor_advance = None; + } + ctx.emit(Effect::AuthenticateStageUpdate); + } + State::Recovering(failed) => { + // Recovery voids any activated-but-not-committed image: the + // running image is now under suspicion, so its commit window + // ends here. + if let Some(suspect) = self.pending_commit.take() { + ctx.emit(Effect::RevertDeviceTrial(suspect)); + } + if self.awaiting_floor_advance == Some(failed) { + // Recovery puts the image this component booted under + // suspicion, so the SVN floor advance the Update Agent has + // not requested yet is void too. An SVN floor advance + // outstanding for another component names an image this + // recovery does not touch, so the clear does not run for + // that one. + self.awaiting_floor_advance = None; + } + // The component under recovery is being restored, not booting; + // drop any pending boot-progress watchdog so a late `Timeout` + // can't re-enter recovery for it. It is also held (not live) + // while the platform restores it, so it is not quiesced again on + // the re-walk. + self.clear_awaiting_boot(failed); + // `retry` here is the consecutive-recovery count for `failed` + // (0 on the first attempt); hand it to the driver so it need not + // track its own. It is bumped later, on `Restored`. + let attempt = match self.status_index(failed) { + Some(i) => { + self.statuses[i].released = false; + self.statuses[i].retry + } + None => 0, + }; + ctx.emit(Effect::RecoverComponent { + id: failed, + attempt, + }); + } + State::Locked => { + ctx.emit(Effect::LatchLockdown); + } + State::Ready => { + // The chain is up. If the eRoT booted the trial image of its + // own update, that boot confirms the trial: confirm the + // session, so the request the Update Agent sends for the SVN + // floor advance is answered rather than refused. Cleared here, + // so a later return to `Ready` in the same boot confirms + // nothing a second time. + if self.self_trial_booted { + self.self_trial_booted = false; + ctx.emit(Effect::ConfirmSelfTrial); + // The state machine answers `SvnCommitRequest` with + // `CommitSvnFloor` only for the id in + // `awaiting_floor_advance`, so without this assignment it + // drops the request for the eRoT's SVN floor. + // `BootConfirmed` makes the same mark for a downstream + // device. The SVN is written elsewhere: `ConfirmSelfTrial` + // above has the driver confirm the session, and + // `commit_self_svn_floor` moves the SVN floor to the SVN + // the session then holds. + self.awaiting_floor_advance = self.erot_id(); + } + // NB: `gated` is intentionally NOT cleared here. It is a durable + // trust-boundary gate (each id has a live `AssertReset`); + // clearing it would let a later chain walk re-release a + // component that policy deliberately isolated. Only a fresh + // `Rot` on `PowerOnReset` clears it. + // + // Retry counts, by contrast, ARE cleared: a clean boot means no + // recovery episode is in flight, so every per-component streak + // resets to zero. (The `Isolated` lifecycle is preserved.) + for s in self.statuses.iter_mut() { + s.retry = 0; + } + } + _ => {} + } + } +} diff --git a/services/orchestrator/sm/src/sink.rs b/services/orchestrator/sm/src/sink.rs new file mode 100644 index 000000000..e7f63a014 --- /dev/null +++ b/services/orchestrator/sm/src/sink.rs @@ -0,0 +1,110 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +use crate::model::{Effect, State}; + +// Internal capacities — these follow from how the machine works, not from the +// deployment. The board owns `N` (chain length), `E` (effect-buffer size) and +// max_retry. + +/// Upper bound on events queued at once inside `dispatch_with`. The queue +/// pops as it settles, so this bounds *in-flight* events, not a run's total +/// length: one batch can queue at most one `Emit` follow-up plus one returned +/// event per external effect. Executors that return an event for many effects +/// of one batch can overflow this; overflow is fail-secure (see +/// `dispatch_with`), never silent loss. +pub(crate) const PENDING_CAP: usize = 8; + +/// Compile-time floor: room for an `Emit` follow-up, a returned event, and +/// the injected `EffectFailed`. Evaluated at build time (an anonymous +/// `const`), so an under-sized `PENDING_CAP` fails to compile. +const _: () = assert!( + PENDING_CAP >= 3, + "PENDING_CAP must hold an Emit follow-up + a returned event + EffectFailed", +); + +/// Result of dispatching one event to a state (or its superstate). +pub(crate) enum Outcome { + /// Event consumed; state unchanged; no entry action runs. + Handled, + /// Change to this state and run its entry action. + Transition(State), + /// Not handled here; defer to the superstate (or discard if none). + Super, +} + +/// The effect buffer handed to every handler, sized to `E`. +/// +/// The only thing a handler can do to the outside world is call `emit`. The +/// orchestrator gives each event a fresh `Sink` and drains it afterward. +/// +/// `E` is bounded from below by the chain length: the worst single event is a +/// full cascade (up to `N` `AssertReset`s, each paired with a `ReportIsolated`) +/// plus the destination `PreSupervision` entry's `ReadFirmware`/`VerifyFirmware` +/// (2), all landing in one `Sink`. The re-walk quiesce (an `AssertReset` per +/// live component) never pushes past this bound, because gating and quiescing +/// are mutually exclusive per component: a component the cascade isolates is not +/// also live, so the two counts never sum above the full-cascade worst case. +/// A cascade can land in `Ready` instead, when nothing ungated is left to walk, +/// and `Ready` entry emits one effect of its own (`ConfirmSelfTrial`). That +/// comes to `2 * N + 1`, one under the same bound. +/// +/// `ConfirmDeviceTrial` fills a `Sink` alone: `Ready` handles +/// `BootConfirmed` in place and emits nothing else. `RevertDeviceTrial` +/// joins the one effect entry to `Updating` or `Recovering` emits, +/// `AuthenticateStageUpdate` or `RecoverComponent`: two effects in the +/// `Sink`. Stacked on a full cascade, a `Recovering` entry comes to +/// `2 * N + 2` effects, which `E` holds. +/// +/// `Rot::new` refuses to compile unless `E >= 2 * N + 2`, so a machine that +/// builds can never overflow this buffer. +pub struct Sink { + effects: heapless::Vec, +} + +impl Sink { + pub(crate) fn new() -> Self { + Self { + effects: heapless::Vec::new(), + } + } + + /// Append one effect. `E` is sized so overflow is impossible for a machine + /// that compiles: `Rot::EFFECT_CAP_OK` proves `E >= 2 * N + 2` and no + /// handler emits more than `2 * N + 2` effects into one `Sink`, so the push + /// below can never fail. A `cfg(test)` assert catches a stale derivation + /// in the test suite; in the release binary the push is unchecked + /// (fail-secure: fewer effects means more lockdown, never less). + /// + /// The driver runs the effects from one handler in the order they were + /// emitted, and it does not run them as a single all-or-nothing group: if + /// one effect fails, the ones before it have already happened. When an + /// effect fails, the driver stops there, it skips the rest and injects + /// `EffectFailed` so the machine locks down. Stopping partway is still safe + /// no matter what order the effects were in: a component is only ever + /// released after it has passed verification, and every other effect either + /// tightens things (holds a component in reset, or latches lockdown) or just + /// reports what happened. So a batch that stops early can only leave the + /// platform more locked down, never less. A skipped report costs information, + /// not containment, and the batch was cut short by a failure that latches + /// lockdown anyway, which is the louder signal. + pub fn emit(&mut self, effect: Effect) { + let ok = self.effects.push(effect).is_ok(); + // Compile-time proof (EFFECT_CAP_OK) makes this unreachable; the + // cfg(test) assert catches a stale derivation during testing. + // debug_assert covers non-Bazel builds where debug_assertions is on. + debug_assert!( + ok, + "Sink overflowed E={E}, EFFECT_CAP_OK derivation is stale" + ); + #[cfg(test)] + assert!( + ok, + "Sink overflowed E={E}, EFFECT_CAP_OK derivation is stale" + ); + } + + pub fn effects(&self) -> &[Effect] { + &self.effects + } +} diff --git a/services/orchestrator/sm/src/status.rs b/services/orchestrator/sm/src/status.rs new file mode 100644 index 000000000..a2c4643cf --- /dev/null +++ b/services/orchestrator/sm/src/status.rs @@ -0,0 +1,74 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +/// Outcome of [`Rot::gate_by_policy`]: whether a component was gated out of +/// service. Collapses the three [`FailurePolicy`] values into the two +/// control-flow outcomes the caller actually branches on — so the +/// runtime-corruption path and the recovery-exhaustion path decide on the same +/// result. +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub(crate) enum Gating { + /// The component was gated (`Isolable` → itself; `Cascading` → itself and + /// its transitive dependents). Its reset is asserted and the walk skips it. + Gated, + /// Not a gating policy (`Required`, or an unknown/missing id). Nothing was + /// gated; the caller handles this in its own context — recover (at runtime) + /// or lock down (once recovery is exhausted). + NotGated, +} + +/// Per-component service lifecycle. Each chain component carries one of these +/// inside its [`ComponentStatus`], recording whether it is in normal service or +/// gated out. The walk-phase payloads (`AwaitingReady`/`Recovering`) stay on the +/// global [`State`] rather than here — those phases are properties of the whole +/// machine, not of one component. Named for the *component service* axis to keep +/// it distinct from orchestrator-capabilities's trial-boot/commit (update-slot) +/// lifecycle, which +/// is a separate concern. +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub(crate) enum ComponentLifecycle { + /// In the normal flow: held, under verification, or released. The global + /// `State` carries which of those the walk is in. + Nominal, + /// Durably gated out of service: has a live `AssertReset` and is skipped on + /// every chain walk. + Isolated, +} + +/// One per-component record (see [`Rot::statuses`]). +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub(crate) struct ComponentStatus { + pub(crate) lifecycle: ComponentLifecycle, + /// Consecutive failed-restore count (INV7: consecutive only). + pub(crate) retry: u8, + /// Set while this component has been released from reset but has not yet + /// reported its boot-progress signal ([`Event::ComponentReady`] for an + /// `Active` component, [`Event::Booted`] for a `Passive` one). The platform driver + /// arms a per-component watchdog on release; this bit is what a later + /// [`Event::Timeout`] consults to tell a real boot failure from a stale or + /// spurious timeout. Orthogonal to `lifecycle`: a gated component owes no + /// boot-progress signal, so gating clears it. + pub(crate) awaiting_boot: bool, + /// Set while this component has been released from reset and not since held + /// again — i.e. it is *live*, executing code. Set at every `ReleaseReset`, + /// cleared at every `AssertReset` (gating, recovery, or the pre-walk + /// quiesce). This is what makes recovery a genuine platform re-boot: on + /// re-entering [`State::PreSupervision`] the machine asserts reset on every + /// live component before re-verifying, so `VerifyFirmware` never runs + /// against code that is still executing (a live check says nothing about + /// what is running and is open to a post-check flash rewrite). Distinct from + /// `awaiting_boot`, which is cleared once the component reports in but stays + /// live: a booted component is `released` yet no longer `awaiting_boot`. + pub(crate) released: bool, +} + +impl Default for ComponentStatus { + fn default() -> Self { + Self { + lifecycle: ComponentLifecycle::Nominal, + retry: 0, + awaiting_boot: false, + released: false, + } + } +} diff --git a/services/orchestrator/sm/src/tests.rs b/services/orchestrator/sm/src/tests.rs index 2eab2a71e..8f54dc21a 100644 --- a/services/orchestrator/sm/src/tests.rs +++ b/services/orchestrator/sm/src/tests.rs @@ -35,6 +35,30 @@ fn passive_required(ids: &[ComponentId]) -> heapless::Vec<(ComponentId, Componen ) } +/// A chain with the eRoT at position 0, where `chain_of` puts it, and the +/// given ids passive behind it. `erot_id` finds the eRoT by its +/// `ComponentKind::Erot`, and a chain of plain passive entries has none, +/// so the SVN floor advance that `ConfirmSelfTrial` marks outstanding +/// stays unset and `Effect::CommitSvnFloor` is never emitted. +/// +/// This chain and `passive_required`'s reach the state machine through +/// `Chain::try_from`, which checks ids and dependencies but not the kind. +/// A board builds its table with `chain_of` in a static instead, and its +/// const assert rejects a table that does not start with the eRoT, so +/// such a table fails to compile. Every board does it that way, the QEMU +/// scenarios included. +fn erot_then_passive( + ids: &[ComponentId], +) -> heapless::Vec<(ComponentId, ComponentAttrs), CAPACITY> { + let mut entries = std::vec::Vec::new(); + entries.push((C0, ComponentAttrs::erot())); + entries.extend( + ids.iter() + .map(|&id| (id, ComponentAttrs::passive_required())), + ); + chain(&entries) +} + struct Recorder { recorded: Vec, } @@ -135,12 +159,12 @@ fn attestation_shared_across_supervising_platform_states() { &[ BOOT, Event::VerificationPassed(C0), - Event::UpdateRequest, + Event::UpdateRequest(C0), Event::AttestationChallenge, ], ); assert_eq!(effects.last(), Some(&Effect::SignAttestation)); - assert_eq!(state, State::Updating); + assert_eq!(state, State::Updating(C0)); } /// INV4: a rejected update rolls back via DiscardStaged and never enters @@ -152,21 +176,101 @@ fn update_rollback_is_not_recovery() { &[ BOOT, Event::VerificationPassed(C0), - Event::UpdateRequest, + Event::UpdateRequest(C0), Event::UpdateRejected, ], ); - let tail = &effects[effects.len() - 3..]; + let tail = &effects[effects.len() - 2..]; assert_eq!( tail, + &[Effect::AuthenticateStageUpdate, Effect::DiscardStaged], + ); + assert_eq!(state, State::Ready); + assert!(!effects.contains(&Effect::LatchLockdown)); +} + +/// A withdrawn update disposes of what was staged and leaves the platform +/// supervising, the same ending a rejection has. +#[test] +fn a_cancelled_update_discards_the_staged_image() { + let (effects, state) = drive( + passive_required(&[C0]), &[ - Effect::AuthenticateUpdate, - Effect::StageUpdate, - Effect::DiscardStaged + BOOT, + Event::VerificationPassed(C0), + Event::UpdateRequest(C0), + Event::UpdateCancelled, ], ); + let tail = &effects[effects.len() - 2..]; + assert_eq!( + tail, + &[Effect::AuthenticateStageUpdate, Effect::DiscardStaged], + ); + assert_eq!(state, State::Ready); +} + +/// A withdrawal is not a verdict on the image and the requester ended the +/// update, so the state machine reports nothing. A recovery that preempts the +/// update also discards the staged image, but there the requester did not end +/// it, so the preemption emits `ReportUpdateAborted`. +#[test] +fn a_cancelled_update_is_not_reported() { + let (effects, _) = drive( + passive_required(&[C0]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::UpdateRequest(C0), + Event::UpdateCancelled, + ], + ); + assert!(!effects.contains(&Effect::ReportUpdateAborted)); + assert!(!effects.contains(&Effect::ReportUpdateDeferred)); +} + +/// A locked platform stays locked and stays silent. `Locked` is inert by +/// design, and a new event is the usual way that stops being true. +#[test] +fn a_cancel_cannot_disturb_a_locked_platform() { + let (effects, state) = drive( + passive_required(&[C0]), + &[ + BOOT, + Event::VerificationFailed(C0), + Event::RecoveryUnavailable(C0), + ], + ); + assert_eq!(state, State::Locked, "the fixture did not lock"); + + let (after, locked_after) = drive( + passive_required(&[C0]), + &[ + BOOT, + Event::VerificationFailed(C0), + Event::RecoveryUnavailable(C0), + Event::UpdateCancelled, + ], + ); + assert_eq!(after, effects); + assert_eq!(locked_after, State::Locked); +} + +/// A cancel with no update in flight is dropped. Nothing staged, nothing +/// to dispose of, and no state worth changing. +#[test] +fn a_cancel_with_no_update_in_flight_changes_nothing() { + let (settled, settled_state) = drive( + passive_required(&[C0]), + &[BOOT, Event::VerificationPassed(C0)], + ); + let (effects, state) = drive( + passive_required(&[C0]), + &[BOOT, Event::VerificationPassed(C0), Event::UpdateCancelled], + ); + assert_eq!(effects, settled); + assert_eq!(state, settled_state); assert_eq!(state, State::Ready); - assert!(!effects.contains(&Effect::LatchLockdown)); } /// INV5: runtime corruption targets the named component and re-walks from @@ -191,13 +295,13 @@ fn runtime_corruption_targets_component_and_rewalks() { assert_eq!(state, State::PreSupervision); } -/// Recovery is a full platform re-boot: a live sibling is held in reset before -/// the re-walk re-verifies, so `VerifyFirmware` never runs against executing -/// code. Here C0 and C1 both boot and go live; C0 is then corrupted and -/// restored. The re-walk must `AssertReset(C1)` (quiesce the live sibling) -/// before it re-reads and re-verifies C0 from a fully-held state. +/// Recovery is a full platform re-boot: every other live component is held +/// in reset before the re-walk re-verifies, so `VerifyFirmware` never runs +/// against executing code. Here C0 and C1 both boot and go live; C0 is then +/// corrupted and restored. The re-walk must `AssertReset(C1)` (quiesce the +/// live C1) before it re-reads and re-verifies C0 from a fully-held state. #[test] -fn recovery_rewalk_quiesces_live_siblings_first() { +fn recovery_rewalk_quiesces_live_components_first() { let (effects, state) = drive( passive_required(&[C0, C1]), &[ @@ -208,7 +312,7 @@ fn recovery_rewalk_quiesces_live_siblings_first() { Event::Restored(C0), // re-walk: quiesce C1, then re-verify C0 ], ); - // The re-walk holds the live sibling before any re-verification. + // The re-walk holds live C1 before any re-verification. let tail = &effects[effects.len() - 3..]; assert_eq!( tail, @@ -222,10 +326,10 @@ fn recovery_rewalk_quiesces_live_siblings_first() { } /// `quiesce_all` holds *every* live component, not just the immediate -/// neighbor: with three live parts, recovering one asserts reset on both -/// siblings before the re-walk re-verifies anything. +/// neighbor: with three live parts, recovering one asserts reset on the +/// other two before the re-walk re-verifies anything. #[test] -fn recovery_rewalk_quiesces_all_live_siblings() { +fn recovery_rewalk_quiesces_all_live_components() { let (effects, state) = drive( passive_required(&[C0, C1, C2]), &[ @@ -237,7 +341,8 @@ fn recovery_rewalk_quiesces_all_live_siblings() { Event::Restored(C0), // re-walk: quiesce C1 and C2 first ], ); - // Both live siblings are held before the re-walk re-reads the chain. + // Both other live components are held before the re-walk re-reads the + // chain. let rewalk_read = effects .iter() .rposition(|e| *e == Effect::ReadFirmware(C0)) @@ -255,13 +360,13 @@ fn recovery_rewalk_quiesces_all_live_siblings() { assert_eq!(state, State::PreSupervision); } -/// The TOCTOU closure: a live sibling is not trusted across a recovery on +/// The TOCTOU closure: a live component is not trusted across a recovery on /// its old pass. The re-walk holds it (`AssertReset`), re-verifies it from /// that held state (`ReadFirmware`/`VerifyFirmware`), and only then releases -/// it again — so the sibling is verified twice and released twice, with the +/// it again: the component is verified twice and released twice, with the /// hold in between. #[test] -fn recovery_rewalk_reverifies_live_sibling_at_rest() { +fn recovery_rewalk_reverifies_live_component_at_rest() { let (effects, state) = drive( passive_required(&[C0, C1]), &[ @@ -299,13 +404,9 @@ fn recovery_rewalk_reverifies_live_sibling_at_rest() { /// `PreSupervision` reacts to `CorruptionDetected` directly (via /// [`Rot::handle_corruption`]), even though it isn't linked to -/// `SupervisingPlatform` (so `AttestationChallenge` is still discarded -/// there — a separate question). CSA defines no mechanism guaranteeing a -/// corruption report exists for an already-released component's *live, -/// executing* state (at-rest/NVM-polling is scoped to "at -/// rest"/"between boots", not an in-progress boot's chain walk) — but -/// that only means such a report isn't guaranteed to arrive, not that one -/// should be ignored if it does. +/// `SupervisingPlatform`, so `AttestationChallenge` is still discarded +/// there, a separate question. Why such a report may never arrive at all +/// is on [`Rot::handle_supervising`]; this test drives one that does. #[test] fn corruption_during_presupervision_selfloop_triggers_recovery() { let (effects, state) = drive( @@ -567,6 +668,175 @@ fn timeout_stale_id_ignored() { assert!(!effects.contains(&Effect::RecoverComponent { id: C1, attempt: 0 })); } +/// A retriable `BootFailed` for the awaited component enters recovery, +/// same as `Timeout`. +#[test] +fn boot_failed_retriable_enters_recovering() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::active_required()), + (C1, ComponentAttrs::passive_required()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::BootFailed { + id: C0, + checkpoint: "heartbeat", + kind: BootFailureKind::DeviceRetriable, + }, + ], + ); + assert_eq!(state, State::Recovering(C0)); + assert!(effects.contains(&Effect::RecoverComponent { id: C0, attempt: 0 })); + assert!(effects.contains(&Effect::ReportBootFailed { + id: C0, + checkpoint: "heartbeat", + kind: BootFailureKind::DeviceRetriable, + })); +} + +/// A fatal `BootFailed` for an `Isolable` component gates it immediately +/// with no recovery attempt. +#[test] +fn boot_failed_fatal_isolable_gates_without_recovery() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::active_isolable()), + (C1, ComponentAttrs::passive_required()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::BootFailed { + id: C0, + checkpoint: "bl1", + kind: BootFailureKind::DeviceFatal, + }, + ], + ); + assert_eq!(state, State::AwaitingReady(Some(C0))); + assert!(!effects.contains(&Effect::RecoverComponent { id: C0, attempt: 0 })); + assert!(effects.contains(&Effect::AssertReset(C0))); + assert!(effects.contains(&Effect::ReportIsolated(C0))); + assert!(effects.contains(&Effect::ReportBootFailed { + id: C0, + checkpoint: "bl1", + kind: BootFailureKind::DeviceFatal, + })); +} + +/// A fatal `BootFailed` for a `Required` component still enters recovery +/// (the device said "this image is bad" but a different recovery source +/// could help). +#[test] +fn boot_failed_fatal_required_still_recovers() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::active_required()), + (C1, ComponentAttrs::passive_required()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::BootFailed { + id: C0, + checkpoint: "bl1", + kind: BootFailureKind::DeviceFatal, + }, + ], + ); + assert_eq!(state, State::Recovering(C0)); + assert!(effects.contains(&Effect::RecoverComponent { id: C0, attempt: 0 })); +} + +/// A `BootFailed` for a component not awaiting boot is stale and dropped. +#[test] +fn boot_failed_stale_id_ignored() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::active_required()), + (C1, ComponentAttrs::passive_required()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::BootFailed { + id: C1, + checkpoint: "self-test", + kind: BootFailureKind::DeviceFatal, + }, + ], + ); + assert_eq!(state, State::AwaitingReady(Some(C0))); + assert!(!effects.contains(&Effect::RecoverComponent { id: C1, attempt: 0 })); +} + +/// A fatal `BootFailed` in `PreSupervision` for a speculatively released +/// passive isolable component gates it and advances the cursor past it, +/// same as `CorruptionDetected`. +#[test] +fn boot_failed_fatal_in_pre_supervision_gates_passive() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::passive_isolable()), + (C1, ComponentAttrs::passive_required()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::BootFailed { + id: C0, + checkpoint: "self-test", + kind: BootFailureKind::DeviceFatal, + }, + Event::VerificationPassed(C1), + ], + ); + assert_eq!(state, State::Ready); + assert!(effects.contains(&Effect::AssertReset(C0))); + assert!(effects.contains(&Effect::ReportIsolated(C0))); + assert!(effects.contains(&Effect::ReportBootFailed { + id: C0, + checkpoint: "self-test", + kind: BootFailureKind::DeviceFatal, + })); + assert!(!effects.contains(&Effect::RecoverComponent { id: C0, attempt: 0 })); +} + +/// A fatal `BootFailed` in `Ready` for a passive isolable component that +/// was released speculatively and still owes a boot signal: gates it +/// without recovery and stays `Ready`. +#[test] +fn boot_failed_fatal_in_ready_gates_passive() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::passive_isolable()), + (C1, ComponentAttrs::passive_required()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + // Both released; machine is Ready with C0/C1 still awaiting boot. + Event::BootFailed { + id: C0, + checkpoint: "pcie-link", + kind: BootFailureKind::DeviceFatal, + }, + ], + ); + assert_eq!(state, State::Ready); + assert!(effects.contains(&Effect::AssertReset(C0))); + assert!(effects.contains(&Effect::ReportIsolated(C0))); + assert!(effects.contains(&Effect::ReportBootFailed { + id: C0, + checkpoint: "pcie-link", + kind: BootFailureKind::DeviceFatal, + })); + assert!(!effects.contains(&Effect::RecoverComponent { id: C0, attempt: 0 })); +} + /// An out-of-chain id in a `VerificationFailed` report is dropped: the core /// supervises only chain components, so a verdict for an id the chain does not /// contain neither enters `Recovering` nor emits `RecoverComponent`. @@ -602,8 +872,8 @@ fn corruption_out_of_chain_id_is_dropped() { /// Device-agnostic boot-progress: a *passive* component that is released but /// never reports [`Event::Booted`] before its watchdog fires is recovered like /// any other boot failure — even while the walk is still in `PreSupervision`. -/// This closes the release-and-forget gap (CSA boot-progress checkpointing is -/// device-agnostic; the orchestrator arms a `boot_timeout` for every device). +/// This closes the release-and-forget gap: the orchestrator arms a +/// `boot_timeout` for every released device, iRoT or not. #[test] fn passive_boot_timeout_enters_recovering() { let (effects, state) = drive( @@ -887,10 +1157,10 @@ fn cascading_runtime_corruption_cascades() { assert!(!effects.contains(&Effect::LatchLockdown)); } -/// Degraded mode (CSA): isolating a component is only half the requirement — -/// the failure must also be *reported* through the platform management -/// interface. An `Isolable` component that exhausts recovery emits -/// `ReportIsolated` alongside its `AssertReset`, and the platform keeps running. +/// Degraded mode: isolating a component is only half of it, management +/// software also has to hear that the component is down. An `Isolable` +/// component that exhausts recovery emits `ReportIsolated` alongside its +/// `AssertReset`, and the platform keeps running. #[test] fn isolable_exhaustion_reports_isolation() { let mut script = std::vec![BOOT, Event::VerificationPassed(C0)]; @@ -979,274 +1249,1185 @@ fn cascading_runtime_corruption_cascades_transitively() { assert!(!effects.contains(&Effect::LatchLockdown)); } -/// Runtime corruption under a non-`Required` policy reports too. This path -/// never enters recovery at all, so without its own report the isolation would -/// be silent. +/// A cascade that fires mid-walk gates components the cursor has not reached +/// yet, and the walk then skips them: corruption of C1 arrives while the walk +/// is still verifying C0, so C1 -> C2 -> C3 are all gated before their turn. +/// No `ReadFirmware` is ever emitted for them, and the walk reaches the end of +/// the chain and goes to `Ready`. The post-walk cascade tests cannot cover this: +/// there the cursor is already past every component when the cascade fires. #[test] -fn runtime_corruption_isolable_reports() { +fn mid_walk_cascade_skips_unreached_dependents() { let (effects, state) = drive( chain(&[ (C0, ComponentAttrs::passive_required()), - (C1, ComponentAttrs::passive_isolable()), + (C1, ComponentAttrs::passive_cascading()), + (C2, ComponentAttrs::passive_required().with_depends_on(C1)), + (C3, ComponentAttrs::passive_required().with_depends_on(C2)), ]), &[ - BOOT, - Event::VerificationPassed(C0), - Event::VerificationPassed(C1), - Event::CorruptionDetected(C1), + BOOT, // walk starts at C0 + Event::CorruptionDetected(C1), // cascade C1 -> C2 -> C3, cursor still on C0 + Event::VerificationPassed(C0), // advance: nothing ungated is left ], ); + // The rest of the chain is gated, so the walk is done. assert_eq!(state, State::Ready); - assert!(effects.contains(&Effect::ReportIsolated(C1))); - assert!(!effects.contains(&Effect::RecoverComponent { id: C1, attempt: 0 })); + // The whole two-hop chain is isolated and reported, though the walk never + // reached any of it. + for id in [C1, C2, C3] { + assert!(effects.contains(&Effect::AssertReset(id))); + assert!(effects.contains(&Effect::ReportIsolated(id))); + } + // Verification is never requested for a gated component, at any depth. + for id in [C1, C2, C3] { + assert!(!effects.contains(&Effect::ReadFirmware(id))); + assert!(!effects.contains(&Effect::VerifyFirmware(id))); + assert!(!effects.contains(&Effect::ReleaseReset(id))); + } + // C0 is untouched by the cascade: it verifies and is released as usual. + assert!(effects.contains(&Effect::ReleaseReset(C0))); + assert!(!effects.contains(&Effect::AssertReset(C0))); } -/// A `Required` component whose recovery is exhausted is named in a -/// `ReportRecoveryFailed` *before* the platform latches, so management software -/// learns which component forced the halt rather than just that one did. +/// Corruption during recovery gates and stops there. `Recovering`'s cursor is +/// stale, so advancing it would verify C2 mid-recovery, or end the walk at +/// `Ready` and skip the re-walk recovery exists to run. #[test] -fn required_exhaustion_reports_before_lockdown() { - let mut script = std::vec![BOOT, Event::VerificationPassed(C0)]; - script.push(Event::CorruptionDetected(C0)); - for _ in 0..(MAX_RETRY - 1) { - script.push(Event::Restored(C0)); - script.push(Event::VerificationFailed(C0)); - } - script.push(Event::Restored(C0)); - - let (effects, state) = drive(passive_required(&[C0]), &script); - - assert_eq!(state, State::Locked); - let report = effects - .iter() - .position(|e| *e == Effect::ReportRecoveryFailed(C0)) - .expect("the component that forced the halt is reported"); - let latch = effects - .iter() - .position(|e| *e == Effect::LatchLockdown) - .expect("the platform latches"); - assert!( - report < latch, - "the report must be actuated before the latch", +fn corruption_during_recovery_does_not_advance_the_walk() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::passive_cascading()), + (C1, ComponentAttrs::passive_required().with_depends_on(C0)), + (C2, ComponentAttrs::passive_required()), + ]), + &[ + BOOT, + Event::VerificationFailed(C0), // cursor stays on C0 + Event::CorruptionDetected(C0), // gates C0 -> C1 + ], ); + assert_eq!(state, State::Recovering(C0)); + assert!(effects.contains(&Effect::ReportIsolated(C0))); + assert!(effects.contains(&Effect::ReportIsolated(C1))); + // The walk does not resume from inside recovery. + assert!(!effects.contains(&Effect::ReadFirmware(C2))); + assert!(!effects.contains(&Effect::VerifyFirmware(C2))); } -/// A component that recovers within its retry budget is not degraded, so -/// nothing is reported — reports mark components taken *out of service*, not -/// every transient failure. +/// A cascade during `AwaitingReady` gates the component under verification, so +/// the walk moves on to C3. C1's in-flight verdict no longer matches the cursor +/// and is dropped, leaving C1 in reset. `awaiting` survives the `Handled`. #[test] -fn successful_recovery_emits_no_isolation_report() { +fn mid_walk_cascade_in_awaiting_ready_drops_late_verdict() { let (effects, state) = drive( - passive_required(&[C0]), + chain(&[ + (C0, ComponentAttrs::active_required()), + (C1, ComponentAttrs::passive_cascading()), + (C2, ComponentAttrs::passive_required().with_depends_on(C1)), + (C3, ComponentAttrs::passive_required()), + ]), &[ BOOT, - Event::VerificationFailed(C0), - Event::Restored(C0), - Event::VerificationPassed(C0), + Event::VerificationPassed(C0), // releases C0, cursor on C1 + Event::CorruptionDetected(C1), // gates C1 -> C2, cursor moves to C3 + Event::VerificationPassed(C1), // in flight before the gating ], ); - assert_eq!(state, State::Ready); - assert!(effects.contains(&Effect::RecoverComponent { id: C0, attempt: 0 })); - assert!( - !effects.iter().any(|e| matches!( - e, - Effect::ReportIsolated(_) | Effect::ReportRecoveryFailed(_) - )), - "a recovered component is not degraded", + // Still awaiting C0's readiness: the cursor moved, the payload is + // unchanged. + assert_eq!(state, State::AwaitingReady(Some(C0))); + for id in [C1, C2] { + assert!(effects.contains(&Effect::ReportIsolated(id))); + assert!(!effects.contains(&Effect::ReleaseReset(id))); + } + assert!(effects.contains(&Effect::ReadFirmware(C3))); + assert!(effects.contains(&Effect::VerifyFirmware(C3))); +} + +/// A component gated while it is under verification is never released by its +/// own in-flight verdict. Release keys off `chain[cursor]` alone, so leaving +/// the cursor on a component the cascade just isolated would take it out of +/// reset. The cursor moves past it instead and the walk continues to C2. +#[test] +fn gating_the_component_under_verification_never_releases_it() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::passive_cascading()), + (C1, ComponentAttrs::passive_required().with_depends_on(C0)), + (C2, ComponentAttrs::passive_required()), + ]), + &[ + BOOT, // cursor on C0, awaiting its verdict + Event::CorruptionDetected(C0), // gates C0 and C1, cursor moves to C2 + Event::VerificationPassed(C0), // in flight before the gating: must not release + Event::VerificationPassed(C2), + ], ); + assert_eq!(state, State::Ready); + // Both are gated and reported before the cursor moves. + assert!(effects.contains(&Effect::ReportIsolated(C0))); + assert!(effects.contains(&Effect::ReportIsolated(C1))); + // Neither isolated component is taken out of reset. + assert!(!effects.contains(&Effect::ReleaseReset(C0))); + assert!(!effects.contains(&Effect::ReleaseReset(C1))); + // The walk continues past them instead of stalling on C0's verdict. + assert!(effects.contains(&Effect::ReadFirmware(C2))); + assert!(effects.contains(&Effect::ReleaseReset(C2))); + assert!(!effects.contains(&Effect::ReadFirmware(C1))); } -/// Reporting is guarded by `is_gated` exactly like the reset it accompanies, so -/// a repeated corruption report on an already-isolated component does not -/// re-report it. Management software sees one isolation event per component. +/// The same gating with the rest of the chain gated too: the walk has no +/// component to move on to, so it ends in `Ready` with everything held in +/// reset. A non-`Required` cascade never escalates to lockdown. #[test] -fn report_isolated_emitted_once_per_component() { +fn gating_the_last_ungated_component_ends_the_walk() { let (effects, state) = drive( chain(&[ - (C0, ComponentAttrs::passive_required()), - (C1, ComponentAttrs::passive_isolable()), + (C0, ComponentAttrs::passive_cascading()), + (C1, ComponentAttrs::passive_required().with_depends_on(C0)), ]), &[ BOOT, - Event::VerificationPassed(C0), - Event::VerificationPassed(C1), - Event::CorruptionDetected(C1), // isolable → gate + report - Event::CorruptionDetected(C1), // already gated → nothing + Event::CorruptionDetected(C0), // gates the whole chain + Event::VerificationPassed(C0), // in flight before the gating ], ); assert_eq!(state, State::Ready); - assert_eq!( - effects - .iter() - .filter(|e| **e == Effect::ReportIsolated(C1)) + assert!(!effects.contains(&Effect::ReleaseReset(C0))); + assert!(!effects.contains(&Effect::ReleaseReset(C1))); + assert!(!effects.contains(&Effect::ReadFirmware(C1))); + assert!(!effects.contains(&Effect::LatchLockdown)); +} + +/// The `AwaitingReady` analog of +/// `gating_the_last_ungated_component_ends_the_walk`: with nothing ungated left +/// to move to, the walk ends at `Ready`, the isolated pair held and no +/// lockdown. C0's `ComponentReady` never arrives; the walk does not wait +/// for it. +#[test] +fn gating_the_rest_of_the_chain_in_awaiting_ready_ends_the_walk() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::active_required()), + (C1, ComponentAttrs::passive_cascading()), + (C2, ComponentAttrs::passive_required().with_depends_on(C1)), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), // releases C0, cursor on C1 + Event::CorruptionDetected(C1), // gates C1 -> C2, nothing left ungated + Event::VerificationPassed(C1), // in flight before the gating + ], + ); + assert_eq!(state, State::Ready); + for id in [C1, C2] { + assert!(effects.contains(&Effect::ReportIsolated(id))); + assert!(!effects.contains(&Effect::ReleaseReset(id))); + } + assert!(!effects.contains(&Effect::ReadFirmware(C2))); + assert!(!effects.contains(&Effect::LatchLockdown)); +} + +/// The other half of the cursor rule: gating a component the cursor has not +/// reached does not move the cursor, so C1's verdict still releases it. An +/// unconditional cursor advance would make that verdict a mismatch and leave a +/// verified component in reset. C3 depends on C2 so the cascade has a dependent +/// to gate. +#[test] +fn cascade_in_awaiting_ready_below_the_cursor_leaves_it_alone() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::active_required()), + (C1, ComponentAttrs::passive_required()), + (C2, ComponentAttrs::passive_cascading()), + (C3, ComponentAttrs::passive_required().with_depends_on(C2)), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), // releases C0, cursor on C1 + Event::CorruptionDetected(C2), // cascade-gates C2 and C3, both below the cursor + Event::VerificationPassed(C1), // C1 is still under verification + ], + ); + assert_eq!(state, State::Ready); + // The cursor never left C1, so its verdict still counts. + assert!(effects.contains(&Effect::ReleaseReset(C1))); + // C2 and C3 are gated before their turn and the walk skips them. + for id in [C2, C3] { + assert!(effects.contains(&Effect::ReportIsolated(id))); + assert!(!effects.contains(&Effect::ReleaseReset(id))); + assert!(!effects.contains(&Effect::ReadFirmware(id))); + } +} + +/// The cascade gates the component the `AwaitingReady` slot waits on. The slot +/// keeps naming it, which changes nothing: `gate_one` cleared its +/// `awaiting_boot`, a late `ComponentReady` releases nothing, and the walk +/// reaches `Ready` when the cursor reaches the end of the chain, not when +/// C0's `ComponentReady` arrives. +#[test] +fn gating_the_awaited_component_does_not_stall_the_walk() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::active_cascading()), + (C1, ComponentAttrs::passive_required().with_depends_on(C0)), + (C2, ComponentAttrs::passive_required()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), // releases C0, awaits its readiness + Event::CorruptionDetected(C0), // gates the awaited C0 and C1 + Event::ComponentReady(C0), // in flight before the gating + Event::VerificationPassed(C1), // in flight before the gating + Event::VerificationPassed(C2), + ], + ); + assert_eq!(state, State::Ready); + // C0 was live and goes back into reset; C1 goes with it. C1 had already + // been read and verified when C0's verdict advanced the cursor, so its own + // verdict is the one that must not release it. + assert!(effects.contains(&Effect::AssertReset(C0))); + for id in [C0, C1] { + assert!(effects.contains(&Effect::ReportIsolated(id))); + } + assert!(!effects.contains(&Effect::ReleaseReset(C1))); + assert!(effects.contains(&Effect::ReadFirmware(C2))); + assert!(effects.contains(&Effect::ReleaseReset(C2))); +} + +/// A failure verdict in flight when the cascade gated the component does not +/// put it into recovery. +#[test] +fn late_verification_failed_for_gated_component_is_dropped() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::active_required()), + (C1, ComponentAttrs::passive_cascading()), + (C2, ComponentAttrs::passive_required().with_depends_on(C1)), + (C3, ComponentAttrs::passive_required()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), // releases C0, cursor on C1 + Event::CorruptionDetected(C1), // gates C1 -> C2, cursor moves to C3 + Event::VerificationFailed(C1), // in flight before the gating + ], + ); + assert_ne!(state, State::Recovering(C1), "isolated C1 entered recovery"); + assert!( + !effects.contains(&Effect::RecoverComponent { id: C1, attempt: 0 }), + "RecoverComponent fired for isolated C1" + ); +} + +/// A contained cascade does not lock the platform down through the `Required` +/// component it held. Three corruption reports for the isolated C1 would +/// otherwise exhaust its retries, and `gate_by_policy` would read C1's own +/// `Required` policy and escalate. MAX_RETRY is 3. +#[test] +fn contained_cascade_does_not_lock_down_via_its_required_dependent() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::passive_cascading()), + (C1, ComponentAttrs::passive_required().with_depends_on(C0)), + ]), + &[ + BOOT, + Event::CorruptionDetected(C0), // gates C0, cascade-holds C1 + Event::CorruptionDetected(C1), // isolated C1 into recovery, attempt 0 + Event::Restored(C1), + Event::CorruptionDetected(C1), // attempt 1 + Event::Restored(C1), + Event::CorruptionDetected(C1), // attempt 2 + Event::Restored(C1), // retries exhausted + ], + ); + assert!( + !effects.contains(&Effect::LatchLockdown), + "contained cascade reached lockdown, state {state:?}" + ); +} + +/// A corruption report for a component the cascade already isolated is +/// dropped. +#[test] +fn corruption_report_for_an_isolated_component_is_dropped() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::passive_cascading()), + (C1, ComponentAttrs::passive_required().with_depends_on(C0)), + ]), + &[ + BOOT, + Event::CorruptionDetected(C0), // gates C0, cascade-holds C1 + Event::CorruptionDetected(C1), // C1 is already isolated + ], + ); + assert!(effects.contains(&Effect::ReportIsolated(C1))); + assert_ne!(state, State::Recovering(C1), "isolated C1 entered recovery"); + assert!( + !effects.contains(&Effect::RecoverComponent { id: C1, attempt: 0 }), + "RecoverComponent fired for cascade-held C1" + ); +} + +/// A cascade reaches past a component that is already isolated. C1 is gated on +/// its own first, so the walk from C0 has to continue through it to reach C2. +/// Stopping at C1 would leave C2 out of reset with both components it depends +/// on isolated. +#[test] +fn cascade_reaches_past_an_already_isolated_component() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::passive_cascading()), + (C1, ComponentAttrs::passive_isolable().with_depends_on(C0)), + (C2, ComponentAttrs::passive_required().with_depends_on(C1)), + ]), + &[ + BOOT, + Event::CorruptionDetected(C1), // isolable: gates C1 alone + Event::CorruptionDetected(C0), // cascading: C0 -> C1 -> C2 + Event::VerificationPassed(C2), + ], + ); + assert_eq!(state, State::Ready); + for id in [C0, C1, C2] { + assert!(effects.contains(&Effect::ReportIsolated(id))); + assert!(!effects.contains(&Effect::ReleaseReset(id))); + } + // C1 is reported once, by the corruption that gated it, not again by the + // cascade passing through. + assert_eq!( + effects + .iter() + .filter(|e| **e == Effect::ReportIsolated(C1)) + .count(), + 1 + ); +} + +/// Runtime corruption under a non-`Required` policy reports too. This path +/// never enters recovery at all, so without its own report the isolation would +/// be silent. +#[test] +fn runtime_corruption_isolable_reports() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::passive_required()), + (C1, ComponentAttrs::passive_isolable()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + Event::CorruptionDetected(C1), + ], + ); + assert_eq!(state, State::Ready); + assert!(effects.contains(&Effect::ReportIsolated(C1))); + assert!(!effects.contains(&Effect::RecoverComponent { id: C1, attempt: 0 })); +} + +/// A `Required` component whose recovery is exhausted is named in a +/// `ReportRecoveryFailed` *before* the platform latches, so management software +/// learns which component forced the halt rather than just that one did. +#[test] +fn required_exhaustion_reports_before_lockdown() { + let mut script = std::vec![BOOT, Event::VerificationPassed(C0)]; + script.push(Event::CorruptionDetected(C0)); + for _ in 0..(MAX_RETRY - 1) { + script.push(Event::Restored(C0)); + script.push(Event::VerificationFailed(C0)); + } + script.push(Event::Restored(C0)); + + let (effects, state) = drive(passive_required(&[C0]), &script); + + assert_eq!(state, State::Locked); + let report = effects + .iter() + .position(|e| *e == Effect::ReportRecoveryFailed(C0)) + .expect("the component that forced the halt is reported"); + let latch = effects + .iter() + .position(|e| *e == Effect::LatchLockdown) + .expect("the platform latches"); + assert!( + report < latch, + "the report must be actuated before the latch", + ); +} + +/// Platform-signaled recovery exhaustion (`RecoveryUnavailable`) short-circuits +/// the retry cap: a single event, not `MAX_RETRY` cycles, is enough for an +/// `Isolable` component to be gated and skipped. +#[test] +fn isolable_recovery_unavailable_skips() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::passive_required()), + (C1, ComponentAttrs::passive_isolable()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::VerificationFailed(C1), // → Recovering(C1) + Event::RecoveryUnavailable(C1), // platform: no image left + Event::VerificationPassed(C0), // re-walk from top + ], + ); + assert_eq!(state, State::Ready); + assert!(effects.contains(&Effect::RecoverComponent { id: C1, attempt: 0 })); + assert!(effects.contains(&Effect::AssertReset(C1))); + assert!(effects.contains(&Effect::ReportIsolated(C1))); + assert!(!effects.contains(&Effect::ReleaseReset(C1))); // never released + assert!(!effects.contains(&Effect::LatchLockdown)); // NOT a lockdown +} + +/// Platform-signaled recovery exhaustion on a `Required` component reports it +/// then latches `Locked` — no lockdown-avoidance policy applies to `Required`. +#[test] +fn required_recovery_unavailable_locks() { + let (effects, state) = drive( + passive_required(&[C0]), + &[ + BOOT, + Event::VerificationFailed(C0), // → Recovering(C0) + Event::RecoveryUnavailable(C0), + ], + ); + assert_eq!(state, State::Locked); + assert!(effects.contains(&Effect::ReportRecoveryFailed(C0))); + assert!(effects.contains(&Effect::LatchLockdown)); +} + +/// A `Cascading` root that goes `RecoveryUnavailable` gates itself and its +/// transitive dependents, exactly like count-driven cascade exhaustion. +#[test] +fn cascading_recovery_unavailable_cascades() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::passive_required()), + (C1, ComponentAttrs::passive_cascading()), + (C2, ComponentAttrs::passive_required().with_depends_on(C1)), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::VerificationFailed(C1), // → Recovering(C1) + Event::RecoveryUnavailable(C1), + Event::VerificationPassed(C0), // re-walk from top + ], + ); + assert_eq!(state, State::Ready); + assert!(effects.contains(&Effect::AssertReset(C1))); + assert!(effects.contains(&Effect::AssertReset(C2))); + assert!(effects.contains(&Effect::ReportIsolated(C1))); + assert!(effects.contains(&Effect::ReportIsolated(C2))); + assert!(!effects.contains(&Effect::LatchLockdown)); +} + +/// `RecoveryUnavailable` is authoritative and immediate: it exhausts recovery +/// on the first event regardless of how high `max_retry` is, and never +/// consults (or bumps) the retry count. +#[test] +fn recovery_unavailable_short_circuits_retry_budget() { + let mut c = heapless::Vec::<(ComponentId, ComponentAttrs), CAPACITY>::new(); + c.push((C0, ComponentAttrs::passive_isolable())) + .expect("fits"); + c.push((C1, ComponentAttrs::passive_required())) + .expect("fits"); + let mut orch = Orchestrator::::new(c.try_into().expect("valid chain"), u8::MAX); + let mut effects = Vec::new(); + for ev in [ + BOOT, + Event::VerificationFailed(C0), // → Recovering(C0) + Event::RecoveryUnavailable(C0), + Event::VerificationPassed(C1), // re-walk skips gated C0, reaches Ready + ] { + orch.dispatch_with(ev, |e| { + effects.push(e); + Ok(None) + }); + } + assert_eq!(orch.state(), State::Ready); + assert_eq!( + effects + .iter() + .filter(|e| matches!(e, Effect::RecoverComponent { .. })) + .count(), + 1, + "exactly one recovery attempt before exhaustion", + ); + assert!(effects.contains(&Effect::AssertReset(C0))); +} + +/// A `RecoveryUnavailable` for a component other than the one currently under +/// recovery is dropped — same guard `Restored` already gets. +#[test] +fn recovery_unavailable_other_component_dropped() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::passive_required()), + (C1, ComponentAttrs::passive_isolable()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::VerificationFailed(C1), // → Recovering(C1) + Event::RecoveryUnavailable(C0), // wrong target: dropped + ], + ); + assert_eq!(state, State::Recovering(C1)); + assert!(!effects.contains(&Effect::AssertReset(C1))); + assert!(!effects.contains(&Effect::ReportIsolated(C1))); +} + +/// A `RecoveryUnavailable` for an id outside the chain is dropped at the +/// dispatch boundary, before any handler sees it. +#[test] +fn recovery_unavailable_off_chain_dropped() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::passive_required()), + (C1, ComponentAttrs::passive_isolable()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::VerificationFailed(C1), // → Recovering(C1) + Event::RecoveryUnavailable(C2), // C2 is not in this chain + ], + ); + assert_eq!(state, State::Recovering(C1)); + assert!(!effects.contains(&Effect::AssertReset(C1))); +} + +/// A component that recovers within its retry budget is not degraded, so +/// nothing is reported — reports mark components taken *out of service*, not +/// every transient failure. +#[test] +fn successful_recovery_emits_no_isolation_report() { + let (effects, state) = drive( + passive_required(&[C0]), + &[ + BOOT, + Event::VerificationFailed(C0), + Event::Restored(C0), + Event::VerificationPassed(C0), + ], + ); + assert_eq!(state, State::Ready); + assert!(effects.contains(&Effect::RecoverComponent { id: C0, attempt: 0 })); + assert!( + !effects.iter().any(|e| matches!( + e, + Effect::ReportIsolated(_) | Effect::ReportRecoveryFailed(_) + )), + "a recovered component is not degraded", + ); +} + +/// Reporting is guarded by `is_gated` exactly like the reset it accompanies, so +/// a repeated corruption report on an already-isolated component does not +/// re-report it. Management software sees one isolation event per component. +#[test] +fn report_isolated_emitted_once_per_component() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::passive_required()), + (C1, ComponentAttrs::passive_isolable()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + Event::CorruptionDetected(C1), // isolable → gate + report + Event::CorruptionDetected(C1), // already gated → nothing + ], + ); + assert_eq!(state, State::Ready); + assert_eq!( + effects + .iter() + .filter(|e| **e == Effect::ReportIsolated(C1)) + .count(), + 1, + ); + assert_eq!( + effects + .iter() + .filter(|e| **e == Effect::AssertReset(C1)) + .count(), + 1, + ); +} + +/// Boot-time VerificationFailed on a required component → Recovering. +/// (Distinct from CorruptionDetected: this is a failed eRoT-side check +/// before the component is ever released from reset.) +#[test] +fn boot_failure_required_enters_recovering() { + let (effects, state) = drive( + passive_required(&[C0, C1]), + &[BOOT, Event::VerificationFailed(C0)], + ); + assert_eq!(state, State::Recovering(C0)); + assert!(effects.contains(&Effect::RecoverComponent { id: C0, attempt: 0 })); + // Component must never be released when its eRoT check failed. + assert!(!effects.contains(&Effect::ReleaseReset(C0))); +} + +/// Full boot-failure recovery cycle: VerificationFailed → Recovering → +/// Restored → re-walk from top → VerificationPassed → Ready. +#[test] +fn boot_failure_recovery_cycle_completes() { + let (effects, state) = drive( + passive_required(&[C0]), + &[ + BOOT, + Event::VerificationFailed(C0), + Event::Restored(C0), + Event::VerificationPassed(C0), + ], + ); + assert_eq!(state, State::Ready); + assert!(effects.contains(&Effect::RecoverComponent { id: C0, attempt: 0 })); + // ReleaseReset only after the recovery re-walk passes. + assert!(effects.contains(&Effect::ReleaseReset(C0))); +} + +/// VerificationFailed (required) on a speculative check while the machine +/// is in AwaitingReady → enters Recovering without releasing the component. +#[test] +fn required_failure_in_awaiting_ready_enters_recovering() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::active_required()), + (C1, ComponentAttrs::passive_required()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), // → AwaitingReady; spec check of C1 starts + Event::VerificationFailed(C1), // required → Recovering + ], + ); + assert_eq!(state, State::Recovering(C1)); + assert!(effects.contains(&Effect::RecoverComponent { id: C1, attempt: 0 })); + assert!(!effects.contains(&Effect::ReleaseReset(C1))); +} + +/// CorruptionDetected while in AwaitingReady (required component) → +/// Recovering. A `Required` corruption gates nothing, so the cursor-advancing +/// arm returns the transition unchanged. +#[test] +fn corruption_in_awaiting_ready_triggers_recovery() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::active_required()), + (C1, ComponentAttrs::passive_required()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), // → AwaitingReady + Event::CorruptionDetected(C0), + ], + ); + assert_eq!(state, State::Recovering(C0)); + assert!(effects.contains(&Effect::RecoverComponent { id: C0, attempt: 0 })); +} + +/// CorruptionDetected while in Updating (required component) → Recovering. +/// Updating has its own arm; it discards the staged image on preemption. +#[test] +fn corruption_in_updating_triggers_recovery() { + let (effects, state) = drive( + passive_required(&[C0]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::UpdateRequest(C0), + Event::CorruptionDetected(C0), + ], + ); + assert_eq!(state, State::Recovering(C0)); + assert!(effects.contains(&Effect::RecoverComponent { id: C0, attempt: 0 })); +} + +/// Concurrent faults: corruption of a *different* component arriving while the +/// machine is already in `Recovering` re-targets recovery at the new component. +/// `Recovering` is a supervised state, so `CorruptionDetected` falls through to +/// the `SupervisingPlatform` handler even mid-recovery — the one supervising +/// state with no other corruption-during-flight test. The second (Required) +/// fault displaces the first: the machine ends in `Recovering(C2)`. +#[test] +fn corruption_while_recovering_retargets_to_new_component() { + let (effects, state) = drive( + passive_required(&[C0, C1, C2]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + Event::VerificationPassed(C2), // walk done → Ready + Event::CorruptionDetected(C1), // → Recovering(C1) + Event::CorruptionDetected(C2), // arrives mid-recovery → Recovering(C2) + ], + ); + assert_eq!(state, State::Recovering(C2)); + // Both recovery episodes kicked off a recovery. + assert!(effects.contains(&Effect::RecoverComponent { id: C1, attempt: 0 })); + assert!(effects.contains(&Effect::RecoverComponent { id: C2, attempt: 0 })); + assert!(!effects.contains(&Effect::LatchLockdown)); +} + +/// An `UpdateRequest` arriving mid-recovery is declined, not silently dropped: +/// the machine emits `ReportUpdateDeferred` and stays in `Recovering`, leaving +/// the in-flight recovery untouched (single-flight, recovery-priority). +#[test] +fn update_request_while_recovering_is_deferred() { + let (effects, state) = drive( + passive_required(&[C0, C1]), + &[ + BOOT, + Event::VerificationFailed(C0), // → Recovering(C0) + Event::UpdateRequest(C0), // declined while recovering + ], + ); + assert_eq!(state, State::Recovering(C0)); + assert_eq!(effects.last(), Some(&Effect::ReportUpdateDeferred)); +} + +/// A second `UpdateRequest` while an update is already staged (`Updating`) is +/// declined the same way — reported, not dropped, and the staged update is +/// left in place. +#[test] +fn update_request_while_updating_is_deferred() { + let (effects, state) = drive( + passive_required(&[C0]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::UpdateRequest(C0), // → Updating + Event::UpdateRequest(C0), // declined while updating + ], + ); + assert_eq!(state, State::Updating(C0)); + assert_eq!(effects.last(), Some(&Effect::ReportUpdateDeferred)); +} + +/// An `UpdateRequest` while the chain walk is still finishing (`AwaitingReady`) +/// is declined too: the machine is not yet `Ready`, so it reports the refusal +/// and keeps waiting on the outstanding component. +#[test] +fn update_request_while_awaiting_ready_is_deferred() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::active_required()), + (C1, ComponentAttrs::passive_required()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), // active released → AwaitingReady(Some(C0)) + Event::UpdateRequest(C0), // declined while awaiting readiness + ], + ); + assert_eq!(state, State::AwaitingReady(Some(C0))); + assert_eq!(effects.last(), Some(&Effect::ReportUpdateDeferred)); +} + +/// Negative control: from `Ready` an `UpdateRequest` is *accepted* — it starts +/// an update (→ `Updating`) and never emits `ReportUpdateDeferred`. `Ready` +/// intercepts the request upstream, so it can never reach the deferral arm. +#[test] +fn update_request_in_ready_starts_update_not_deferred() { + let (effects, state) = drive( + passive_required(&[C0]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::UpdateRequest(C0), + ], + ); + assert_eq!(state, State::Updating(C0)); + assert!(!effects.contains(&Effect::ReportUpdateDeferred)); +} + +/// UpdateRequest is the one id-carrying event the chain-membership drop lets +/// through. The job is recorded before the dispatch, so dropping it here would +/// leave that job with nothing to answer it. +#[test] +fn an_update_request_for_an_unknown_component_is_not_dropped() { + let (_, state) = drive( + passive_required(&[C0]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::UpdateRequest(ComponentId::new(99)), + ], + ); + assert_eq!(state, State::Updating(ComponentId::new(99))); +} + +/// A different component reporting healthy must not advance its own SVN floor +/// or close the updated component's window, which would leave that component +/// with neither a commit nor a lock. +#[test] +fn an_unrelated_boot_confirmed_leaves_the_commit_window_open() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::passive_required()), + (C1, ComponentAttrs::passive_required()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + Event::UpdateRequest(C0), + Event::UpdateVerified, + // The re-walk has to finish before the confirm can land. + Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + Event::BootConfirmed(C1), + Event::CommitTimeout, + ], + ); + + assert!( + !effects.contains(&Effect::CommitSvnFloor(C1)), + "SVN floor advanced for C1, which activated nothing" + ); + assert_eq!( + state, + State::Locked, + "commit-or-lock defeated: window closed by an unrelated component" + ); +} + +/// A successful boot closes the trial for the component that booted, and +/// for no other. +#[test] +fn a_successful_boot_confirms_the_trial_of_the_component_that_booted() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::passive_required()), + (C1, ComponentAttrs::passive_required()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + Event::UpdateRequest(C0), + Event::UpdateVerified, + Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + Event::BootConfirmed(C1), + Event::BootConfirmed(C0), + ], + ); + + assert_eq!( + effects + .iter() + .filter(|e| **e == Effect::ConfirmDeviceTrial(C0)) .count(), 1, + "the trial for C0 must close once, on the BootConfirmed naming C0" + ); + assert!( + !effects.contains(&Effect::ConfirmDeviceTrial(C1)), + "C1 activated nothing, so it has no trial to confirm" + ); + assert!( + !effects + .iter() + .any(|e| matches!(e, Effect::RevertDeviceTrial(_))), + "a successful boot must not revert anything" + ); + assert_eq!(state, State::Ready); +} + +/// A newer update for the same component supersedes an image that was +/// never confirmed, so the trial closes without keeping the image. An +/// update for another component is refused instead, which +/// `an_update_for_another_component_is_refused_while_a_trial_is_open` +/// covers. +#[test] +fn a_superseding_update_for_the_same_component_reverts_the_trial() { + let (effects, _) = drive( + chain(&[(C0, ComponentAttrs::passive_required())]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::UpdateRequest(C0), + Event::UpdateVerified, + Event::VerificationPassed(C0), + // No BootConfirmed: the first image never ran. + Event::UpdateRequest(C0), + ], ); + assert_eq!( effects .iter() - .filter(|e| **e == Effect::AssertReset(C1)) + .filter(|e| **e == Effect::RevertDeviceTrial(C0)) .count(), 1, + "the trial for the superseded image must close without being kept" + ); + assert!( + !effects.contains(&Effect::ConfirmDeviceTrial(C0)), + "nothing confirmed the superseded image" ); } -/// Boot-time VerificationFailed on a required component → Recovering. -/// (Distinct from CorruptionDetected: this is a failed eRoT-side check -/// before the component is ever released from reset.) +/// An update for another component is refused while a trial is open, +/// rather than closing that trial on entry to `Updating`. +/// +/// The device may confirm late. Accepting the request would throw away an +/// unconfirmed image, and a confirmation arriving afterwards has no open +/// window left. #[test] -fn boot_failure_required_enters_recovering() { +fn an_update_for_another_component_is_refused_while_a_trial_is_open() { let (effects, state) = drive( - passive_required(&[C0, C1]), - &[BOOT, Event::VerificationFailed(C0)], + chain(&[ + (C0, ComponentAttrs::passive_required()), + (C1, ComponentAttrs::passive_required()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + Event::UpdateRequest(C0), + Event::UpdateVerified, + Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + // The image on C0 is activated and unconfirmed when C1 is + // offered an update. + Event::UpdateRequest(C1), + ], + ); + + assert!( + effects.contains(&Effect::ReportUpdateDeferred), + "the update for C1 must be reported refused, not dropped" + ); + assert!( + !effects + .iter() + .any(|e| matches!(e, Effect::RevertDeviceTrial(_))), + "C0 has not confirmed its image yet, so the trial must stay open" + ); + assert_eq!( + state, + State::Ready, + "the refusal leaves the state machine ready" ); - assert_eq!(state, State::Recovering(C0)); - assert!(effects.contains(&Effect::RecoverComponent { id: C0, attempt: 0 })); - // Component must never be released when its eRoT check failed. - assert!(!effects.contains(&Effect::ReleaseReset(C0))); } -/// Full boot-failure recovery cycle: VerificationFailed → Recovering → -/// Restored → re-walk from top → VerificationPassed → Ready. +/// The other component's report must also leave the window usable: the +/// BootConfirmed naming the updated component still records the SVN floor +/// advance, so the request that follows commits the floor, once. #[test] -fn boot_failure_recovery_cycle_completes() { +fn a_boot_confirmed_for_another_component_does_not_consume_the_window() { let (effects, state) = drive( - passive_required(&[C0]), + chain(&[ + (C0, ComponentAttrs::passive_required()), + (C1, ComponentAttrs::passive_required()), + ]), &[ BOOT, - Event::VerificationFailed(C0), - Event::Restored(C0), Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + Event::UpdateRequest(C0), + Event::UpdateVerified, + // The re-walk has to finish before the confirm can land. + Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + Event::BootConfirmed(C1), + Event::BootConfirmed(C0), + Event::SvnCommitRequest(C0), ], ); + + assert_eq!( + effects + .iter() + .filter(|e| **e == Effect::CommitSvnFloor(C0)) + .count(), + 1, + "the SVN floor for C0 must commit once on the request that follows its BootConfirmed" + ); + assert!( + !effects.contains(&Effect::CommitSvnFloor(C1)), + "SVN floor advanced for C1, which activated nothing" + ); assert_eq!(state, State::Ready); - assert!(effects.contains(&Effect::RecoverComponent { id: C0, attempt: 0 })); - // ReleaseReset only after the recovery re-walk passes. - assert!(effects.contains(&Effect::ReleaseReset(C0))); } -/// VerificationFailed (required) on a speculative check while the machine -/// is in AwaitingReady → enters Recovering without releasing the component. +/// Recovering another component keeps an outstanding SVN floor advance. The +/// image C0 runs is not under suspicion, so the request that follows still +/// moves the SVN floor for C0. Clearing unconditionally parked C0 with the new +/// image running, the old image in the spare slot and the SVN floor low. #[test] -fn required_failure_in_awaiting_ready_enters_recovering() { - let (effects, state) = drive( +fn recovering_another_component_keeps_the_outstanding_floor_advance() { + let (effects, _) = drive( chain(&[ - (C0, ComponentAttrs::active_required()), + (C0, ComponentAttrs::passive_required()), (C1, ComponentAttrs::passive_required()), ]), &[ BOOT, - Event::VerificationPassed(C0), // → AwaitingReady; spec check of C1 starts - Event::VerificationFailed(C1), // required → Recovering + Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + Event::UpdateRequest(C0), + Event::UpdateVerified, + // The re-walk after the activation. + Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + Event::BootConfirmed(C0), + // C1 is found corrupt and recovers, which says nothing about the + // image C0 is running. + Event::CorruptionDetected(C1), + Event::Restored(C1), + Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + Event::SvnCommitRequest(C0), ], ); - assert_eq!(state, State::Recovering(C1)); - assert!(effects.contains(&Effect::RecoverComponent { id: C1, attempt: 0 })); - assert!(!effects.contains(&Effect::ReleaseReset(C1))); + + assert!( + effects.contains(&Effect::RecoverComponent { id: C1, attempt: 0 }), + "C1 has to actually recover for the assertion to say anything" + ); + assert!( + effects.contains(&Effect::CommitSvnFloor(C0)), + "the SVN floor advance for C0 was dropped by a recovery that did not touch its image" + ); } -/// CorruptionDetected while in AwaitingReady (required component) → -/// Recovering via the SupervisingPlatform superstate handler. +/// The same for an update aimed elsewhere: C1 being updated says nothing about +/// the image C0 runs, so the SVN floor advance outstanding for C0 survives the +/// second update. #[test] -fn corruption_in_awaiting_ready_triggers_recovery() { - let (effects, state) = drive( +fn updating_another_component_keeps_the_outstanding_floor_advance() { + let (effects, _) = drive( chain(&[ - (C0, ComponentAttrs::active_required()), + (C0, ComponentAttrs::passive_required()), (C1, ComponentAttrs::passive_required()), ]), &[ BOOT, - Event::VerificationPassed(C0), // → AwaitingReady - Event::CorruptionDetected(C0), + Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + Event::UpdateRequest(C0), + Event::UpdateVerified, + Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + Event::BootConfirmed(C0), + // A second update, this one aimed at C1. + Event::UpdateRequest(C1), + Event::UpdateRejected, + Event::SvnCommitRequest(C0), ], ); - assert_eq!(state, State::Recovering(C0)); - assert!(effects.contains(&Effect::RecoverComponent { id: C0, attempt: 0 })); + + assert_eq!( + effects + .iter() + .filter(|e| **e == Effect::AuthenticateStageUpdate) + .count(), + 2, + "the update for C1 has to be accepted for the assertion to say anything" + ); + assert!( + effects.contains(&Effect::CommitSvnFloor(C0)), + "the SVN floor advance for C0 was dropped by an update that did not touch its image" + ); } -/// CorruptionDetected while in Updating (required component) → Recovering -/// via the SupervisingPlatform superstate handler. +/// With nothing waiting to commit, a BootConfirmed records no SVN floor advance +/// and the request that follows finds nothing to move. Without the request the +/// assertion held whatever the state machine did, since only a request emits +/// the effect. #[test] -fn corruption_in_updating_triggers_recovery() { +fn a_request_with_nothing_recorded_moves_no_floor() { let (effects, state) = drive( passive_required(&[C0]), &[ BOOT, Event::VerificationPassed(C0), - Event::UpdateRequest, - Event::CorruptionDetected(C0), + Event::BootConfirmed(C0), + Event::SvnCommitRequest(C0), ], ); - assert_eq!(state, State::Recovering(C0)); - assert!(effects.contains(&Effect::RecoverComponent { id: C0, attempt: 0 })); -} -/// Concurrent faults: corruption of a *different* component arriving while the -/// machine is already in `Recovering` re-targets recovery at the new component. -/// `Recovering` is a supervised state, so `CorruptionDetected` falls through to -/// the `SupervisingPlatform` handler even mid-recovery — the one supervising -/// state with no other corruption-during-flight test. The second (Required) -/// fault displaces the first: the machine ends in `Recovering(C2)`. -#[test] -fn corruption_while_recovering_retargets_to_new_component() { - let (effects, state) = drive( - passive_required(&[C0, C1, C2]), - &[ - BOOT, - Event::VerificationPassed(C0), - Event::VerificationPassed(C1), - Event::VerificationPassed(C2), // walk done → Ready - Event::CorruptionDetected(C1), // → Recovering(C1) - Event::CorruptionDetected(C2), // arrives mid-recovery → Recovering(C2) - ], + assert!( + !effects.contains(&Effect::CommitSvnFloor(C0)), + "SVN floor advanced with no update activated" ); - assert_eq!(state, State::Recovering(C2)); - // Both recovery episodes kicked off a recovery. - assert!(effects.contains(&Effect::RecoverComponent { id: C1, attempt: 0 })); - assert!(effects.contains(&Effect::RecoverComponent { id: C2, attempt: 0 })); - assert!(!effects.contains(&Effect::LatchLockdown)); + assert_eq!(state, State::Ready); } -/// An `UpdateRequest` arriving mid-recovery is declined, not silently dropped: -/// the machine emits `ReportUpdateDeferred` and stays in `Recovering`, leaving -/// the in-flight recovery untouched (single-flight, recovery-priority). +/// UpdateVerified activates the staged image and returns to Ready. +/// (Complements update_rollback_is_not_recovery which tests UpdateRejected.) #[test] -fn update_request_while_recovering_is_deferred() { +fn update_verified_activates_update() { let (effects, state) = drive( - passive_required(&[C0, C1]), + passive_required(&[C0]), &[ BOOT, - Event::VerificationFailed(C0), // → Recovering(C0) - Event::UpdateRequest, // declined while recovering + Event::VerificationPassed(C0), + Event::UpdateRequest(C0), + Event::UpdateVerified, ], ); - assert_eq!(state, State::Recovering(C0)); - assert_eq!(effects.last(), Some(&Effect::ReportUpdateDeferred)); + // Activation only proposes the image. The device runs the old one + // until the walk resets it, so the machine walks rather than + // returning to Ready. + assert_eq!(state, State::PreSupervision); + assert!(effects.contains(&Effect::ActivateUpdate)); + assert!(!effects.contains(&Effect::DiscardStaged)); + assert!(!effects.contains(&Effect::RecoverComponent { id: C0, attempt: 0 })); } -/// A second `UpdateRequest` while an update is already staged (`Updating`) is -/// declined the same way — reported, not dropped, and the staged update is -/// left in place. +/// The re-walk is what boots the candidate: the activated component is +/// quiesced, verified at rest, and released again. Its `VerifyFirmware` is also +/// what records the new image's SVN for a later SVN floor commit. #[test] -fn update_request_while_updating_is_deferred() { +fn an_activation_resets_and_re_verifies_the_component() { let (effects, state) = drive( passive_required(&[C0]), &[ BOOT, Event::VerificationPassed(C0), - Event::UpdateRequest, // → Updating - Event::UpdateRequest, // declined while updating + Event::UpdateRequest(C0), + Event::UpdateVerified, + Event::VerificationPassed(C0), ], ); - assert_eq!(state, State::Updating); - assert_eq!(effects.last(), Some(&Effect::ReportUpdateDeferred)); + + assert_eq!(state, State::Ready); + let activated = effects + .iter() + .position(|e| *e == Effect::ActivateUpdate) + .expect("never activated"); + let after = &effects[activated..]; + assert!(after.contains(&Effect::AssertReset(C0)), "never reset"); + assert!( + after.contains(&Effect::VerifyFirmware(C0)), + "never re-verified" + ); + assert!(after.contains(&Effect::ReleaseReset(C0)), "never released"); } -/// An `UpdateRequest` while the chain walk is still finishing (`AwaitingReady`) -/// is declined too: the machine is not yet `Ready`, so it reports the refusal -/// and keeps waiting on the outstanding component. +/// The walk that follows an activation passes through the supervised +/// states too, and the watchdog has to be answered there as well. An +/// active component parks the walk in `AwaitingReady` until its iRoT +/// reports, which is where this fire lands. #[test] -fn update_request_while_awaiting_ready_is_deferred() { +fn a_commit_timeout_while_the_post_update_walk_awaits_readiness_latches_locked() { + // Two components, so the walk moves on to C1 and parks in + // AwaitingReady(C0) instead of finishing in Ready. let (effects, state) = drive( chain(&[ (C0, ComponentAttrs::active_required()), @@ -1254,86 +2435,106 @@ fn update_request_while_awaiting_ready_is_deferred() { ]), &[ BOOT, - Event::VerificationPassed(C0), // active released → AwaitingReady(Some(C0)) - Event::UpdateRequest, // declined while awaiting readiness + Event::VerificationPassed(C0), + Event::ComponentReady(C0), + Event::VerificationPassed(C1), + Event::UpdateRequest(C0), + Event::UpdateVerified, + // The re-walk releases C0 and moves to C1, so the machine is + // in AwaitingReady when the watchdog fires: the supervising + // handler is what has to answer it. + Event::VerificationPassed(C0), + Event::CommitTimeout, ], ); - assert_eq!(state, State::AwaitingReady(Some(C0))); - assert_eq!(effects.last(), Some(&Effect::ReportUpdateDeferred)); -} -/// Negative control: from `Ready` an `UpdateRequest` is *accepted* — it starts -/// an update (→ `Updating`) and never emits `ReportUpdateDeferred`. `Ready` -/// intercepts the request upstream, so it can never reach the deferral arm. -#[test] -fn update_request_in_ready_starts_update_not_deferred() { - let (effects, state) = drive( - passive_required(&[C0]), - &[BOOT, Event::VerificationPassed(C0), Event::UpdateRequest], - ); - assert_eq!(state, State::Updating); - assert!(!effects.contains(&Effect::ReportUpdateDeferred)); + assert_eq!(state, State::Locked); + assert!(effects.contains(&Effect::LatchLockdown)); + assert!(!effects.contains(&Effect::CommitSvnFloor(C0))); } -/// UpdateVerified activates the staged image and returns to Ready. -/// (Complements update_rollback_is_not_recovery which tests UpdateRejected.) +/// A spurious watchdog fire during an ordinary boot walk, with no update +/// activated, must not brick the boot: there is no window to fail closed +/// on, so the walk carries on. #[test] -fn update_verified_activates_update() { +fn a_commit_timeout_during_a_plain_boot_walk_is_ignored() { let (effects, state) = drive( passive_required(&[C0]), &[ BOOT, + // Mid-walk: C0 is verified but the machine has not left + // PreSupervision yet. + Event::CommitTimeout, Event::VerificationPassed(C0), - Event::UpdateRequest, - Event::UpdateVerified, ], ); + assert_eq!(state, State::Ready); - assert!(effects.contains(&Effect::ActivateUpdate)); - assert!(!effects.contains(&Effect::DiscardStaged)); - assert!(!effects.contains(&Effect::RecoverComponent { id: C0, attempt: 0 })); + assert!(!effects.contains(&Effect::LatchLockdown)); } -/// The anti-rollback floor is committed only on a proven-healthy boot, never -/// at activation. `UpdateVerified` activates the image (authentication) but -/// must NOT emit `CommitSvnFloor`; a later `BootConfirmed` (the runtime health -/// proof) is what advances the floor. This pins the decoupling so activation -/// can never silently commit the floor early. +/// The SVN floor moves on the request the Update Agent sends, and on nothing +/// earlier. `UpdateVerified` activates the image (authentication) and +/// `BootConfirmed` confirms it runs, but neither may emit `CommitSvnFloor`: +/// only `SvnCommitRequest`, which says UpdateSecurityRevision ran and the +/// device took the SVN, does. This pins both halves of the decoupling. #[test] -fn svn_floor_commits_on_boot_confirmed_not_on_activation() { - // Activation alone: no floor commit yet. +fn svn_floor_commits_when_the_agent_asks_not_before() { + // Activation alone: no SVN floor commit yet. let (activated, activated_state) = drive( passive_required(&[C0]), &[ BOOT, Event::VerificationPassed(C0), - Event::UpdateRequest, + Event::UpdateRequest(C0), Event::UpdateVerified, ], ); - assert_eq!(activated_state, State::Ready); + assert_eq!(activated_state, State::PreSupervision); assert!(activated.contains(&Effect::ActivateUpdate)); assert!(!activated.contains(&Effect::CommitSvnFloor(C0))); - // Proven-healthy boot: the floor advances now, without leaving Ready. + // Confirmed boot: still no SVN floor advance, the Update Agent has not + // requested it. let (confirmed, confirmed_state) = drive( passive_required(&[C0]), &[ BOOT, Event::VerificationPassed(C0), - Event::UpdateRequest, + Event::UpdateRequest(C0), Event::UpdateVerified, + // The walk the activation started has to finish: the SVN floor + // commit takes the SVN that walk verified. + Event::VerificationPassed(C0), Event::BootConfirmed(C0), ], ); assert_eq!(confirmed_state, State::Ready); - assert!(confirmed.contains(&Effect::CommitSvnFloor(C0))); + assert!(!confirmed.contains(&Effect::CommitSvnFloor(C0))); + + // UpdateSecurityRevision ran and the device took the SVN: the SVN floor + // advances now, without leaving Ready. + let (committed, committed_state) = drive( + passive_required(&[C0]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::UpdateRequest(C0), + Event::UpdateVerified, + Event::VerificationPassed(C0), + Event::BootConfirmed(C0), + Event::SvnCommitRequest(C0), + ], + ); + assert_eq!(committed_state, State::Ready); + assert!(committed.contains(&Effect::CommitSvnFloor(C0))); } /// Commit-or-lock watchdog: while the activated-but-not-committed window is /// open (update activated, `BootConfirmed` not yet seen), a `CommitTimeout` -/// fails closed — the machine latches `Locked` rather than leaving the -/// downgrade window open indefinitely, and never commits the unproven image. +/// fails secure: the state machine latches `Locked` rather than leaving the +/// downgrade window open indefinitely, and commits no image a boot has not +/// confirmed. #[test] fn commit_timeout_while_pending_latches_locked() { let (effects, state) = drive( @@ -1341,22 +2542,25 @@ fn commit_timeout_while_pending_latches_locked() { &[ BOOT, Event::VerificationPassed(C0), - Event::UpdateRequest, + Event::UpdateRequest(C0), Event::UpdateVerified, - // Window open: activated, awaiting BootConfirmed. Watchdog fires. + // Window open and the re-walk still running: the watchdog + // fires in PreSupervision, which is unsupervised, so the match arm + // has to be there or the fire is dropped for good. Event::CommitTimeout, ], ); assert_eq!(state, State::Locked); assert!(effects.contains(&Effect::ActivateUpdate)); assert!(effects.contains(&Effect::LatchLockdown)); - // The floor was never advanced for the unproven image. + // The SVN floor did not move for an image no boot confirmed. assert!(!effects.contains(&Effect::CommitSvnFloor(C0))); } -/// Once `BootConfirmed` has committed the floor the window is closed, so a -/// later (stale) `CommitTimeout` is a no-op: the machine stays `Ready` and does -/// not lock. +/// `BootConfirmed` closes the commit-or-lock window on its own, so a later +/// (stale) `CommitTimeout` is a no-op: the state machine stays `Ready` and does +/// not lock. No watchdog bounds the SVN floor advance it hands on, so an Update +/// Agent that has not requested yet costs nothing here. #[test] fn commit_timeout_after_confirm_is_stale_noop() { let (effects, state) = drive( @@ -1364,16 +2568,20 @@ fn commit_timeout_after_confirm_is_stale_noop() { &[ BOOT, Event::VerificationPassed(C0), - Event::UpdateRequest, + Event::UpdateRequest(C0), Event::UpdateVerified, + Event::VerificationPassed(C0), Event::BootConfirmed(C0), - // Window already closed by the commit above. + // Window already closed by the confirm above. Event::CommitTimeout, ], ); assert_eq!(state, State::Ready); - assert!(effects.contains(&Effect::CommitSvnFloor(C0))); assert!(!effects.contains(&Effect::LatchLockdown)); + assert!( + !effects.contains(&Effect::CommitSvnFloor(C0)), + "the SVN floor waits for the Update Agent, watchdog or no watchdog" + ); } /// A `CommitTimeout` in steady-state `Ready` with no update in flight (no @@ -1400,7 +2608,7 @@ fn recovery_clears_commit_window() { &[ BOOT, Event::VerificationPassed(C0), - Event::UpdateRequest, + Event::UpdateRequest(C0), Event::UpdateVerified, // Window open, then a Required corruption preempts to recovery. Event::CorruptionDetected(C0), @@ -1438,7 +2646,7 @@ fn locked_is_terminal() { BOOT, Event::VerificationPassed(C0), Event::AttestationChallenge, - Event::UpdateRequest, + Event::UpdateRequest(C0), Event::CorruptionDetected(C0), ] { orch.dispatch_with(ev, |e| { @@ -1549,6 +2757,27 @@ fn chain_rejects_empty() { assert_eq!(Chain::try_from(empty).unwrap_err(), ChainError::Empty); } +/// More than `u8::MAX` components is rejected. `cursor` is a `u8` and uses +/// `chain.len()` as its past-the-end sentinel, so a 256-entry chain would +/// truncate that sentinel to 0 and the walk would never read as done. +#[test] +fn chain_rejects_more_than_u8_max_components() { + const OVER: usize = 256; + let mut entries: heapless::Vec<(ComponentId, ComponentAttrs), OVER> = heapless::Vec::new(); + for i in 0..OVER { + entries + .push(( + ComponentId::new(i as u8), + ComponentAttrs::passive_required(), + )) + .expect("fits OVER"); + } + assert_eq!( + Chain::::try_from(entries).unwrap_err(), + ChainError::TooLong + ); +} + /// A repeated `ComponentId` is rejected: the state machine's linear id lookups would /// otherwise be ambiguous. #[test] @@ -1643,7 +2872,7 @@ impl Platform for FailOn { } } -/// A failed reset actuation is fail-closed: the orchestrator injects `EffectFailed` +/// A failed reset actuation is fail-secure: the orchestrator injects `EffectFailed` /// and the machine latches to `Locked`, emitting `LatchLockdown`. #[test] fn effect_failure_latches_lockdown() { @@ -1661,7 +2890,7 @@ fn effect_failure_latches_lockdown() { assert!(plat.recorded.contains(&Effect::LatchLockdown)); } -/// A failed isolation actuation (`AssertReset`) is equally fail-closed: even a +/// A failed isolation actuation (`AssertReset`) is equally fail-secure: even a /// non-required component's containment failing latches the platform. #[test] fn failed_isolation_actuation_latches_lockdown() { @@ -1682,7 +2911,7 @@ fn failed_isolation_actuation_latches_lockdown() { assert!(plat.recorded.contains(&Effect::LatchLockdown)); } -/// A failed recovery actuation is fail-closed too: if the platform driver cannot even +/// A failed recovery actuation is fail-secure too: if the platform driver cannot even /// recover a required component, the platform latches rather /// than continuing with an unrecovered component. #[test] @@ -1772,7 +3001,7 @@ fn corruption_during_update_discards_staged() { BOOT, Event::VerificationPassed(C0), Event::VerificationPassed(C1), // → Ready - Event::UpdateRequest, // → Updating (AuthenticateUpdate, StageUpdate) + Event::UpdateRequest(C0), // → Updating (AuthenticateStageUpdate) Event::CorruptionDetected(C1), // Required corruption preempts the update ], ); @@ -1802,11 +3031,11 @@ fn contained_corruption_during_update_does_not_abort() { BOOT, Event::VerificationPassed(C0), Event::VerificationPassed(C1), // → Ready - Event::UpdateRequest, // → Updating + Event::UpdateRequest(C0), // → Updating Event::CorruptionDetected(C1), // isolable: contained, update survives ], ); - assert_eq!(state, State::Updating); + assert_eq!(state, State::Updating(C0)); assert!(!effects.contains(&Effect::ReportUpdateAborted)); assert!(!effects.contains(&Effect::DiscardStaged)); } @@ -1881,10 +3110,35 @@ impl SplitMix64 { } } +/// Build a random three-component chain: kind, failure policy and dependency +/// edge all vary per seed. The `AwaitingReady` cursor race needs a gateable +/// component after an active one, which the old fixed chain never had, so the +/// shape is part of what gets fuzzed. +fn random_chain(rng: &mut SplitMix64) -> heapless::Vec<(ComponentId, ComponentAttrs), CAPACITY> { + let ids = [C0, C1, C2]; + let mut c = heapless::Vec::new(); + for (i, &id) in ids.iter().enumerate() { + let mut attrs = match rng.below(6) { + 0 => ComponentAttrs::active_required(), + 1 => ComponentAttrs::passive_required(), + 2 => ComponentAttrs::active_isolable(), + 3 => ComponentAttrs::passive_isolable(), + 4 => ComponentAttrs::active_cascading(), + _ => ComponentAttrs::passive_cascading(), + }; + // Depend on an earlier component half the time, so cascades have depth. + if i > 0 && rng.below(2) == 0 { + attrs = attrs.with_depends_on(ids[rng.below(i as u32) as usize]); + } + c.push((id, attrs)).expect("chain within CAPACITY"); + } + c +} + /// Build one random event over the given id palette. Id-less events ignore it. fn random_event(rng: &mut SplitMix64, ids: &[ComponentId]) -> Event { let id = ids[rng.below(ids.len() as u32) as usize]; - match rng.below(15) { + match rng.below(19) { 0 => Event::VerificationPassed(id), 1 => Event::VerificationFailed(id), 2 => Event::ComponentReady(id), @@ -1892,20 +3146,161 @@ fn random_event(rng: &mut SplitMix64, ids: &[ComponentId]) -> Event { 4 => Event::BootConfirmed(id), 5 => Event::CorruptionDetected(id), 6 => Event::Restored(id), - 7 => Event::Timeout(id), + 7 => { + // Coin-flip: exercise both BootFailed and Timeout on + // this arm. + if rng.below(2) == 0 { + let kind = match rng.below(3) { + 0 => BootFailureKind::TimedOut, + 1 => BootFailureKind::DeviceRetriable, + _ => BootFailureKind::DeviceFatal, + }; + Event::BootFailed { + id, + checkpoint: "fuzz", + kind, + } + } else { + Event::Timeout(id) + } + } 8 => Event::AttestationChallenge, - 9 => Event::UpdateRequest, + 9 => Event::UpdateRequest(id), 10 => Event::UpdateVerified, 11 => Event::UpdateRejected, 12 => Event::RecoveryFailed, 13 => Event::CommitTimeout, + 14 => Event::RecoveryUnavailable(id), + 15 => Event::UpdateCancelled, + 16 => Event::SelfTrialBooted, + 17 => Event::SvnCommitRequest(id), _ => Event::EffectFailed, } } +/// Isolation is sticky: once a component is reported isolated, nothing in the +/// rest of the run takes it out of reset or hands it to recovery. The +/// verify-before-release property misses the recovery half of that, because +/// recovery re-verifies before releasing. +/// A `Cascading` component takes its whole dependent subtree with it. Only +/// `Cascading` carries that promise: `Isolable` isolates the one component and +/// its dependents keep running, so the check is scoped to cascading roots. +/// Traversing only ungated dependents used to stop the walk at a component that +/// was already isolated, leaving the subtree behind it out of reset. +#[test] +fn property_cascading_isolation_reaches_the_whole_subtree() { + const RUNS: u64 = 20_000; + const MAX_LEN: u32 = 24; + + let palette = [C0, C1, C2, C3]; + + for seed in 0..RUNS { + let mut rng = SplitMix64(seed.wrapping_mul(0xD1B5_4A32_D192_ED03).wrapping_add(1)); + + let ch = random_chain(&mut rng); + let mut orch = Orchestrator::::new( + ch.clone().try_into().expect("valid chain"), + MAX_RETRY, + ); + let mut platform = Recorder::new(); + + orch.dispatch(&mut platform, BOOT); + let len = 1 + rng.below(MAX_LEN); + for _ in 0..len { + let event = random_event(&mut rng, &palette); + orch.dispatch(&mut platform, event); + } + + let mut isolated = [false; CAPACITY]; + for effect in &platform.recorded { + if let Effect::ReportIsolated(id) = effect { + isolated[id.get() as usize] = true; + } + } + + // Start from the dependents of every isolated `Cascading` component, + // then propagate down the `depends_on` edges to a fixed point. + // Propagation ignores the intermediate components' own policies: + // `cascade_hold` gates a subtree whatever the nodes in it are + // configured as, so an `Isolable` component in the middle must not + // stop it. + let mut must_isolate = [false; CAPACITY]; + for &(id, attrs) in ch.iter() { + let Some(holder) = attrs.depends_on else { + continue; + }; + let holder_cascading = ch + .iter() + .find(|(c, _)| *c == holder) + .is_some_and(|(_, a)| a.failure_policy == FailurePolicy::Cascading); + if isolated[holder.get() as usize] && holder_cascading { + must_isolate[id.get() as usize] = true; + } + } + for _ in 0..ch.len() { + for &(id, attrs) in ch.iter() { + if let Some(holder) = attrs.depends_on + && must_isolate[holder.get() as usize] + { + must_isolate[id.get() as usize] = true; + } + } + } + for &(id, _) in ch.iter() { + if must_isolate[id.get() as usize] { + assert!( + isolated[id.get() as usize], + "seed {seed}: {id:?} is under an isolated cascading component \ + but was never isolated", + ); + } + } + } +} + +#[test] +fn property_isolation_is_sticky_under_random_sequences() { + const RUNS: u64 = 20_000; + const MAX_LEN: u32 = 24; + + let palette = [C0, C1, C2, C3]; + + for seed in 0..RUNS { + let mut rng = SplitMix64(seed.wrapping_mul(0xD1B5_4A32_D192_ED03).wrapping_add(1)); + + let ch = random_chain(&mut rng); + let mut orch = + Orchestrator::::new(ch.try_into().expect("valid chain"), MAX_RETRY); + let mut platform = Recorder::new(); + + orch.dispatch(&mut platform, BOOT); + let len = 1 + rng.below(MAX_LEN); + for _ in 0..len { + let event = random_event(&mut rng, &palette); + orch.dispatch(&mut platform, event); + } + + let mut isolated = [false; CAPACITY]; + for effect in &platform.recorded { + match effect { + Effect::ReportIsolated(id) => isolated[id.get() as usize] = true, + Effect::ReleaseReset(id) => assert!( + !isolated[id.get() as usize], + "seed {seed}: released {id:?} after reporting it isolated", + ), + Effect::RecoverComponent { id, .. } => assert!( + !isolated[id.get() as usize], + "seed {seed}: recovered {id:?} after reporting it isolated", + ), + _ => {} + } + } + } +} + #[test] fn property_verify_before_release_holds_under_random_sequences() { - const RUNS: u64 = 4000; + const RUNS: u64 = 20_000; const MAX_LEN: u32 = 24; // C0..C2 are in-chain; C3 is intentionally out-of-chain — fed as noise so @@ -1916,11 +3311,7 @@ fn property_verify_before_release_holds_under_random_sequences() { for seed in 0..RUNS { let mut rng = SplitMix64(seed.wrapping_mul(0xD1B5_4A32_D192_ED03).wrapping_add(1)); - let ch = chain(&[ - (C0, ComponentAttrs::passive_required()), - (C1, ComponentAttrs::active_isolable()), - (C2, ComponentAttrs::passive_required()), - ]); + let ch = random_chain(&mut rng); let mut orch = Orchestrator::::new(ch.try_into().expect("valid chain"), MAX_RETRY); let mut platform = Recorder::new(); @@ -1967,6 +3358,111 @@ fn property_verify_before_release_holds_under_random_sequences() { } } +/// INV13: the SVN floor commits once per activation, and only on the request +/// that follows a confirm. The rule breaks in ways random input reaches: a +/// request with no activation behind it, a second request for the same +/// activation, and a request for a component whose confirm never arrived. +#[test] +fn property_floor_commits_once_per_activation_after_a_confirm() { + const RUNS: u64 = 20_000; + const MAX_LEN: u32 = 24; + + let palette = [C0, C1, C2, C3]; + // The property says nothing unless the run reaches an activation, its + // confirm and the request that follows. Counted and asserted below, so a + // generator that stops producing that sequence fails here instead of + // passing on an empty set. + let mut commits_seen = 0u32; + + for seed in 0..RUNS { + let mut rng = SplitMix64(seed.wrapping_mul(0x9E37_79B9_7F4A_7C15).wrapping_add(7)); + + // A fixed passive pair, so the walk is deterministic and the run + // reaches an activation. Random chains almost never produce the + // request, verdict, re-walk and confirm in order, and a property over a + // sequence nothing reaches says nothing. + let mut orch = Orchestrator::::new( + passive_required(&[C0, C1]).try_into().expect("valid chain"), + MAX_RETRY, + ); + let mut platform = Recorder::new(); + orch.dispatch(&mut platform, BOOT); + orch.dispatch(&mut platform, Event::VerificationPassed(C0)); + orch.dispatch(&mut platform, Event::VerificationPassed(C1)); + + // One update, carried to the point where the Update Agent could request + // the SVN floor advance. What the random tail then does with that + // window is the property. + let target = if rng.below(2) == 0 { C0 } else { C1 }; + orch.dispatch(&mut platform, Event::UpdateRequest(target)); + orch.dispatch(&mut platform, Event::UpdateVerified); + orch.dispatch(&mut platform, Event::VerificationPassed(C0)); + orch.dispatch(&mut platform, Event::VerificationPassed(C1)); + + // Per component, since its last activation: whether one happened, + // whether its confirm landed, and whether its SVN floor already took + // that SVN. + let mut activated = [false; CAPACITY]; + let mut confirmed = [false; CAPACITY]; + let mut committed = [false; CAPACITY]; + activated[target.get() as usize] = true; + + let len = 1 + rng.below(MAX_LEN); + for _ in 0..len { + let event = random_event(&mut rng, &palette); + let before = orch.state(); + let seen = platform.recorded.len(); + orch.dispatch(&mut platform, event); + let emitted = &platform.recorded[seen..]; + + // An activation starts a fresh window for the component the state + // machine was updating. + if emitted.contains(&Effect::ActivateUpdate) + && let State::Updating(target) = before + { + let i = target.get() as usize; + activated[i] = true; + confirmed[i] = false; + committed[i] = false; + } + if let Event::BootConfirmed(id) = event { + confirmed[id.get() as usize] = true; + } + + for effect in emitted { + let Effect::CommitSvnFloor(id) = effect else { + continue; + }; + let i = id.get() as usize; + assert_eq!( + event, + Event::SvnCommitRequest(*id), + "seed {seed}: SVN floor moved for {id:?} on something other than the request", + ); + assert!( + activated[i], + "seed {seed}: SVN floor moved for {id:?} with no activation behind it", + ); + assert!( + confirmed[i], + "seed {seed}: SVN floor moved for {id:?} without a confirm since its activation", + ); + assert!( + !committed[i], + "seed {seed}: SVN floor moved twice for {id:?} on one activation", + ); + committed[i] = true; + commits_seen += 1; + } + } + } + + assert!( + commits_seen > 0, + "no run reached an SVN floor commit, so the property checked nothing", + ); +} + /// A returned event settles in the same run: a platform that answers every /// `VerifyFirmware` in place walks a provisioned chain to `Ready` from one /// dispatch. @@ -2010,7 +3506,7 @@ fn returned_verdicts_settle_in_one_dispatch() { } /// A batch whose executors return more events than the pending queue holds -/// fails closed: the run latches `Locked` instead of losing feedback. +/// fails secure: the run latches `Locked` instead of losing feedback. #[test] fn returned_event_overflow_latches_locked() { struct Chatty; @@ -2119,3 +3615,360 @@ fn event_returned_during_lockdown_is_discarded() { assert_eq!(orch.state(), State::Locked); assert_eq!(platform.recorded.last(), Some(&Effect::LatchLockdown)); } + +#[test] +#[should_panic(expected = "Sink overflowed")] +fn sink_overflow_panics_in_tests() { + let mut sink = Sink::<1>::new(); + sink.emit(Effect::LatchLockdown); + // Second emit overflows the 1-slot buffer. + sink.emit(Effect::LatchLockdown); +} + +/// The eRoT sits at chain position 0 and is already running, so the walk +/// steps past it. It emits no `ReadFirmware`, `VerifyFirmware` or +/// `ReleaseReset` for it, and the first component it touches is the one +/// behind the eRoT. +#[test] +fn the_walk_passes_over_the_erot() { + let chain = chain(&[ + (C0, ComponentAttrs::erot()), + (C1, ComponentAttrs::passive_required()), + ]); + let mut orch = Orchestrator::::new(chain.try_into().unwrap(), MAX_RETRY); + let mut platform = Recorder::new(); + + orch.dispatch(&mut platform, BOOT); + + let effects = platform.recorded; + assert!( + !effects.iter().any(|e| matches!( + e, + Effect::ReadFirmware(C0) | Effect::VerifyFirmware(C0) | Effect::ReleaseReset(C0) + )), + "the walk touched the eRoT: {effects:?}" + ); + assert!( + effects.contains(&Effect::VerifyFirmware(C1)), + "the walk did not reach the component behind the eRoT: {effects:?}" + ); +} + +/// The trial image booted and the chain came up behind it. That is the verdict +/// on the trial, so `Ready` entry confirms the session and the Update Agent can +/// request the SVN floor advance. +#[test] +fn a_self_trial_is_confirmed_when_the_chain_reaches_ready() { + let (effects, state) = drive( + passive_required(&[C0]), + &[ + Event::SelfTrialBooted, + BOOT, + Event::VerificationPassed(C0), + Event::Booted(C0), + ], + ); + + assert_eq!(state, State::Ready); + assert_eq!( + effects + .iter() + .filter(|e| **e == Effect::ConfirmSelfTrial) + .count(), + 1 + ); +} + +/// An ordinary boot confirms nothing. Without the event there is no +/// session to confirm, and emitting the effect would have the driver write +/// to a session that holds no trial. +#[test] +fn a_boot_without_a_self_trial_confirms_nothing() { + let (effects, _) = drive( + passive_required(&[C0]), + &[BOOT, Event::VerificationPassed(C0), Event::Booted(C0)], + ); + + assert!(!effects.contains(&Effect::ConfirmSelfTrial)); +} + +/// The machine returns to `Ready` whenever an update or a recovery ends. +/// The trial is confirmed on the first of those only: the session is +/// already `Committed` after that, and the second write would be answering +/// for a trial this boot no longer runs. +#[test] +fn the_self_trial_is_confirmed_once_per_boot() { + let (effects, state) = drive( + passive_required(&[C0]), + &[ + Event::SelfTrialBooted, + BOOT, + Event::VerificationPassed(C0), + Event::Booted(C0), + // An update that is staged and then rejected, which leaves the + // machine where it started: back in `Ready`. + Event::UpdateRequest(C0), + Event::UpdateRejected, + ], + ); + + assert_eq!(state, State::Ready); + assert!( + effects.contains(&Effect::DiscardStaged), + "the update has to run for `Ready` to be entered a second time" + ); + assert_eq!( + effects + .iter() + .filter(|e| **e == Effect::ConfirmSelfTrial) + .count(), + 1 + ); +} + +/// A boot that locks down never reaches `Ready`, so the trial is never +/// confirmed. The next boot settles the session as a trial that fell back +/// and the update is done again. +#[test] +fn a_self_trial_on_a_boot_that_locks_is_not_confirmed() { + let (effects, state) = drive( + passive_required(&[C0]), + &[ + Event::SelfTrialBooted, + Event::PowerGood(PowerOnResult::SelfVerificationFailed), + ], + ); + + assert_eq!(state, State::Locked); + assert!(!effects.contains(&Effect::ConfirmSelfTrial)); +} + +/// The event belongs to the start of a boot. One arriving later names a +/// trial the machine has already judged, so it is dropped rather than +/// re-opening the question from `Ready`. +#[test] +fn a_late_self_trial_event_is_dropped() { + let (effects, state) = drive( + passive_required(&[C0]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::Booted(C0), + Event::SelfTrialBooted, + // A second pass through `Ready`, which would confirm if the + // late event had been recorded. + Event::UpdateRequest(C0), + Event::UpdateRejected, + ], + ); + + assert_eq!(state, State::Ready); + assert!( + effects.contains(&Effect::DiscardStaged), + "the update has to run for `Ready` to be entered a second time" + ); + assert!(!effects.contains(&Effect::ConfirmSelfTrial)); +} + +/// Nothing is outstanding, so the request names an SVN floor advance the state +/// machine never opened. Dropped: an `SvnCommitRequest` that could move an SVN +/// floor on its own would let an Update Agent advance anti-rollback for an +/// image the state machine did not activate. +#[test] +fn an_svn_commit_with_nothing_outstanding_is_dropped() { + let (effects, state) = drive( + passive_required(&[C0]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::SvnCommitRequest(C0), + ], + ); + + assert_eq!(state, State::Ready); + assert!(!effects.contains(&Effect::CommitSvnFloor(C0))); +} + +/// The agent requests twice, because the first answer was lost on the way back. +/// The SVN floor takes the SVN once: the second request finds the floor advance +/// already spent. +#[test] +fn an_svn_commit_moves_the_floor_once() { + let (effects, state) = drive( + passive_required(&[C0]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::UpdateRequest(C0), + Event::UpdateVerified, + Event::VerificationPassed(C0), + Event::BootConfirmed(C0), + Event::SvnCommitRequest(C0), + Event::SvnCommitRequest(C0), + ], + ); + + assert_eq!(state, State::Ready); + assert_eq!( + effects + .iter() + .filter(|e| **e == Effect::CommitSvnFloor(C0)) + .count(), + 1 + ); +} + +/// The SVN floor advance for C0 is outstanding and the Update Agent requests +/// C1, which has none. Neither SVN floor moves: the request is answered against +/// the component it names. +#[test] +fn an_svn_commit_for_another_component_is_dropped() { + let (effects, state) = drive( + chain(&[ + (C0, ComponentAttrs::passive_required()), + (C1, ComponentAttrs::passive_required()), + ]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + Event::UpdateRequest(C0), + Event::UpdateVerified, + Event::VerificationPassed(C0), + Event::VerificationPassed(C1), + Event::BootConfirmed(C0), + Event::SvnCommitRequest(C1), + ], + ); + + assert_eq!(state, State::Ready); + assert!(!effects.contains(&Effect::CommitSvnFloor(C0))); + assert!(!effects.contains(&Effect::CommitSvnFloor(C1))); +} + +/// A second update supersedes the first before the Update Agent requested it. +/// The SVN floor advance goes with it: the SVN it would take belongs to the +/// image the new update replaces, and the driver's reading of it is already +/// overwritten. +#[test] +fn a_superseding_update_voids_the_outstanding_advance() { + let (effects, state) = drive( + passive_required(&[C0]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::UpdateRequest(C0), + Event::UpdateVerified, + Event::VerificationPassed(C0), + Event::BootConfirmed(C0), + // A second update, staged and then rejected, so the machine + // passes through `Updating` and comes back to `Ready`. + Event::UpdateRequest(C0), + Event::UpdateRejected, + Event::SvnCommitRequest(C0), + ], + ); + + assert_eq!(state, State::Ready); + assert!(effects.contains(&Effect::DiscardStaged)); + assert!(!effects.contains(&Effect::CommitSvnFloor(C0))); +} + +/// Recovery puts the running image under suspicion, so an SVN floor advance the +/// agent has not requested yet is void. Requesting after the re-walk finds +/// nothing outstanding. +#[test] +fn recovery_voids_the_outstanding_advance() { + let (effects, state) = drive( + passive_required(&[C0]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::UpdateRequest(C0), + Event::UpdateVerified, + Event::VerificationPassed(C0), + Event::BootConfirmed(C0), + Event::CorruptionDetected(C0), + Event::Restored(C0), + Event::VerificationPassed(C0), + Event::SvnCommitRequest(C0), + ], + ); + + assert_eq!(state, State::Ready); + assert!(!effects.contains(&Effect::CommitSvnFloor(C0))); +} + +/// An isolable component is gated out of service after its boot was confirmed. +/// The state machine stays in `Ready`, so the SVN floor advance has to be +/// voided where the gating happens: requesting afterwards would move the floor +/// for an image held in reset as corrupt. +#[test] +fn gating_a_component_voids_its_outstanding_advance() { + let (effects, state) = drive( + chain(&[(C0, ComponentAttrs::passive_isolable())]), + &[ + BOOT, + Event::VerificationPassed(C0), + Event::UpdateRequest(C0), + Event::UpdateVerified, + Event::VerificationPassed(C0), + Event::BootConfirmed(C0), + Event::CorruptionDetected(C0), + Event::SvnCommitRequest(C0), + ], + ); + + assert_eq!(state, State::Ready); + assert!(effects.contains(&Effect::ReportIsolated(C0))); + assert!(!effects.contains(&Effect::CommitSvnFloor(C0))); +} + +/// The Update Agent requests the eRoT's SVN floor with UpdateSecurityRevision, +/// the same request it makes for any other component. Confirming the trial puts +/// the eRoT's id in `awaiting_floor_advance`, and a request naming that id is +/// answered with `Effect::CommitSvnFloor`. +#[test] +fn the_request_after_a_confirmed_self_trial_commits_the_erot_floor() { + let (effects, state) = drive( + erot_then_passive(&[C1]), + &[ + Event::SelfTrialBooted, + BOOT, + Event::VerificationPassed(C1), + Event::Booted(C1), + Event::SvnCommitRequest(C0), + ], + ); + + assert_eq!(state, State::Ready); + assert!( + effects.contains(&Effect::ConfirmSelfTrial), + "the trial was confirmed first: {effects:?}" + ); + assert!( + effects.contains(&Effect::CommitSvnFloor(C0)), + "the eRoT's SVN floor was committed: {effects:?}" + ); +} + +/// The same request with no trial behind it. No trial confirmed an SVN, so +/// there is no SVN floor advance outstanding and the request is dropped: +/// answering it would move the SVN floor for an image no boot confirmed. +#[test] +fn the_request_without_a_self_trial_is_dropped() { + let (effects, _) = drive( + erot_then_passive(&[C1]), + &[ + BOOT, + Event::VerificationPassed(C1), + Event::Booted(C1), + Event::SvnCommitRequest(C0), + ], + ); + + assert!( + !effects.contains(&Effect::CommitSvnFloor(C0)), + "nothing was outstanding: {effects:?}" + ); +} diff --git a/services/orchestrator/test/BUILD.bazel b/services/orchestrator/test/BUILD.bazel index 10919bb77..64ada2c2e 100644 --- a/services/orchestrator/test/BUILD.bazel +++ b/services/orchestrator/test/BUILD.bazel @@ -10,7 +10,10 @@ rust_library( srcs = ["devices.rs"], crate_name = "board_devices", edition = "2024", - deps = ["//services/orchestrator/config:orchestrator_config"], + deps = [ + "//services/orchestrator/config:orchestrator_config", + "//services/orchestrator/sm:orchestrator_sm", + ], ) rust_library( @@ -21,6 +24,18 @@ rust_library( deps = ["//services/orchestrator/capabilities:orchestrator_capabilities"], ) +rust_library( + name = "stubs", + srcs = ["stubs.rs"], + crate_name = "board_stubs", + edition = "2024", + deps = [ + "//services/orchestrator/capabilities:orchestrator_capabilities", + "//services/orchestrator/driver:orchestrator_driver", + "//services/orchestrator/sm:orchestrator_sm", + ], +) + # Host tests: build on the host platform, no kernel/QEMU. rust_test( name = "otp_test", diff --git a/services/orchestrator/test/devices.rs b/services/orchestrator/test/devices.rs index 98802697e..9809fa7bd 100644 --- a/services/orchestrator/test/devices.rs +++ b/services/orchestrator/test/devices.rs @@ -9,12 +9,16 @@ use core::time::Duration; -use orchestrator_config::{BootCheckpoint, DeviceConfig}; +use openprot_orchestrator_sm::ComponentAttrs; +use orchestrator_config::{ + assert_retry_reaches_every_image, chain_of, BootCheckpoint, ChainEntries, DeviceConfig, Golden, + ImageLayout, Region, Slot, SlotId, +}; -/// The mock board's boot-signal vocabulary. The schema carries these +/// The mock board's boot-probe vocabulary. The schema carries these /// opaquely; only this board's `EvidenceReader` gives them meaning. #[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum MockSignal { +pub enum MockProbe { /// A boot-complete GPIO line, by index. Gpio(u8), /// The device's MCTP endpoint answers as ready. @@ -24,13 +28,28 @@ pub enum MockSignal { Heartbeat, } +/// The BMC's images: two 2 MiB slots at the bottom of its firmware +/// partition, the golden image above them. +const BMC_LAYOUT: ImageLayout = ImageLayout::new( + const { + &[ + Slot::new(SlotId(0), Region::new(0x00_0000, 0x20_0000)), + Slot::new(SlotId(1), Region::new(0x20_0000, 0x20_0000)), + ] + }, + Some(Golden::new(Region::new(0x40_0000, 0x20_0000))), +); + /// Declaration order is the boot order: the orchestrator releases devices /// top to bottom, one at a time. This table is the authority — the /// orchestrator's chain of trust is built from it, never beside it. /// /// The mock board's reset controller addresses reset lines by plain index, /// so the reset id type is `u8`. -pub const MANAGED_DEVICES: &[DeviceConfig] = &[ +pub const DEVICES: [DeviceConfig; 3] = [ + // The eRoT itself, at chain position 0. Addressable, never supervised, + // and not updated here, so it carries no layout. + DeviceConfig::erot("erot", None), // Direct-flash SPI device (BMC archetype): the eRoT fronts its flash. // Single checkpoint: it raises a boot-complete GPIO. DeviceConfig::new( @@ -38,9 +57,16 @@ pub const MANAGED_DEVICES: &[DeviceConfig] = &[ 7, &[BootCheckpoint::new( "boot-complete", - MockSignal::Gpio(12), + MockProbe::Gpio(12), Duration::from_secs(90), )], + // A/B plus the golden image, in the flash the eRoT owns. Offsets + // are counted from the start of the BMC's flash area; real + // boards declare their own. + Some(BMC_LAYOUT), + // No iRoT of its own, so the eRoT's check is the only one and the + // boot-complete GPIO is the only signal it sends back. + ComponentAttrs::passive_required(), ), // PLDM device (NIC archetype): self-updating, SPDM-capable. Two // checkpoints, exercising the multi-checkpoint path: transport up @@ -49,24 +75,35 @@ pub const MANAGED_DEVICES: &[DeviceConfig] = &[ "nic", 3, &[ - BootCheckpoint::new("mctp-ready", MockSignal::MctpReady, Duration::from_secs(20)), - BootCheckpoint::new("heartbeat", MockSignal::Heartbeat, Duration::from_secs(10)), + BootCheckpoint::new("mctp-ready", MockProbe::MctpReady, Duration::from_secs(20)), + BootCheckpoint::new("heartbeat", MockProbe::Heartbeat, Duration::from_secs(10)), ], + // Self-updating device: it owns its images and its boot selection, + // so the eRoT addresses no byte range for it and declares no + // layout. + None, + // SPDM-capable, so it has an iRoT that verifies itself and reports + // ready once it has. + ComponentAttrs::active_required(), ), ]; +/// The orchestrator's chain for this board, derived from the table above so +/// the two cannot name different components. +pub const CHAIN: ChainEntries<{ DEVICES.len() }> = chain_of(&DEVICES); + /// Board-local checks the schema constructors cannot do — they know the /// schema's shape, not this board's meanings. Const-fence pattern: a bad -/// signal fails the build. -const fn validate_signals(devices: &[DeviceConfig]) { +/// probe fails the build. +const fn validate_probes(devices: &[DeviceConfig]) { let mut i = 0; while i < devices.len() { let checkpoints = devices[i].checkpoints(); let mut c = 0; while c < checkpoints.len() { - if let MockSignal::Gpio(line) = *checkpoints[c].signal() { + if let MockProbe::Gpio(line) = *checkpoints[c].probe() { // The mock ready-line bank packs 32 lines, SGPIO-style. - assert!(line < 32, "gpio signal names a line outside the bank"); + assert!(line < 32, "gpio probe names a line outside the bank"); } c += 1; } @@ -74,4 +111,12 @@ const fn validate_signals(devices: &[DeviceConfig]) { } } -const _: () = validate_signals(MANAGED_DEVICES); +const _: () = validate_probes(&DEVICES); + +/// How many times the orchestrator restores a component before it gives up. +/// Four, because the BMC has three images and the attempt that restores the +/// last one is never booted, so three would stop one boot short of the +/// golden image. +pub const MAX_RETRY: u8 = 4; + +const _: () = assert_retry_reaches_every_image(MAX_RETRY, &DEVICES); diff --git a/services/orchestrator/test/stubs.rs b/services/orchestrator/test/stubs.rs new file mode 100644 index 000000000..370784595 --- /dev/null +++ b/services/orchestrator/test/stubs.rs @@ -0,0 +1,71 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The board stubs every integration scenario needs and none of them +//! vary: [`BoardFault`], [`StubVerifier`] and [`StubImage`]. +//! +//! A scenario board has to name a type at every capability seam, even the +//! seams it does not exercise. Signature checking is one: the crypto +//! service does not exist yet, so each scenario stubbed it, and the three +//! copies were identical down to the comments. They live here so a change +//! to the `Verifier` or `ImageSource` contract is one edit. + +#![no_std] + +use openprot_orchestrator_driver::{ImageSource, Verdict, Verifier}; +use openprot_orchestrator_sm::ComponentId; +use orchestrator_capabilities::AuthenticatedImage; + +/// One board fault, for every seam that has to name an error type. A +/// scenario cares whether an actuation failed, never which one. +#[derive(Debug)] +pub struct BoardFault; + +impl core::fmt::Display for BoardFault { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.write_str("board fault") + } +} + +impl core::error::Error for BoardFault {} + +/// Signature checking is stubbed until the crypto service exists. +pub struct StubVerifier; + +impl Verifier for StubVerifier { + type Error = BoardFault; + + fn verify( + &mut self, + _id: ComponentId, + _image: &mut impl ImageSource, + ) -> Result { + Ok(Verdict::Authenticated(AuthenticatedImage { + // The stub verifier reads nothing: no manifest to take an SVN + // from, and no hash engine to measure with. + svn: None, + measurement: None, + })) + } +} + +/// The image a board names for a component whose bytes nothing reads. +/// [`StubVerifier`] authenticates without opening it, so `read_at` is the +/// one call that faults rather than serving bytes no image holds. +pub struct StubImage; + +impl ImageSource for StubImage { + type Error = BoardFault; + + fn open(&mut self) -> Result<(), BoardFault> { + Ok(()) + } + + fn size(&self) -> Result { + Ok(0) + } + + fn read_at(&mut self, _offset: usize, _buf: &mut [u8]) -> Result<(), BoardFault> { + Err(BoardFault) + } +} diff --git a/services/pldm/BUILD.bazel b/services/pldm/BUILD.bazel index d420d0b92..00883bbca 100644 --- a/services/pldm/BUILD.bazel +++ b/services/pldm/BUILD.bazel @@ -64,6 +64,25 @@ rust_test( ], ) +rust_test( + name = "inventory_host_test", + srcs = [ + "tests/common.rs", + "tests/inventory_host.rs", + ], + crate_root = "tests/inventory_host.rs", + edition = "2024", + deps = [ + ":pldm_service", + "//services/mctp/api:mctp_api", + "//services/mctp/server:mctp_server_lib", + "@rust_crates//:mctp", + "@rust_crates//:mctp-lib", + "@rust_crates//:pldm-common", + "@rust_crates//:pldm-interface", + ], +) + rust_test( name = "unexpected_eid_host_test", srcs = [ diff --git a/services/pldm/api/BUILD.bazel b/services/pldm/api/BUILD.bazel new file mode 100644 index 000000000..37aa11ae4 --- /dev/null +++ b/services/pldm/api/BUILD.bazel @@ -0,0 +1,16 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") + +rust_library( + name = "pldm_api", + srcs = glob(["src/**/*.rs"]), + edition = "2024", + visibility = ["//visibility:public"], +) + +rust_test( + name = "pldm_api_test", + crate = ":pldm_api", +) diff --git a/services/pldm/api/src/error.rs b/services/pldm/api/src/error.rs new file mode 100644 index 000000000..00db38bce --- /dev/null +++ b/services/pldm/api/src/error.rs @@ -0,0 +1,133 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Error types for the PLDM IPC wire protocol. + +use core::fmt; + +/// Wire-level decode/encode error. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum WireError { + /// Output buffer too small for the encoded message. + BufferTooSmall, + /// Payload exceeds the maximum allowed size. + PayloadTooLarge, + /// Unrecognized operation code. + InvalidOpcode(u8), + /// Input buffer too short for a complete header or payload. + Truncated, + /// Unrecognized enum value (status discriminant, reject reason, etc). + InvalidValue(u8), +} + +impl fmt::Display for WireError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::BufferTooSmall => f.write_str("buffer too small"), + Self::PayloadTooLarge => f.write_str("payload too large"), + Self::InvalidOpcode(op) => write!(f, "invalid opcode 0x{op:02x}"), + Self::Truncated => f.write_str("truncated"), + Self::InvalidValue(v) => write!(f, "invalid value 0x{v:02x}"), + } + } +} + +impl core::error::Error for WireError {} + +/// On-wire response code from the FD. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u8)] +pub enum ResponseCode { + /// Operation completed successfully. + Success = 0, + /// Internal server error. + InternalError = 1, + /// Unrecognized opcode (InvalidOp on the wire). + InvalidOp = 2, + /// Operation not valid in the FD's current phase. + WrongPhase = 3, + /// Request frame did not decode: short, over-long, or a field the + /// FD does not recognize. + MalformedRequest = 4, +} + +impl ResponseCode { + pub const fn is_success(self) -> bool { + matches!(self, Self::Success) + } + + pub const fn from_u8(val: u8) -> Option { + match val { + 0 => Some(Self::Success), + 1 => Some(Self::InternalError), + 2 => Some(Self::InvalidOp), + 3 => Some(Self::WrongPhase), + 4 => Some(Self::MalformedRequest), + _ => None, + } + } +} + +impl fmt::Display for ResponseCode { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Success => f.write_str("success"), + Self::InternalError => f.write_str("internal error"), + Self::InvalidOp => f.write_str("invalid op"), + Self::WrongPhase => f.write_str("wrong phase"), + Self::MalformedRequest => f.write_str("malformed request"), + } + } +} + +/// Reason the orchestrator denied an operation. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u8)] +pub enum RejectReason { + /// Component is isolated (compromise detected). + Isolated = 0, + /// Update policy violation. + PolicyViolation = 1, + /// Component identifier not recognized. + UnknownTarget = 2, + /// Another operation is in progress. + Busy = 3, +} + +impl RejectReason { + pub const fn from_u8(val: u8) -> Option { + match val { + 0 => Some(Self::Isolated), + 1 => Some(Self::PolicyViolation), + 2 => Some(Self::UnknownTarget), + 3 => Some(Self::Busy), + _ => None, + } + } +} + +impl fmt::Display for RejectReason { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Isolated => f.write_str("isolated"), + Self::PolicyViolation => f.write_str("policy violation"), + Self::UnknownTarget => f.write_str("unknown target"), + Self::Busy => f.write_str("busy"), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn response_code_from_u8_roundtrip() { + for val in 0u8..=4 { + let code = ResponseCode::from_u8(val).expect("known code"); + assert_eq!(code as u8, val); + } + assert_eq!(ResponseCode::from_u8(5), None); + assert_eq!(ResponseCode::from_u8(255), None); + } +} diff --git a/services/pldm/api/src/lib.rs b/services/pldm/api/src/lib.rs new file mode 100644 index 000000000..88497b05c --- /dev/null +++ b/services/pldm/api/src/lib.rs @@ -0,0 +1,23 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! PLDM IPC API: wire format and types. +//! +//! Defines the binary protocol the orchestrator uses to talk to the +//! PLDM Firmware Device over IPC. Host-buildable, no kernel +//! dependencies. The server and client crates depend on this for +//! shared types; neither re-invents the encoding. The transport that +//! carries these frames is `util_service`, shared with every other +//! IPC service. + +#![no_std] + +pub mod error; +pub mod status; +pub mod wire; + +pub use error::{RejectReason, ResponseCode, WireError}; +pub use status::{FdStatus, TransferMode}; +pub use wire::{ + PldmOp, RequestHeader, ResponseHeader, MAX_PAYLOAD_SIZE, MAX_REQUEST_SIZE, MAX_RESPONSE_SIZE, +}; diff --git a/services/pldm/api/src/status.rs b/services/pldm/api/src/status.rs new file mode 100644 index 000000000..19f6e246f --- /dev/null +++ b/services/pldm/api/src/status.rs @@ -0,0 +1,342 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! FD status for QueryStatus responses. +//! +//! The status payload follows the response header and carries the FD's +//! current condition. The orchestrator always follows a nudge with +//! QueryStatus to learn what happened, so the status is the primary +//! communication channel from the FD. + +use crate::error::WireError; + +/// In-transport vs out-of-transport image transfer. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u8)] +pub enum TransferMode { + /// FD pulls firmware chunks from the UA over MCTP. + InTransport = 0, + /// A third party writes the image to staging before verify. + OutOfTransport = 1, +} + +impl TransferMode { + pub const fn from_u8(val: u8) -> Option { + match val { + 0 => Some(Self::InTransport), + 1 => Some(Self::OutOfTransport), + _ => None, + } + } +} + +/// Current condition of the FD, returned by QueryStatus. +/// +/// Some variants map to DSP0267 states (Idle, ReadyXfer), some to +/// pending decisions the orchestrator owes the FD (OfferPending, +/// VerifyPending, ApplyPending, ActivationPending, SvnCommitPending), +/// and PhaseFailed is a verify/apply failure the UA has not yet +/// cancelled. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum FdStatus { + /// No update in progress. `reason` is the DSP0267 + /// GetStatusReasonCode (0 = Initialization, others per spec). + Idle { reason: u8 }, + + /// UA has sent UpdateComponent, FD is ready for transfer. + ReadyXfer, + + /// FD has an offer the orchestrator has not yet accepted or + /// rejected. `target` is the PLDM component identifier, `total` + /// is the image size in bytes. `svn_delayed` is true when the UA + /// requested delayed SVN update (DSP0267 bit 9). + OfferPending { + target: u16, + total: u32, + mode: TransferMode, + svn_delayed: bool, + }, + + /// Transfer complete, FD waiting for PerformVerify. + VerifyPending, + + /// Verify complete, FD waiting for PerformApply. + ApplyPending, + + /// Apply complete, FD waiting for PerformActivate. + ActivationPending, + + /// UA sent UpdateSecurityRevision, FD waiting for + /// PerformSvnCommit. `component` is the target identifier. + SvnCommitPending { component: u16 }, + + /// Verify or apply failed. `phase` and `result_code` are the + /// DSP0267 values the FD already sent the UA. + PhaseFailed { phase: u8, result_code: u8 }, + + /// UA sent CancelUpdate, FD waiting for AckCancel. + Cancelled, +} + +/// Wire tag for [`FdStatus`] variants. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u8)] +enum Tag { + Idle = 0, + ReadyXfer = 1, + OfferPending = 2, + VerifyPending = 3, + ApplyPending = 4, + ActivationPending = 5, + SvnCommitPending = 6, + PhaseFailed = 7, + Cancelled = 8, +} + +impl Tag { + const fn from_u8(val: u8) -> Option { + match val { + 0 => Some(Self::Idle), + 1 => Some(Self::ReadyXfer), + 2 => Some(Self::OfferPending), + 3 => Some(Self::VerifyPending), + 4 => Some(Self::ApplyPending), + 5 => Some(Self::ActivationPending), + 6 => Some(Self::SvnCommitPending), + 7 => Some(Self::PhaseFailed), + 8 => Some(Self::Cancelled), + _ => None, + } + } +} + +/// Encode a single-byte (tag-only) variant. +fn encode_tag(buf: &mut [u8], tag: Tag) -> Result { + if buf.is_empty() { + return Err(WireError::BufferTooSmall); + } + buf[0] = tag as u8; + Ok(1) +} + +impl FdStatus { + /// Maximum encoded size of a status payload (OfferPending: 9 bytes). + pub const MAX_SIZE: usize = 9; + + /// Encode into `buf`, returning the number of bytes written. + pub fn encode(&self, buf: &mut [u8]) -> Result { + match *self { + Self::Idle { reason } => { + if buf.len() < 2 { + return Err(WireError::BufferTooSmall); + } + buf[0] = Tag::Idle as u8; + buf[1] = reason; // DSP0267 GetStatusReasonCode + Ok(2) + } + Self::ReadyXfer => encode_tag(buf, Tag::ReadyXfer), + Self::OfferPending { + target, + total, + mode, + svn_delayed, + } => { + if buf.len() < Self::MAX_SIZE { + return Err(WireError::BufferTooSmall); + } + buf[0] = Tag::OfferPending as u8; + buf[1..3].copy_from_slice(&target.to_le_bytes()); // component id + buf[3..7].copy_from_slice(&total.to_le_bytes()); // image size + buf[7] = mode as u8; + buf[8] = svn_delayed as u8; + Ok(Self::MAX_SIZE) + } + Self::VerifyPending => encode_tag(buf, Tag::VerifyPending), + Self::ApplyPending => encode_tag(buf, Tag::ApplyPending), + Self::ActivationPending => encode_tag(buf, Tag::ActivationPending), + Self::SvnCommitPending { component } => { + if buf.len() < 3 { + return Err(WireError::BufferTooSmall); + } + buf[0] = Tag::SvnCommitPending as u8; + buf[1..3].copy_from_slice(&component.to_le_bytes()); // component id + Ok(3) + } + Self::PhaseFailed { phase, result_code } => { + if buf.len() < 3 { + return Err(WireError::BufferTooSmall); + } + buf[0] = Tag::PhaseFailed as u8; + buf[1] = phase; // DSP0267 phase code + buf[2] = result_code; // DSP0267 result code + Ok(3) + } + Self::Cancelled => encode_tag(buf, Tag::Cancelled), + } + } + + /// Decode from `buf`. + pub fn decode(buf: &[u8]) -> Result { + if buf.is_empty() { + return Err(WireError::Truncated); + } + let tag = Tag::from_u8(buf[0]).ok_or(WireError::InvalidValue(buf[0]))?; + match tag { + Tag::Idle => { + if buf.len() < 2 { + return Err(WireError::Truncated); + } + Ok(Self::Idle { reason: buf[1] }) + } + Tag::ReadyXfer => Ok(Self::ReadyXfer), + Tag::OfferPending => { + if buf.len() < Self::MAX_SIZE { + return Err(WireError::Truncated); + } + let target = u16::from_le_bytes([buf[1], buf[2]]); + let total = u32::from_le_bytes([buf[3], buf[4], buf[5], buf[6]]); + let mode = TransferMode::from_u8(buf[7]).ok_or(WireError::InvalidValue(buf[7]))?; + let svn_delayed = buf[8] != 0; + Ok(Self::OfferPending { + target, + total, + mode, + svn_delayed, + }) + } + Tag::VerifyPending => Ok(Self::VerifyPending), + Tag::ApplyPending => Ok(Self::ApplyPending), + Tag::ActivationPending => Ok(Self::ActivationPending), + Tag::SvnCommitPending => { + if buf.len() < 3 { + return Err(WireError::Truncated); + } + let component = u16::from_le_bytes([buf[1], buf[2]]); + Ok(Self::SvnCommitPending { component }) + } + Tag::PhaseFailed => { + if buf.len() < 3 { + return Err(WireError::Truncated); + } + Ok(Self::PhaseFailed { + phase: buf[1], + result_code: buf[2], + }) + } + Tag::Cancelled => Ok(Self::Cancelled), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn idle_roundtrip() { + // reason is a DSP0267 GetStatusReasonCode, arbitrary nonzero value + let s = FdStatus::Idle { reason: 3 }; + let mut buf = [0u8; 16]; + let len = s.encode(&mut buf).unwrap(); + assert_eq!(len, 2); + assert_eq!(FdStatus::decode(&buf[..len]), Ok(s)); + } + + #[test] + fn offer_pending_roundtrip() { + let s = FdStatus::OfferPending { + target: 0x1234, // component identifier + total: 0x0010_0000, // 1 MiB image + mode: TransferMode::InTransport, + svn_delayed: false, + }; + let mut buf = [0u8; 16]; + let len = s.encode(&mut buf).unwrap(); + assert_eq!(len, FdStatus::MAX_SIZE); + assert_eq!(FdStatus::decode(&buf[..len]), Ok(s)); + } + + #[test] + fn offer_pending_svn_delayed() { + let s = FdStatus::OfferPending { + target: 1, + total: 4096, + mode: TransferMode::OutOfTransport, + svn_delayed: true, + }; + let mut buf = [0u8; 16]; + let len = s.encode(&mut buf).unwrap(); + assert_eq!(FdStatus::decode(&buf[..len]), Ok(s)); + } + + #[test] + fn simple_variants_roundtrip() { + for s in [ + FdStatus::ReadyXfer, + FdStatus::VerifyPending, + FdStatus::ApplyPending, + FdStatus::ActivationPending, + FdStatus::Cancelled, + ] { + let mut buf = [0u8; 16]; + let len = s.encode(&mut buf).unwrap(); + assert_eq!(len, 1); + assert_eq!(FdStatus::decode(&buf[..len]), Ok(s)); + } + } + + #[test] + fn svn_commit_pending_roundtrip() { + let s = FdStatus::SvnCommitPending { component: 255 }; + let mut buf = [0u8; 16]; + let len = s.encode(&mut buf).unwrap(); + assert_eq!(len, 3); + assert_eq!(FdStatus::decode(&buf[..len]), Ok(s)); + } + + #[test] + fn phase_failed_roundtrip() { + // phase and result_code are DSP0267 values, arbitrary here + let s = FdStatus::PhaseFailed { + phase: 2, + result_code: 10, + }; + let mut buf = [0u8; 16]; + let len = s.encode(&mut buf).unwrap(); + assert_eq!(len, 3); + assert_eq!(FdStatus::decode(&buf[..len]), Ok(s)); + } + + #[test] + fn decode_empty_is_truncated() { + assert_eq!(FdStatus::decode(&[]), Err(WireError::Truncated)); + } + + #[test] + fn decode_unknown_discriminant() { + assert_eq!( + FdStatus::decode(&[0xFF]), + Err(WireError::InvalidValue(0xFF)) + ); + } + + #[test] + fn decode_offer_pending_truncated() { + assert_eq!( + FdStatus::decode(&[Tag::OfferPending as u8, 0, 0]), + Err(WireError::Truncated) + ); + } + + #[test] + fn encode_offer_pending_buffer_too_small() { + let s = FdStatus::OfferPending { + target: 1, + total: 1, + mode: TransferMode::InTransport, + svn_delayed: false, + }; + let mut buf = [0u8; 4]; + assert_eq!(s.encode(&mut buf), Err(WireError::BufferTooSmall)); + } +} diff --git a/services/pldm/api/src/wire.rs b/services/pldm/api/src/wire.rs new file mode 100644 index 000000000..0e973c76a --- /dev/null +++ b/services/pldm/api/src/wire.rs @@ -0,0 +1,626 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! PLDM IPC wire protocol. +//! +//! Binary wire protocol for orchestrator-to-FD operations over IPC +//! channels. Uses manual byte encoding for `no_std` compatibility. +//! +//! ```text +//! Request (8-byte header + optional args): +//! +----+-------+-----+----------+ +//! | op | flags | gen | reserved | + [args] +//! | 1B | 1B | 2B | 4B | +//! +----+-------+-----+----------+ +//! +//! Response (8-byte header + optional payload): +//! +------+-------+-----+-------------+----------+ +//! | code | flags | gen | payload_len | reserved | + [payload] +//! | 1B | 1B | 2B | 2B LE | 2B | +//! +------+-------+-----+-------------+----------+ +//! ``` + +use crate::error::{RejectReason, ResponseCode, WireError}; +use crate::status::FdStatus; + +// ============================================================================ +// Operation codes +// ============================================================================ + +/// Orchestrator-to-FD IPC operations. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u8)] +pub enum PldmOp { + /// Approve the pending offer, provide staging flash base address. + AcceptOffer = 0, + /// Reject the pending offer, FD sends TransferComplete. + RejectOffer = 1, + /// Tell the FD to run FdOps::verify. + PerformVerify = 2, + /// Tell the FD not to verify (e.g. isolated component). + RejectVerify = 3, + /// Tell the FD to run FdOps::apply. + PerformApply = 4, + /// Tell the FD not to apply. + RejectApply = 5, + /// Read the FD's current state (phase, result, error). + QueryStatus = 6, + /// Tell the FD to activate, ahead of the UA's request. + PerformActivate = 7, + /// Refuse activation, or take back a PerformActivate the FD has stored + /// and the UA has not yet claimed. FD answers the UA with + /// INCOMPLETE_UPDATE. + RejectActivate = 8, + /// Acknowledge cancel, release orchestrator-side resources. + AckCancel = 9, + /// Tell the FD the SVN floor is raised so it can answer the UA. + PerformSvnCommit = 10, + /// Tell the FD the floor did not move. + RejectSvnCommit = 11, +} + +impl PldmOp { + pub fn from_u8(val: u8) -> Option { + match val { + 0 => Some(Self::AcceptOffer), + 1 => Some(Self::RejectOffer), + 2 => Some(Self::PerformVerify), + 3 => Some(Self::RejectVerify), + 4 => Some(Self::PerformApply), + 5 => Some(Self::RejectApply), + 6 => Some(Self::QueryStatus), + 7 => Some(Self::PerformActivate), + 8 => Some(Self::RejectActivate), + 9 => Some(Self::AckCancel), + 10 => Some(Self::PerformSvnCommit), + 11 => Some(Self::RejectSvnCommit), + _ => None, + } + } +} + +// ============================================================================ +// Request header +// ============================================================================ + +/// Request header (8 bytes). +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct RequestHeader { + pub op: u8, + pub flags: u8, + /// Phase generation. Reserved, set to 0. + pub generation: u16, +} + +impl RequestHeader { + pub const SIZE: usize = 8; + + pub fn to_bytes(&self) -> [u8; Self::SIZE] { + let g = self.generation.to_le_bytes(); + [self.op, self.flags, g[0], g[1], 0, 0, 0, 0] + } + + pub fn from_bytes(bytes: &[u8]) -> Option { + if bytes.len() < Self::SIZE { + return None; + } + Some(Self { + op: bytes[0], + flags: bytes[1], + generation: u16::from_le_bytes([bytes[2], bytes[3]]), + }) + } + + pub fn operation(&self) -> Option { + PldmOp::from_u8(self.op) + } +} + +// ============================================================================ +// Response header +// ============================================================================ + +/// Response header (8 bytes). +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct ResponseHeader { + pub code: u8, + pub flags: u8, + /// Phase generation. Reserved, set to 0. + pub generation: u16, + pub payload_len: u16, +} + +impl ResponseHeader { + pub const SIZE: usize = 8; + + pub const fn success() -> Self { + Self { + code: ResponseCode::Success as u8, + flags: 0, + generation: 0, + payload_len: 0, + } + } + + pub const fn error(code: ResponseCode) -> Self { + Self { + code: code as u8, + flags: 0, + generation: 0, + payload_len: 0, + } + } + + pub fn is_success(&self) -> bool { + self.code == ResponseCode::Success as u8 + } + + pub fn response_code(&self) -> ResponseCode { + ResponseCode::from_u8(self.code).unwrap_or(ResponseCode::InternalError) + } + + pub fn to_bytes(&self) -> [u8; Self::SIZE] { + let g = self.generation.to_le_bytes(); + let pl = self.payload_len.to_le_bytes(); + [self.code, self.flags, g[0], g[1], pl[0], pl[1], 0, 0] + } + + pub fn from_bytes(bytes: &[u8]) -> Option { + if bytes.len() < Self::SIZE { + return None; + } + Some(Self { + code: bytes[0], + flags: bytes[1], + generation: u16::from_le_bytes([bytes[2], bytes[3]]), + payload_len: u16::from_le_bytes([bytes[4], bytes[5]]), + }) + } +} + +// ============================================================================ +// Constants +// ============================================================================ + +/// Maximum status payload (OfferPending: 9 bytes). +pub const MAX_PAYLOAD_SIZE: usize = FdStatus::MAX_SIZE; + +/// Maximum total request size (header + AcceptOffer args). +pub const MAX_REQUEST_SIZE: usize = RequestHeader::SIZE + 4; + +/// How long a well-formed request is for a given operation. The decoder +/// reads a fixed header and ignores anything past it, so a frame longer +/// than expected would dispatch as if the extra bytes were not there. +pub const fn expected_request_len(op: PldmOp) -> usize { + match op { + PldmOp::AcceptOffer => RequestHeader::SIZE + 4, + PldmOp::RejectOffer + | PldmOp::RejectVerify + | PldmOp::RejectApply + | PldmOp::RejectActivate + | PldmOp::RejectSvnCommit => RequestHeader::SIZE + 1, + PldmOp::PerformVerify + | PldmOp::PerformApply + | PldmOp::QueryStatus + | PldmOp::PerformActivate + | PldmOp::AckCancel + | PldmOp::PerformSvnCommit => RequestHeader::SIZE, + } +} + +/// Maximum total response size (header + QueryStatus payload). +pub const MAX_RESPONSE_SIZE: usize = ResponseHeader::SIZE + MAX_PAYLOAD_SIZE; + +// ============================================================================ +// Request encoding +// ============================================================================ + +fn encode_with_reason( + buf: &mut [u8], + op: PldmOp, + reason: RejectReason, +) -> Result { + let total = RequestHeader::SIZE + 1; + if buf.len() < total { + return Err(WireError::BufferTooSmall); + } + let h = RequestHeader { + op: op as u8, + flags: 0, + generation: 0, + }; + buf[..RequestHeader::SIZE].copy_from_slice(&h.to_bytes()); + buf[RequestHeader::SIZE] = reason as u8; + Ok(total) +} + +fn encode_header_only(buf: &mut [u8], op: PldmOp) -> Result { + if buf.len() < RequestHeader::SIZE { + return Err(WireError::BufferTooSmall); + } + let h = RequestHeader { + op: op as u8, + flags: 0, + generation: 0, + }; + buf[..RequestHeader::SIZE].copy_from_slice(&h.to_bytes()); + Ok(RequestHeader::SIZE) +} + +/// Encode AcceptOffer. `staging_base` is the flash address the FD +/// should stage firmware to. +pub fn encode_accept_offer(buf: &mut [u8], staging_base: u32) -> Result { + let total = RequestHeader::SIZE + 4; + if buf.len() < total { + return Err(WireError::BufferTooSmall); + } + let h = RequestHeader { + op: PldmOp::AcceptOffer as u8, + flags: 0, + generation: 0, + }; + buf[..RequestHeader::SIZE].copy_from_slice(&h.to_bytes()); + buf[RequestHeader::SIZE..total].copy_from_slice(&staging_base.to_le_bytes()); + Ok(total) +} + +/// Encode RejectOffer with the reason the orchestrator is refusing. +pub fn encode_reject_offer(buf: &mut [u8], reason: RejectReason) -> Result { + encode_with_reason(buf, PldmOp::RejectOffer, reason) +} + +pub fn encode_perform_verify(buf: &mut [u8]) -> Result { + encode_header_only(buf, PldmOp::PerformVerify) +} + +/// Encode RejectVerify with the reason the orchestrator is blocking. +pub fn encode_reject_verify(buf: &mut [u8], reason: RejectReason) -> Result { + encode_with_reason(buf, PldmOp::RejectVerify, reason) +} + +pub fn encode_perform_apply(buf: &mut [u8]) -> Result { + encode_header_only(buf, PldmOp::PerformApply) +} + +/// Encode RejectApply with the reason the orchestrator is blocking. +pub fn encode_reject_apply(buf: &mut [u8], reason: RejectReason) -> Result { + encode_with_reason(buf, PldmOp::RejectApply, reason) +} + +pub fn encode_query_status(buf: &mut [u8]) -> Result { + encode_header_only(buf, PldmOp::QueryStatus) +} + +pub fn encode_perform_activate(buf: &mut [u8]) -> Result { + encode_header_only(buf, PldmOp::PerformActivate) +} + +pub fn encode_reject_activate(buf: &mut [u8], reason: RejectReason) -> Result { + encode_with_reason(buf, PldmOp::RejectActivate, reason) +} + +pub fn encode_ack_cancel(buf: &mut [u8]) -> Result { + encode_header_only(buf, PldmOp::AckCancel) +} + +pub fn encode_perform_svn_commit(buf: &mut [u8]) -> Result { + encode_header_only(buf, PldmOp::PerformSvnCommit) +} + +/// Encode RejectSvnCommit with the reason the orchestrator is blocking. +pub fn encode_reject_svn_commit(buf: &mut [u8], reason: RejectReason) -> Result { + encode_with_reason(buf, PldmOp::RejectSvnCommit, reason) +} + +// ============================================================================ +// Response encoding (server side) +// ============================================================================ + +/// Encode a success response with no payload. +pub fn encode_success_response(buf: &mut [u8]) -> Result { + if buf.len() < ResponseHeader::SIZE { + return Err(WireError::BufferTooSmall); + } + buf[..ResponseHeader::SIZE].copy_from_slice(&ResponseHeader::success().to_bytes()); + Ok(ResponseHeader::SIZE) +} + +/// Encode an error response. +pub fn encode_error_response(buf: &mut [u8], code: ResponseCode) -> Result { + if buf.len() < ResponseHeader::SIZE { + return Err(WireError::BufferTooSmall); + } + buf[..ResponseHeader::SIZE].copy_from_slice(&ResponseHeader::error(code).to_bytes()); + Ok(ResponseHeader::SIZE) +} + +/// Encode a QueryStatus success response with the FD's current status. +pub fn encode_status_response(buf: &mut [u8], status: &FdStatus) -> Result { + let mut payload_buf = [0u8; FdStatus::MAX_SIZE]; + let payload_len = status.encode(&mut payload_buf)?; + let total = ResponseHeader::SIZE + payload_len; + if buf.len() < total { + return Err(WireError::BufferTooSmall); + } + let mut h = ResponseHeader::success(); + h.payload_len = payload_len as u16; + buf[..ResponseHeader::SIZE].copy_from_slice(&h.to_bytes()); + buf[ResponseHeader::SIZE..total].copy_from_slice(&payload_buf[..payload_len]); + Ok(total) +} + +// ============================================================================ +// Response decoding (client side) +// ============================================================================ + +/// Decode a response header. +pub fn decode_response_header(buf: &[u8]) -> Result { + ResponseHeader::from_bytes(buf).ok_or(WireError::Truncated) +} + +/// Extract the response payload bytes (after the header). +pub fn get_response_payload<'a>( + buf: &'a [u8], + header: &ResponseHeader, +) -> Result<&'a [u8], WireError> { + let end = ResponseHeader::SIZE + header.payload_len as usize; + if buf.len() < end { + return Err(WireError::Truncated); + } + Ok(&buf[ResponseHeader::SIZE..end]) +} + +/// Decode a request header. +pub fn decode_request_header(buf: &[u8]) -> Result { + RequestHeader::from_bytes(buf).ok_or(WireError::Truncated) +} + +/// Get the request args (bytes after the header). +pub fn get_request_args(buf: &[u8]) -> &[u8] { + if buf.len() > RequestHeader::SIZE { + &buf[RequestHeader::SIZE..] + } else { + &[] + } +} + +/// Extract the staging base address from an AcceptOffer request's args. +pub fn get_accept_offer_base(args: &[u8]) -> Result { + if args.len() < 4 { + return Err(WireError::Truncated); + } + Ok(u32::from_le_bytes([args[0], args[1], args[2], args[3]])) +} + +/// Extract the reject reason from a Reject* request's args. +pub fn get_reject_reason(args: &[u8]) -> Result { + if args.is_empty() { + return Err(WireError::Truncated); + } + RejectReason::from_u8(args[0]).ok_or(WireError::InvalidValue(args[0])) +} + +// ============================================================================ +// Tests +// ============================================================================ + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn request_header_roundtrip() { + let h = RequestHeader { + op: PldmOp::QueryStatus as u8, + flags: 0, + generation: 0x1234, + }; + let bytes = h.to_bytes(); + let decoded = RequestHeader::from_bytes(&bytes).unwrap(); + assert_eq!(decoded.op, PldmOp::QueryStatus as u8); + assert_eq!(decoded.generation, 0x1234); + } + + #[test] + fn response_header_roundtrip() { + let h = ResponseHeader { + code: ResponseCode::Success as u8, + flags: 0, + generation: 0, + payload_len: 8, + }; + let bytes = h.to_bytes(); + let decoded = ResponseHeader::from_bytes(&bytes).unwrap(); + assert!(decoded.is_success()); + assert_eq!(decoded.payload_len, 8); + } + + #[test] + fn encode_accept_offer_roundtrip() { + let mut buf = [0u8; 16]; + let len = encode_accept_offer(&mut buf, 0x2000_0000).unwrap(); + assert_eq!(len, 12); + let h = decode_request_header(&buf).unwrap(); + assert_eq!(h.operation(), Some(PldmOp::AcceptOffer)); + let args = get_request_args(&buf[..len]); + assert_eq!(get_accept_offer_base(args).unwrap(), 0x2000_0000); + } + + #[test] + fn encode_reject_verify_roundtrip() { + let mut buf = [0u8; 16]; + let len = encode_reject_verify(&mut buf, RejectReason::Isolated).unwrap(); + assert_eq!(len, 9); + let h = decode_request_header(&buf).unwrap(); + assert_eq!(h.operation(), Some(PldmOp::RejectVerify)); + let args = get_request_args(&buf[..len]); + assert_eq!(get_reject_reason(args).unwrap(), RejectReason::Isolated); + } + + #[test] + fn encode_reject_apply_roundtrip() { + let mut buf = [0u8; 16]; + let len = encode_reject_apply(&mut buf, RejectReason::PolicyViolation).unwrap(); + let args = get_request_args(&buf[..len]); + assert_eq!( + get_reject_reason(args).unwrap(), + RejectReason::PolicyViolation + ); + } + + #[test] + fn encode_reject_svn_commit_roundtrip() { + let mut buf = [0u8; 16]; + let len = encode_reject_svn_commit(&mut buf, RejectReason::PolicyViolation).unwrap(); + assert_eq!(len, 9); + let h = decode_request_header(&buf).unwrap(); + assert_eq!(h.operation(), Some(PldmOp::RejectSvnCommit)); + let args = get_request_args(&buf[..len]); + assert_eq!( + get_reject_reason(args).unwrap(), + RejectReason::PolicyViolation + ); + } + + #[test] + fn encode_reject_activate_roundtrip() { + let mut buf = [0u8; 16]; + let len = encode_reject_activate(&mut buf, RejectReason::UnknownTarget).unwrap(); + let h = decode_request_header(&buf).unwrap(); + assert_eq!(h.operation(), Some(PldmOp::RejectActivate)); + let args = get_request_args(&buf[..len]); + assert_eq!( + get_reject_reason(args).unwrap(), + RejectReason::UnknownTarget + ); + } + + #[test] + fn header_only_ops_roundtrip() { + let ops = [ + ( + encode_perform_verify as fn(&mut [u8]) -> _, + PldmOp::PerformVerify, + ), + (encode_perform_apply, PldmOp::PerformApply), + (encode_query_status, PldmOp::QueryStatus), + (encode_perform_activate, PldmOp::PerformActivate), + (encode_ack_cancel, PldmOp::AckCancel), + (encode_perform_svn_commit, PldmOp::PerformSvnCommit), + ]; + for (encode_fn, expected_op) in ops { + let mut buf = [0u8; 16]; + let len = encode_fn(&mut buf).unwrap(); + assert_eq!(len, RequestHeader::SIZE); + let h = decode_request_header(&buf).unwrap(); + assert_eq!(h.operation(), Some(expected_op)); + } + } + + #[test] + fn status_response_roundtrip() { + let status = FdStatus::OfferPending { + target: 0x0001, + total: 0x0008_0000, + mode: crate::status::TransferMode::InTransport, + svn_delayed: true, + }; + let mut buf = [0u8; 32]; + let len = encode_status_response(&mut buf, &status).unwrap(); + let h = decode_response_header(&buf).unwrap(); + assert!(h.is_success()); + assert_eq!(h.payload_len, 9); + let payload = get_response_payload(&buf[..len], &h).unwrap(); + let decoded = FdStatus::decode(payload).unwrap(); + assert_eq!(decoded, status); + } + + #[test] + fn error_response_roundtrip() { + let mut buf = [0u8; 16]; + let len = encode_error_response(&mut buf, ResponseCode::WrongPhase).unwrap(); + assert_eq!(len, ResponseHeader::SIZE); + let h = decode_response_header(&buf).unwrap(); + assert!(!h.is_success()); + assert_eq!(h.response_code(), ResponseCode::WrongPhase); + } + + #[test] + fn success_response_roundtrip() { + let mut buf = [0u8; 16]; + let len = encode_success_response(&mut buf).unwrap(); + assert_eq!(len, ResponseHeader::SIZE); + let h = decode_response_header(&buf).unwrap(); + assert!(h.is_success()); + assert_eq!(h.payload_len, 0); + } + + #[test] + fn unknown_opcode() { + assert_eq!(PldmOp::from_u8(0xFF), None); + } + + #[test] + fn decode_request_truncated() { + assert_eq!(decode_request_header(&[0u8; 4]), Err(WireError::Truncated)); + } + + #[test] + fn decode_response_truncated() { + assert_eq!(decode_response_header(&[0u8; 4]), Err(WireError::Truncated)); + } + + #[test] + fn get_response_payload_truncated() { + let mut h = ResponseHeader::success(); + h.payload_len = 100; + let mut buf = [0u8; 16]; + buf[..ResponseHeader::SIZE].copy_from_slice(&h.to_bytes()); + assert_eq!( + get_response_payload(&buf[..ResponseHeader::SIZE], &h), + Err(WireError::Truncated) + ); + } + + #[test] + fn buffer_too_small_errors() { + let mut buf = [0u8; 4]; + assert_eq!( + encode_accept_offer(&mut buf, 0), + Err(WireError::BufferTooSmall) + ); + assert_eq!( + encode_reject_offer(&mut buf, RejectReason::Busy), + Err(WireError::BufferTooSmall) + ); + assert_eq!( + encode_reject_verify(&mut buf, RejectReason::Busy), + Err(WireError::BufferTooSmall) + ); + assert_eq!( + encode_success_response(&mut buf), + Err(WireError::BufferTooSmall) + ); + assert_eq!( + encode_error_response(&mut buf, ResponseCode::InternalError), + Err(WireError::BufferTooSmall) + ); + } + + #[test] + fn get_request_args_empty_for_header_only() { + let mut buf = [0u8; 16]; + encode_query_status(&mut buf).unwrap(); + assert_eq!(get_request_args(&buf[..RequestHeader::SIZE]), &[]); + } + + #[test] + fn get_accept_offer_base_truncated() { + assert_eq!(get_accept_offer_base(&[0, 0]), Err(WireError::Truncated)); + } + + #[test] + fn get_deny_reason_truncated() { + assert_eq!(get_reject_reason(&[]), Err(WireError::Truncated)); + } +} diff --git a/services/pldm/client/BUILD.bazel b/services/pldm/client/BUILD.bazel new file mode 100644 index 000000000..e982e175c --- /dev/null +++ b/services/pldm/client/BUILD.bazel @@ -0,0 +1,21 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") + +rust_library( + name = "pldm_client", + srcs = glob(["src/**/*.rs"]), + edition = "2024", + visibility = ["//visibility:public"], + deps = [ + "//services/pldm/api:pldm_api", + "//util/service", + ], +) + +rust_test( + name = "pldm_client_test", + crate = ":pldm_client", + deps = ["//services/pldm/server:pldm_server"], +) diff --git a/services/pldm/client/src/client.rs b/services/pldm/client/src/client.rs new file mode 100644 index 000000000..c6382222e --- /dev/null +++ b/services/pldm/client/src/client.rs @@ -0,0 +1,534 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The client handle and the answers it collects. + +use pldm_api::wire::{self, PldmOp, MAX_REQUEST_SIZE, MAX_RESPONSE_SIZE}; +use pldm_api::{FdStatus, RejectReason, WireError}; +use util_service::AsyncTransport; + +use crate::ClientError; + +/// What the Firmware Device answered. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Reply { + /// The FD took the request. Every operation but `QueryStatus` + /// answers this or a refusal. An acknowledgement, not a verdict: + /// what the request sets in motion runs afterwards, and + /// `QueryStatus` is what reports how it went. + Acked, + /// The FD's current condition, from `QueryStatus`. + Status(FdStatus), +} + +/// The orchestrator's handle on one Firmware Device. +pub struct FdIpcClient { + transport: T, + /// What was asked, while the answer is outstanding. The response + /// frame does not name the operation, so this is what says how to + /// read the payload. + in_flight: Option, + response: [u8; MAX_RESPONSE_SIZE], +} + +impl FdIpcClient { + pub const fn new(transport: T) -> Self { + Self { + transport, + in_flight: None, + response: [0u8; MAX_RESPONSE_SIZE], + } + } + + /// The operation waiting for an answer, if any. The event loop reads + /// it to decide whether this device still owes it a poll. + pub fn in_flight(&self) -> Option { + self.in_flight + } + + /// The transport, to register its channel with a wait group. + pub fn transport(&self) -> &T { + &self.transport + } +} + +impl FdIpcClient { + /// Accept the offer and tell the FD where to stage. + pub fn accept_offer(&mut self, staging_base: u32) -> Result<(), ClientError> { + self.start(PldmOp::AcceptOffer, |buf| { + wire::encode_accept_offer(buf, staging_base) + }) + } + + /// Refuse the offer, with the reason the requester is owed. + pub fn reject_offer(&mut self, reason: RejectReason) -> Result<(), ClientError> { + self.start(PldmOp::RejectOffer, |buf| { + wire::encode_reject_offer(buf, reason) + }) + } + + /// Tell the FD to verify what it staged. + pub fn perform_verify(&mut self) -> Result<(), ClientError> { + self.start(PldmOp::PerformVerify, wire::encode_perform_verify) + } + + /// Tell the FD not to verify, with the reason the requester is owed. + pub fn reject_verify(&mut self, reason: RejectReason) -> Result<(), ClientError> { + self.start(PldmOp::RejectVerify, |buf| { + wire::encode_reject_verify(buf, reason) + }) + } + + /// Tell the FD to apply what it verified. + pub fn perform_apply(&mut self) -> Result<(), ClientError> { + self.start(PldmOp::PerformApply, wire::encode_perform_apply) + } + + /// Tell the FD not to apply. + pub fn reject_apply(&mut self, reason: RejectReason) -> Result<(), ClientError> { + self.start(PldmOp::RejectApply, |buf| { + wire::encode_reject_apply(buf, reason) + }) + } + + /// Ask what the FD is doing. + pub fn query_status(&mut self) -> Result<(), ClientError> { + self.start(PldmOp::QueryStatus, wire::encode_query_status) + } + + /// Tell the FD to activate the applied image. + /// + /// Sent when the FD reports apply complete, not when the UA asks to + /// activate: `FdOps::activate` answers the UA synchronously, so the + /// FD stores this verdict and replies from it. The gap before the UA + /// asks is unbounded, so this stays revocable until then. + pub fn perform_activate(&mut self) -> Result<(), ClientError> { + self.start(PldmOp::PerformActivate, wire::encode_perform_activate) + } + + /// Refuse the activation, or take back one the FD has stored. + /// + /// A revocation loses the race once the UA has asked: by then the FD + /// has answered and activation is under way. + pub fn reject_activate(&mut self, reason: RejectReason) -> Result<(), ClientError> { + self.start(PldmOp::RejectActivate, |buf| { + wire::encode_reject_activate(buf, reason) + }) + } + + /// Acknowledge the FD's cancel. + pub fn ack_cancel(&mut self) -> Result<(), ClientError> { + self.start(PldmOp::AckCancel, wire::encode_ack_cancel) + } + + /// Tell the FD the SVN floor is raised, so it can answer the UA. + pub fn perform_svn_commit(&mut self) -> Result<(), ClientError> { + self.start(PldmOp::PerformSvnCommit, wire::encode_perform_svn_commit) + } + + /// Tell the FD the floor did not move. + pub fn reject_svn_commit(&mut self, reason: RejectReason) -> Result<(), ClientError> { + self.start(PldmOp::RejectSvnCommit, |buf| { + wire::encode_reject_svn_commit(buf, reason) + }) + } + + /// Collect the answer, if it has arrived. + /// + /// `Ok(None)` means the FD has not answered yet and the caller polls + /// again. Anything else ends the round-trip, refusals included, so + /// the next call is another request. + pub fn poll(&mut self) -> Result, ClientError> { + let op = self.in_flight.ok_or(ClientError::Idle)?; + let polled = self.transport.poll(&mut self.response); + // Any error from poll ends the round-trip and discards the + // response, so the client must not keep waiting for one. + let Some(len) = polled.inspect_err(|_| self.in_flight = None)? else { + return Ok(None); + }; + self.in_flight = None; + self.decode(op, len).map(Some) + } + + /// Abandon the round-trip in flight. + /// + /// The client is idle afterwards either way, so a failed cancel is + /// reported but not retried here. With the channel transport a + /// failed cancel has lost the channel for good, and every later + /// `start` answers `WrongState`. + pub fn cancel(&mut self) -> Result<(), ClientError> { + if self.in_flight.is_none() { + return Err(ClientError::Idle); + } + self.in_flight = None; + Ok(self.transport.cancel()?) + } + + /// Encode one request and hand it to the transport. The operation is + /// recorded only once the transport has taken it, so a refused start + /// leaves the client idle. + fn start( + &mut self, + op: PldmOp, + encode: impl FnOnce(&mut [u8]) -> Result, + ) -> Result<(), ClientError> { + if self.in_flight.is_some() { + return Err(ClientError::Busy); + } + let mut request = [0u8; MAX_REQUEST_SIZE]; + let len = encode(&mut request)?; + self.transport.start(&request[..len])?; + self.in_flight = Some(op); + Ok(()) + } + + fn decode(&self, op: PldmOp, len: usize) -> Result { + let frame = &self.response[..len]; + let header = wire::decode_response_header(frame)?; + if !header.is_success() { + return Err(ClientError::Refused(header.response_code())); + } + match op { + PldmOp::QueryStatus => { + let payload = wire::get_response_payload(frame, &header)?; + Ok(Reply::Status(FdStatus::decode(payload)?)) + } + _ => Ok(Reply::Acked), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use pldm_api::status::TransferMode; + use pldm_api::ResponseCode; + use pldm_server::{FdIpcHandler, FdIpcServer}; + use util_service::{Delayed, Loopback, TransportError}; + + /// Answers every operation, with the verdict and status the test + /// chooses. Records the last call so a test can prove the request + /// reached the far side. + struct StubFd { + last: Option<&'static str>, + status: FdStatus, + refuse_with: Option, + } + + impl StubFd { + fn new() -> Self { + Self { + last: None, + status: FdStatus::Idle { reason: 0 }, + refuse_with: None, + } + } + + fn refusing(code: ResponseCode) -> Self { + Self { + refuse_with: Some(code), + ..Self::new() + } + } + + fn holding(status: FdStatus) -> Self { + Self { + status, + ..Self::new() + } + } + + fn answer(&mut self, name: &'static str) -> Result<(), ResponseCode> { + self.last = Some(name); + match self.refuse_with { + Some(code) => Err(code), + None => Ok(()), + } + } + } + + impl FdIpcHandler for StubFd { + fn accept_offer(&mut self, _staging_base: u32) -> Result<(), ResponseCode> { + self.answer("accept_offer") + } + fn reject_offer(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + self.answer("reject_offer") + } + fn perform_verify(&mut self) -> Result<(), ResponseCode> { + self.answer("perform_verify") + } + fn reject_verify(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + self.answer("reject_verify") + } + fn perform_apply(&mut self) -> Result<(), ResponseCode> { + self.answer("perform_apply") + } + fn reject_apply(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + self.answer("reject_apply") + } + fn query_status(&mut self) -> Result { + self.last = Some("query_status"); + match self.refuse_with { + Some(code) => Err(code), + None => Ok(self.status), + } + } + fn perform_activate(&mut self) -> Result<(), ResponseCode> { + self.answer("perform_activate") + } + fn reject_activate(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + self.answer("reject_activate") + } + fn ack_cancel(&mut self) -> Result<(), ResponseCode> { + self.answer("ack_cancel") + } + fn perform_svn_commit(&mut self) -> Result<(), ResponseCode> { + self.answer("perform_svn_commit") + } + fn reject_svn_commit(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + self.answer("reject_svn_commit") + } + } + + type Direct = FdIpcClient, MAX_RESPONSE_SIZE>>; + + fn client(fd: StubFd) -> Direct { + FdIpcClient::new(Loopback::new(FdIpcServer::new(fd))) + } + + /// The handler behind the loopback, to assert on what reached it. + fn handler(client: &Direct) -> &StubFd { + client.transport().server().handler() + } + + #[test] + fn a_granted_operation_is_acked() { + let mut c = client(StubFd::new()); + + c.perform_verify().unwrap(); + assert_eq!(c.in_flight(), Some(PldmOp::PerformVerify)); + assert_eq!(c.poll(), Ok(Some(Reply::Acked))); + + assert_eq!(handler(&c).last, Some("perform_verify")); + assert_eq!(c.in_flight(), None); + } + + #[test] + fn an_offer_carries_the_staging_base() { + let mut c = client(StubFd::new()); + + c.accept_offer(0x2000_0000).unwrap(); + assert_eq!(c.poll(), Ok(Some(Reply::Acked))); + + assert_eq!(handler(&c).last, Some("accept_offer")); + } + + #[test] + fn a_denial_carries_its_reason() { + let mut c = client(StubFd::new()); + + c.reject_verify(RejectReason::Isolated).unwrap(); + assert_eq!(c.poll(), Ok(Some(Reply::Acked))); + + assert_eq!(handler(&c).last, Some("reject_verify")); + } + + #[test] + fn query_status_answers_the_devices_condition() { + let offered = FdStatus::OfferPending { + target: 0x0001, + total: 0x0010_0000, + mode: TransferMode::InTransport, + svn_delayed: false, + }; + let mut c = client(StubFd::holding(offered)); + + c.query_status().unwrap(); + + assert_eq!(c.poll(), Ok(Some(Reply::Status(offered)))); + } + + // A refusal is the FD's decision and ends the round-trip like any + // other answer: the channel is fine, the request is not. + #[test] + fn a_refusal_ends_the_round_trip_with_the_code() { + let mut c = client(StubFd::refusing(ResponseCode::WrongPhase)); + + c.perform_apply().unwrap(); + + assert_eq!( + c.poll(), + Err(ClientError::Refused(ResponseCode::WrongPhase)) + ); + assert_eq!(c.in_flight(), None, "the round-trip is over"); + } + + #[test] + fn a_second_request_while_one_is_in_flight_is_refused() { + let mut c = client(StubFd::new()); + + c.perform_verify().unwrap(); + + assert_eq!(c.perform_apply(), Err(ClientError::Busy)); + assert_eq!(c.in_flight(), Some(PldmOp::PerformVerify)); + } + + #[test] + fn polling_with_nothing_in_flight_is_refused() { + let mut c = client(StubFd::new()); + + assert_eq!(c.poll(), Err(ClientError::Idle)); + } + + #[test] + fn cancel_frees_the_client_for_the_next_request() { + let mut c = client(StubFd::new()); + c.perform_verify().unwrap(); + + c.cancel().unwrap(); + + assert_eq!(c.in_flight(), None); + c.perform_apply().unwrap(); + assert_eq!(c.poll(), Ok(Some(Reply::Acked))); + assert_eq!(handler(&c).last, Some("perform_apply")); + } + + #[test] + fn cancel_with_nothing_in_flight_is_refused() { + let mut c = client(StubFd::new()); + + assert_eq!(c.cancel(), Err(ClientError::Idle)); + } + + // The production transport answers over a kernel channel, so the + // first poll usually finds nothing. The loopback alone cannot reach + // that path. + #[test] + fn a_response_that_is_not_ready_yet_polls_again() { + let mut c = FdIpcClient::new(Delayed::new( + Loopback::<_, MAX_RESPONSE_SIZE>::new(FdIpcServer::new(StubFd::new())), + 2, + )); + + c.perform_verify().unwrap(); + + assert_eq!(c.poll(), Ok(None)); + assert_eq!(c.poll(), Ok(None)); + assert_eq!(c.in_flight(), Some(PldmOp::PerformVerify), "still waiting"); + assert_eq!(c.poll(), Ok(Some(Reply::Acked))); + assert_eq!(c.in_flight(), None); + } + + // A start the transport refuses leaves the client idle, so the + // caller can try something else. Whether the request reached the + // far side is the transport's business: the loopback dispatches + // before it finds the response does not fit. + #[test] + fn a_refused_start_leaves_the_client_idle() { + // A response buffer of zero makes the loopback answer TooLarge. + let mut c: FdIpcClient, 0>> = + FdIpcClient::new(Loopback::new(FdIpcServer::new(StubFd::new()))); + + assert_eq!( + c.perform_verify(), + Err(ClientError::Transport(TransportError::TooLarge)) + ); + assert_eq!(c.in_flight(), None); + } + + /// Answers every poll with a failure, the way a dead channel does. + struct DeadChannel; + + impl AsyncTransport for DeadChannel { + fn start(&mut self, _req: &[u8]) -> Result<(), TransportError> { + Ok(()) + } + + fn poll(&mut self, _resp: &mut [u8]) -> Result, TransportError> { + Err(TransportError::Failed) + } + + fn cancel(&mut self) -> Result<(), TransportError> { + Ok(()) + } + } + + // A failed poll ends the round-trip: the response is gone, so a + // client that kept waiting for it would never send anything again. + #[test] + fn a_failed_poll_ends_the_round_trip() { + let mut c = FdIpcClient::new(DeadChannel); + c.perform_verify().unwrap(); + + assert_eq!( + c.poll(), + Err(ClientError::Transport(TransportError::Failed)) + ); + assert_eq!(c.in_flight(), None); + // The client is free to try again rather than wedged. + c.perform_verify().unwrap(); + } + + /// Answers with a frame too short to be a response header. + struct GarbageChannel; + + impl AsyncTransport for GarbageChannel { + fn start(&mut self, _req: &[u8]) -> Result<(), TransportError> { + Ok(()) + } + + fn poll(&mut self, resp: &mut [u8]) -> Result, TransportError> { + resp[..2].copy_from_slice(&[0xff, 0xff]); + Ok(Some(2)) + } + + fn cancel(&mut self) -> Result<(), TransportError> { + Ok(()) + } + } + + // An answer that does not decode still ends the round-trip: the + // client forgets what it asked before it reads the frame, so a bad + // response cannot leave it waiting forever. + #[test] + fn a_response_that_does_not_decode_ends_the_round_trip() { + let mut c = FdIpcClient::new(GarbageChannel); + c.perform_verify().unwrap(); + + assert_eq!(c.poll(), Err(ClientError::Wire(WireError::Truncated))); + assert_eq!(c.in_flight(), None); + c.perform_verify().unwrap(); + } + + /// Refuses every cancel, the way a channel that cannot take its + /// buffers back does. + struct UncancellableChannel; + + impl AsyncTransport for UncancellableChannel { + fn start(&mut self, _req: &[u8]) -> Result<(), TransportError> { + Ok(()) + } + + fn poll(&mut self, _resp: &mut [u8]) -> Result, TransportError> { + Ok(None) + } + + fn cancel(&mut self) -> Result<(), TransportError> { + Err(TransportError::Failed) + } + } + + // A refused cancel is reported, and the client is idle either way: + // it has abandoned the round-trip and has nothing left to poll for. + #[test] + fn a_failed_cancel_is_reported_and_leaves_the_client_idle() { + let mut c = FdIpcClient::new(UncancellableChannel); + c.perform_verify().unwrap(); + + assert_eq!( + c.cancel(), + Err(ClientError::Transport(TransportError::Failed)) + ); + assert_eq!(c.in_flight(), None); + } +} diff --git a/services/pldm/client/src/error.rs b/services/pldm/client/src/error.rs new file mode 100644 index 000000000..faf3bd2ba --- /dev/null +++ b/services/pldm/client/src/error.rs @@ -0,0 +1,58 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! What a round-trip can fail with. + +use pldm_api::{ResponseCode, WireError}; +use util_service::TransportError; + +/// Why a round-trip did not produce an answer. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ClientError { + /// The transport failed, or was used in the wrong order. + Transport(TransportError), + /// The response did not decode. + Wire(WireError), + /// The FD answered, and the answer is a refusal. Carries the code the + /// FD sent: a decision, not a fault in the channel. + Refused(ResponseCode), + /// A request is already in flight. One at a time, so the caller + /// collects the outstanding reply first. + Busy, + /// `poll` or `cancel` with nothing in flight. + Idle, +} + +impl core::fmt::Display for ClientError { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::Transport(e) => write!(f, "pldm ipc transport error: {e}"), + Self::Wire(e) => write!(f, "pldm ipc response did not decode: {e}"), + Self::Refused(code) => write!(f, "firmware device refused: {code}"), + Self::Busy => f.write_str("a pldm ipc request is already in flight"), + Self::Idle => f.write_str("no pldm ipc request in flight"), + } + } +} + +impl core::error::Error for ClientError { + fn source(&self) -> Option<&(dyn core::error::Error + 'static)> { + match self { + Self::Transport(e) => Some(e), + Self::Wire(e) => Some(e), + Self::Refused(_) | Self::Busy | Self::Idle => None, + } + } +} + +impl From for ClientError { + fn from(e: TransportError) -> Self { + Self::Transport(e) + } +} + +impl From for ClientError { + fn from(e: WireError) -> Self { + Self::Wire(e) + } +} diff --git a/services/pldm/client/src/lib.rs b/services/pldm/client/src/lib.rs new file mode 100644 index 000000000..77e4c2156 --- /dev/null +++ b/services/pldm/client/src/lib.rs @@ -0,0 +1,44 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! PLDM IPC client: the orchestrator's side of the IPC channel. +//! +//! One typed method per operation the Firmware Device answers, each +//! encoding a request and starting a round-trip. The reply is collected +//! by [`FdIpcClient::poll`], so the orchestrator's event loop never waits +//! on the device: the FD shares its loop with MCTP traffic from the +//! Update Agent and can take as long as that traffic makes it take. +//! +//! One round-trip at a time, which the transport enforces and this crate +//! relies on: the response frame carries a code and a payload but not +//! the opcode it answers, so the client remembers what it asked. +//! +//! Generic over `util_service::AsyncTransport`, so the same encode and +//! decode paths run behind a kernel channel in production and inside +//! `util_service::Loopback` in host tests. +//! +//! ## Usage +//! +//! ```rust,ignore +//! use pldm_client::{ClientError, FdIpcClient, Reply}; +//! +//! // One turn of the orchestrator's event loop starts the round-trip. +//! client.perform_verify()?; +//! +//! // A later turn, once the channel signals readable, collects it. +//! match client.poll() { +//! Ok(None) => {} // not answered yet, poll again +//! Ok(Some(Reply::Acked)) => {} // the FD took the request +//! Ok(Some(Reply::Status(s))) => {} // only QueryStatus answers this +//! Err(ClientError::Refused(code)) => {} // the FD said no, and why +//! Err(e) => {} // the channel failed, round-trip over +//! } +//! ``` + +#![no_std] + +mod client; +mod error; + +pub use client::{FdIpcClient, Reply}; +pub use error::ClientError; diff --git a/services/pldm/gate/BUILD.bazel b/services/pldm/gate/BUILD.bazel new file mode 100644 index 000000000..22c752c30 --- /dev/null +++ b/services/pldm/gate/BUILD.bazel @@ -0,0 +1,20 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") + +rust_library( + name = "pldm_gate", + srcs = glob(["src/**/*.rs"]), + edition = "2024", + visibility = ["//visibility:public"], + deps = [ + "//services/orchestrator/config:orchestrator_config", + "//services/pldm/api:pldm_api", + ], +) + +rust_test( + name = "pldm_gate_test", + crate = ":pldm_gate", +) diff --git a/services/pldm/gate/README.md b/services/pldm/gate/README.md new file mode 100644 index 000000000..24e7b1247 --- /dev/null +++ b/services/pldm/gate/README.md @@ -0,0 +1,43 @@ +# pldm_gate + +The orchestrator's side of the PLDM update gate. `#![no_std]`, +host-buildable, depends on `pldm_api` and the orchestrator's config schema. + +The Firmware Device parks at each phase and raises a nudge. The orchestrator +reads `FdStatus` and answers with one operation. This crate turns a status +into that answer. + +## `AlwaysPerform` + +The policy that answers every phase with proceed. + +```rust +let gate = AlwaysPerform::new(STAGING); // a Region, board wiring + +match gate.decide(status) { + Decision::Idle => {} // nothing to answer, wait + decision => send(decision), +} +``` + +| status | answer | +|---|---| +| `OfferPending` | `AcceptOffer { staging }` | +| `VerifyPending` | `PerformVerify` | +| `ApplyPending` | `PerformApply` | +| `ActivationPending` | `PerformActivate` | +| `SvnCommitPending` | `PerformSvnCommit` | +| `Cancelled` | `AckCancel` | +| `Idle`, `ReadyXfer`, `PhaseFailed` | `Decision::Idle` | + +It exists so the update path runs end to end before any real policy is +written, and so a test can drive every phase without one. + +**It is not a policy and must not ship on a device.** It makes no checks: not +component isolation, not the SVN floor, not whether the component is one this +orchestrator manages. A test pins the property that it never refuses +anything, which is the whole of what it does. + +A real gate replaces it and brings the refusing decisions with it. When a +second policy exists, the two share a trait; one implementation does not +need one. diff --git a/services/pldm/gate/src/always_perform.rs b/services/pldm/gate/src/always_perform.rs new file mode 100644 index 000000000..7df564ee9 --- /dev/null +++ b/services/pldm/gate/src/always_perform.rs @@ -0,0 +1,159 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The stand-in gate: every phase is told to proceed. + +use crate::Decision; +use orchestrator_config::Region; +use pldm_api::FdStatus; + +/// A gate that answers every waiting phase with proceed. +/// +/// Answers each waiting status with the operation that tells the FD to +/// proceed, and every other status with [`Decision::Idle`]. The staging base it hands out at +/// `AcceptOffer` is the one it was built with, because that address is +/// board wiring rather than a decision. +/// +/// This is a stand-in, not a policy. A real gate refuses an isolated +/// component, an image below the SVN floor, and an offer for a component +/// it does not manage. This one refuses nothing, so the update path runs +/// unattended and a test can drive every phase without writing a policy +/// first. +pub struct AlwaysPerform { + staging: Region, +} + +impl AlwaysPerform { + /// Build a gate that stages every image in `staging`. + pub const fn new(staging: Region) -> Self { + Self { staging } + } + + /// Answer one status. + /// + /// `PhaseFailed` is `Idle`: verify or apply already failed and the FD + /// has told the Update Agent, so there is nothing left to answer. + /// + /// A policy that refuses a phase sends the matching `Reject` op. This + /// one never refuses, so those ops never appear here. + pub fn decide(&self, status: FdStatus) -> Decision { + match status { + FdStatus::OfferPending { .. } => Decision::AcceptOffer { + staging: self.staging, + }, + FdStatus::VerifyPending => Decision::PerformVerify, + FdStatus::ApplyPending => Decision::PerformApply, + FdStatus::ActivationPending => Decision::PerformActivate, + FdStatus::SvnCommitPending { component } => Decision::PerformSvnCommit { component }, + FdStatus::Cancelled => Decision::AckCancel, + FdStatus::Idle { .. } | FdStatus::ReadyXfer | FdStatus::PhaseFailed { .. } => { + Decision::Idle + } + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use pldm_api::status::TransferMode; + use pldm_api::PldmOp; + + const STAGING: Region = Region::new(0x2000_0000, 0x10_0000); + + fn gate() -> AlwaysPerform { + AlwaysPerform::new(STAGING) + } + + #[test] + fn an_offer_is_accepted_into_the_configured_staging_region() { + let offer = FdStatus::OfferPending { + target: 1, + total: 0x10_0000, + mode: TransferMode::InTransport, + svn_delayed: false, + }; + + assert_eq!( + gate().decide(offer), + Decision::AcceptOffer { staging: STAGING } + ); + } + + #[test] + fn every_waiting_phase_is_told_to_proceed() { + let g = gate(); + + assert_eq!(g.decide(FdStatus::VerifyPending), Decision::PerformVerify); + assert_eq!(g.decide(FdStatus::ApplyPending), Decision::PerformApply); + assert_eq!( + g.decide(FdStatus::ActivationPending), + Decision::PerformActivate + ); + assert_eq!( + g.decide(FdStatus::SvnCommitPending { component: 7 }), + Decision::PerformSvnCommit { component: 7 } + ); + } + + #[test] + fn a_cancel_is_acknowledged() { + assert_eq!(gate().decide(FdStatus::Cancelled), Decision::AckCancel); + } + + #[test] + fn a_status_that_is_not_waiting_gets_no_answer() { + let g = gate(); + + assert_eq!(g.decide(FdStatus::Idle { reason: 0 }), Decision::Idle); + assert_eq!(g.decide(FdStatus::ReadyXfer), Decision::Idle); + assert_eq!( + g.decide(FdStatus::PhaseFailed { + phase: 6, + result_code: 2 + }), + Decision::Idle + ); + } + + /// The gate never refuses: no status produces a `Reject` operation. + /// That is what makes it a stand-in and not a policy, so it is worth + /// pinning. + #[test] + fn no_status_produces_a_refusal() { + let g = gate(); + let every_status = [ + FdStatus::Idle { reason: 0 }, + FdStatus::ReadyXfer, + FdStatus::OfferPending { + target: 1, + total: 16, + mode: TransferMode::InTransport, + svn_delayed: true, + }, + FdStatus::VerifyPending, + FdStatus::ApplyPending, + FdStatus::ActivationPending, + FdStatus::SvnCommitPending { component: 0 }, + FdStatus::PhaseFailed { + phase: 6, + result_code: 1, + }, + FdStatus::Cancelled, + ]; + + for status in every_status { + let refused = matches!( + g.decide(status).op(), + Some( + PldmOp::RejectOffer + | PldmOp::RejectVerify + | PldmOp::RejectApply + | PldmOp::RejectActivate + | PldmOp::RejectSvnCommit + ) + ); + assert!(!refused, "refused {status:?}"); + } + } +} diff --git a/services/pldm/gate/src/decision.rs b/services/pldm/gate/src/decision.rs new file mode 100644 index 000000000..c2db68d93 --- /dev/null +++ b/services/pldm/gate/src/decision.rs @@ -0,0 +1,74 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! What the orchestrator answers a parked Firmware Device with. + +use orchestrator_config::Region; +use pldm_api::PldmOp; + +/// What the orchestrator sends next. +/// +/// One variant per operation a decision can produce, carrying that +/// operation's arguments. `Idle` is not an operation: it means this status +/// needs no answer, so the orchestrator sends nothing and waits for the +/// next nudge. +/// +/// Only the operations that tell the FD to proceed are here. The refusals +/// (`RejectOffer`, `RejectVerify` and the rest) arrive with the first +/// policy that refuses something. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Decision { + /// Nothing to answer: the FD is not waiting on the orchestrator. + Idle, + /// Approve the offer and name the staging region: where the image + /// lands in transport, where it already sits out of transport. + /// + /// The region is store-relative, like every [`Region`]. Which store, + /// and so which address the Firmware Device sees, is board wiring. + AcceptOffer { staging: Region }, + /// Tell the FD to verify the staged image. + PerformVerify, + /// Tell the FD to apply the verified image. + PerformApply, + /// Tell the FD to activate. + PerformActivate, + /// Tell the FD the SVN floor is raised. `component` names whose floor + /// the orchestrator advances first; the wire op carries no arguments. + PerformSvnCommit { component: u16 }, + /// Release the FD from a cancel it is parked on. + AckCancel, +} + +impl Decision { + /// The operation this decision sends, or `None` for [`Decision::Idle`]. + pub fn op(&self) -> Option { + match self { + Self::Idle => None, + Self::AcceptOffer { .. } => Some(PldmOp::AcceptOffer), + Self::PerformVerify => Some(PldmOp::PerformVerify), + Self::PerformApply => Some(PldmOp::PerformApply), + Self::PerformActivate => Some(PldmOp::PerformActivate), + Self::PerformSvnCommit { .. } => Some(PldmOp::PerformSvnCommit), + Self::AckCancel => Some(PldmOp::AckCancel), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn a_decision_names_the_operation_it_sends() { + assert_eq!(Decision::Idle.op(), None); + assert_eq!( + Decision::AcceptOffer { + staging: Region::new(0x2000_0000, 0x10_0000) + } + .op(), + Some(PldmOp::AcceptOffer) + ); + assert_eq!(Decision::PerformVerify.op(), Some(PldmOp::PerformVerify)); + assert_eq!(Decision::AckCancel.op(), Some(PldmOp::AckCancel)); + } +} diff --git a/services/pldm/gate/src/lib.rs b/services/pldm/gate/src/lib.rs new file mode 100644 index 000000000..62b9e59fb --- /dev/null +++ b/services/pldm/gate/src/lib.rs @@ -0,0 +1,23 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The orchestrator's side of the PLDM update gate. +//! +//! The Firmware Device parks at each phase and raises a nudge; the +//! orchestrator reads `FdStatus` and answers with one operation. This crate +//! turns a status into that answer. +//! +//! [`AlwaysPerform`] is the policy that answers every phase with proceed. +//! It exists +//! so the update path can run end to end before any real policy is +//! written, and so tests have a gate that never blocks. It makes no +//! checks: no isolation, no SVN floor, no component identity. Nothing here +//! belongs on a shipping device. + +#![no_std] + +mod always_perform; +mod decision; + +pub use always_perform::AlwaysPerform; +pub use decision::Decision; diff --git a/services/pldm/server/BUILD.bazel b/services/pldm/server/BUILD.bazel new file mode 100644 index 000000000..dd318ed45 --- /dev/null +++ b/services/pldm/server/BUILD.bazel @@ -0,0 +1,20 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") + +rust_library( + name = "pldm_server", + srcs = glob(["src/**/*.rs"]), + edition = "2024", + visibility = ["//visibility:public"], + deps = [ + "//services/pldm/api:pldm_api", + "//util/service", + ], +) + +rust_test( + name = "pldm_server_test", + crate = ":pldm_server", +) diff --git a/services/pldm/server/src/lib.rs b/services/pldm/server/src/lib.rs new file mode 100644 index 000000000..484b0d74c --- /dev/null +++ b/services/pldm/server/src/lib.rs @@ -0,0 +1,774 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! PLDM IPC server: the FD side of the IPC channel. +//! +//! Decodes orchestrator requests, dispatches to an `FdIpcHandler` +//! implementation, and encodes responses. `FdIpcServer` is the +//! `util_service::Dispatch` impl, so the same server answers behind a +//! kernel channel in production and inside `util_service::Loopback` in +//! host tests. + +#![no_std] + +use pldm_api::wire::{self, PldmOp}; +use pldm_api::{FdStatus, RejectReason, ResponseCode, WireError}; +use util_service::{Dispatch, DispatchError}; + +/// What the FD does in response to each orchestrator operation. +/// +/// One method per opcode. All return `Result<(), ResponseCode>` except +/// `query_status`, which returns the FD's current condition. The server +/// encodes the result into the response buffer; the handler never +/// touches wire bytes. +/// +/// Every method must return immediately. Record the decision, flip +/// state, return. The FD shares its loop with MCTP traffic from the +/// UA, so a handler that blocks stalls UA traffic. +pub trait FdIpcHandler { + fn accept_offer(&mut self, staging_base: u32) -> Result<(), ResponseCode>; + fn reject_offer(&mut self, reason: RejectReason) -> Result<(), ResponseCode>; + fn perform_verify(&mut self) -> Result<(), ResponseCode>; + fn reject_verify(&mut self, reason: RejectReason) -> Result<(), ResponseCode>; + fn perform_apply(&mut self) -> Result<(), ResponseCode>; + fn reject_apply(&mut self, reason: RejectReason) -> Result<(), ResponseCode>; + fn query_status(&mut self) -> Result; + fn perform_activate(&mut self) -> Result<(), ResponseCode>; + fn reject_activate(&mut self, reason: RejectReason) -> Result<(), ResponseCode>; + fn ack_cancel(&mut self) -> Result<(), ResponseCode>; + fn perform_svn_commit(&mut self) -> Result<(), ResponseCode>; + fn reject_svn_commit(&mut self, reason: RejectReason) -> Result<(), ResponseCode>; +} + +/// Decode one request, call the handler, encode the response. +/// +/// Returns the number of bytes written to `response`. An unknown opcode +/// answers `InvalidOp` and a request frame that does not decode answers +/// `MalformedRequest`, so a caller error is never reported as a fault in +/// the FD. `InternalError` is left for the one server-side case: the +/// response does not fit the buffer the caller gave, but an error frame +/// does. A `response` too small for even that error frame has nothing to +/// send back. +pub fn dispatch( + handler: &mut F, + request: &[u8], + response: &mut [u8], +) -> Result { + let code = match dispatch_inner(handler, request, response) { + Ok(n) => return Ok(n), + Err(WireError::InvalidOpcode(_)) => ResponseCode::InvalidOp, + Err(WireError::Truncated | WireError::PayloadTooLarge | WireError::InvalidValue(_)) => { + ResponseCode::MalformedRequest + } + Err(WireError::BufferTooSmall) => ResponseCode::InternalError, + }; + wire::encode_error_response(response, code).map_err(|_| DispatchError::ResponseTooLarge) +} + +/// An `FdIpcHandler` as a server the shared transports can drive. +/// +/// The newtype exists because `Dispatch` is a foreign trait: it cannot +/// be implemented for every `F: FdIpcHandler` directly. +pub struct FdIpcServer { + handler: F, +} + +impl FdIpcServer { + pub const fn new(handler: F) -> Self { + Self { handler } + } + + /// The handler, to assert on what the requests did to it. + pub fn handler(&self) -> &F { + &self.handler + } +} + +impl Dispatch for FdIpcServer { + fn dispatch(&mut self, request: &[u8], response: &mut [u8]) -> Result { + dispatch(&mut self.handler, request, response) + } +} + +fn dispatch_inner( + handler: &mut F, + request: &[u8], + response: &mut [u8], +) -> Result { + let header = wire::decode_request_header(request)?; + let op = header + .operation() + .ok_or(WireError::InvalidOpcode(header.op))?; + if request.len() > wire::expected_request_len(op) { + return Err(WireError::PayloadTooLarge); + } + let args = wire::get_request_args(request); + + match op { + PldmOp::AcceptOffer => { + let base = wire::get_accept_offer_base(args)?; + encode_unit_result(response, handler.accept_offer(base)) + } + PldmOp::RejectOffer => { + let reason = wire::get_reject_reason(args)?; + encode_unit_result(response, handler.reject_offer(reason)) + } + PldmOp::PerformVerify => encode_unit_result(response, handler.perform_verify()), + PldmOp::RejectVerify => { + let reason = wire::get_reject_reason(args)?; + encode_unit_result(response, handler.reject_verify(reason)) + } + PldmOp::PerformApply => encode_unit_result(response, handler.perform_apply()), + PldmOp::RejectApply => { + let reason = wire::get_reject_reason(args)?; + encode_unit_result(response, handler.reject_apply(reason)) + } + PldmOp::QueryStatus => match handler.query_status() { + Ok(status) => wire::encode_status_response(response, &status), + Err(code) => wire::encode_error_response(response, code), + }, + PldmOp::PerformActivate => encode_unit_result(response, handler.perform_activate()), + PldmOp::RejectActivate => { + let reason = wire::get_reject_reason(args)?; + encode_unit_result(response, handler.reject_activate(reason)) + } + PldmOp::AckCancel => encode_unit_result(response, handler.ack_cancel()), + PldmOp::PerformSvnCommit => encode_unit_result(response, handler.perform_svn_commit()), + PldmOp::RejectSvnCommit => { + let reason = wire::get_reject_reason(args)?; + encode_unit_result(response, handler.reject_svn_commit(reason)) + } + } +} + +fn encode_unit_result( + response: &mut [u8], + result: Result<(), ResponseCode>, +) -> Result { + match result { + Ok(()) => wire::encode_success_response(response), + Err(code) => wire::encode_error_response(response, code), + } +} + +#[cfg(test)] +mod tests { + use super::*; + use pldm_api::status::TransferMode; + use pldm_api::wire::{RequestHeader, MAX_RESPONSE_SIZE}; + + /// Mock handler that records calls and returns canned responses. + struct MockFd { + last_op: Option<&'static str>, + status: FdStatus, + next_error: Option, + } + + impl MockFd { + fn new() -> Self { + Self { + last_op: None, + status: FdStatus::Idle { reason: 0 }, + next_error: None, + } + } + + fn returning_error(code: ResponseCode) -> Self { + Self { + last_op: None, + status: FdStatus::Idle { reason: 0 }, + next_error: Some(code), + } + } + + fn check(&mut self, name: &'static str) -> Result<(), ResponseCode> { + self.last_op = Some(name); + match self.next_error.take() { + Some(code) => Err(code), + None => Ok(()), + } + } + } + + impl FdIpcHandler for MockFd { + fn accept_offer(&mut self, _base: u32) -> Result<(), ResponseCode> { + self.check("accept_offer") + } + fn reject_offer(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + self.check("reject_offer") + } + fn perform_verify(&mut self) -> Result<(), ResponseCode> { + self.check("perform_verify") + } + fn reject_verify(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + self.check("reject_verify") + } + fn perform_apply(&mut self) -> Result<(), ResponseCode> { + self.check("perform_apply") + } + fn reject_apply(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + self.check("reject_apply") + } + fn query_status(&mut self) -> Result { + self.last_op = Some("query_status"); + match self.next_error.take() { + Some(code) => Err(code), + None => Ok(self.status), + } + } + fn perform_activate(&mut self) -> Result<(), ResponseCode> { + self.check("perform_activate") + } + fn reject_activate(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + self.check("reject_activate") + } + fn ack_cancel(&mut self) -> Result<(), ResponseCode> { + self.check("ack_cancel") + } + fn perform_svn_commit(&mut self) -> Result<(), ResponseCode> { + self.check("perform_svn_commit") + } + fn reject_svn_commit(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + self.check("reject_svn_commit") + } + } + + fn roundtrip_success( + encode: impl FnOnce(&mut [u8]) -> Result, + expected_op: &'static str, + ) { + let mut req = [0u8; 16]; + let req_len = encode(&mut req).unwrap(); + let mut resp = [0u8; MAX_RESPONSE_SIZE]; + let mut fd = MockFd::new(); + let resp_len = dispatch(&mut fd, &req[..req_len], &mut resp).unwrap(); + assert_eq!(fd.last_op, Some(expected_op)); + let h = wire::decode_response_header(&resp[..resp_len]).unwrap(); + assert!(h.is_success(), "expected success for {expected_op}"); + } + + #[test] + fn accept_offer_dispatches() { + roundtrip_success( + |buf| wire::encode_accept_offer(buf, 0x2000_0000), + "accept_offer", + ); + } + + #[test] + fn reject_offer_dispatches() { + roundtrip_success( + |buf| wire::encode_reject_offer(buf, RejectReason::PolicyViolation), + "reject_offer", + ); + } + + #[test] + fn perform_verify_dispatches() { + roundtrip_success(wire::encode_perform_verify, "perform_verify"); + } + + #[test] + fn reject_verify_dispatches() { + roundtrip_success( + |buf| wire::encode_reject_verify(buf, RejectReason::Isolated), + "reject_verify", + ); + } + + #[test] + fn perform_apply_dispatches() { + roundtrip_success(wire::encode_perform_apply, "perform_apply"); + } + + #[test] + fn reject_apply_dispatches() { + roundtrip_success( + |buf| wire::encode_reject_apply(buf, RejectReason::PolicyViolation), + "reject_apply", + ); + } + + #[test] + fn perform_activate_dispatches() { + roundtrip_success(wire::encode_perform_activate, "perform_activate"); + } + + #[test] + fn reject_activate_dispatches() { + roundtrip_success( + |buf| wire::encode_reject_activate(buf, RejectReason::Busy), + "reject_activate", + ); + } + + #[test] + fn ack_cancel_dispatches() { + roundtrip_success(wire::encode_ack_cancel, "ack_cancel"); + } + + #[test] + fn perform_svn_commit_dispatches() { + roundtrip_success(wire::encode_perform_svn_commit, "perform_svn_commit"); + } + + #[test] + fn reject_svn_commit_dispatches() { + roundtrip_success( + |buf| wire::encode_reject_svn_commit(buf, RejectReason::PolicyViolation), + "reject_svn_commit", + ); + } + + #[test] + fn query_status_returns_fd_state() { + let mut req = [0u8; 16]; + let req_len = wire::encode_query_status(&mut req).unwrap(); + let mut resp = [0u8; MAX_RESPONSE_SIZE]; + let mut fd = MockFd::new(); + fd.status = FdStatus::OfferPending { + target: 0x0001, + total: 0x0010_0000, + mode: TransferMode::InTransport, + svn_delayed: true, + }; + let resp_len = dispatch(&mut fd, &req[..req_len], &mut resp).unwrap(); + let h = wire::decode_response_header(&resp[..resp_len]).unwrap(); + assert!(h.is_success()); + let payload = wire::get_response_payload(&resp[..resp_len], &h).unwrap(); + let status = FdStatus::decode(payload).unwrap(); + assert_eq!(status, fd.status); + } + + #[test] + fn handler_error_becomes_error_response() { + let mut req = [0u8; 16]; + let req_len = wire::encode_perform_verify(&mut req).unwrap(); + let mut resp = [0u8; MAX_RESPONSE_SIZE]; + let mut fd = MockFd::returning_error(ResponseCode::WrongPhase); + let resp_len = dispatch(&mut fd, &req[..req_len], &mut resp).unwrap(); + let h = wire::decode_response_header(&resp[..resp_len]).unwrap(); + assert!(!h.is_success()); + assert_eq!(h.response_code(), ResponseCode::WrongPhase); + } + + #[test] + fn unknown_opcode_returns_invalid_op() { + let mut req = [0u8; 16]; + let h = RequestHeader { + op: 0xFF, + flags: 0, + generation: 0, + }; + req[..RequestHeader::SIZE].copy_from_slice(&h.to_bytes()); + let mut resp = [0u8; MAX_RESPONSE_SIZE]; + let mut fd = MockFd::new(); + let resp_len = dispatch(&mut fd, &req[..RequestHeader::SIZE], &mut resp).unwrap(); + let rh = wire::decode_response_header(&resp[..resp_len]).unwrap(); + assert!(!rh.is_success()); + assert_eq!(rh.response_code(), ResponseCode::InvalidOp); + assert_eq!(fd.last_op, None); + } + + #[test] + fn truncated_request_returns_malformed_request() { + let mut resp = [0u8; MAX_RESPONSE_SIZE]; + let mut fd = MockFd::new(); + let resp_len = dispatch(&mut fd, &[0u8; 2], &mut resp).unwrap(); + let h = wire::decode_response_header(&resp[..resp_len]).unwrap(); + assert_eq!(h.response_code(), ResponseCode::MalformedRequest); + } + + #[test] + fn reject_verify_missing_reason_returns_malformed_request() { + let mut req = [0u8; 16]; + let h = RequestHeader { + op: PldmOp::RejectVerify as u8, + flags: 0, + generation: 0, + }; + req[..RequestHeader::SIZE].copy_from_slice(&h.to_bytes()); + let mut resp = [0u8; MAX_RESPONSE_SIZE]; + let mut fd = MockFd::new(); + let resp_len = dispatch(&mut fd, &req[..RequestHeader::SIZE], &mut resp).unwrap(); + let rh = wire::decode_response_header(&resp[..resp_len]).unwrap(); + assert_eq!(rh.response_code(), ResponseCode::MalformedRequest); + assert_eq!(fd.last_op, None); + } + + // RejectOffer used to be header-only, so a frame with no reason is a + // frame from the old format, not just a truncated one. + #[test] + fn reject_offer_missing_reason_returns_malformed_request() { + let mut req = [0u8; 16]; + let h = RequestHeader { + op: PldmOp::RejectOffer as u8, + flags: 0, + generation: 0, + }; + req[..RequestHeader::SIZE].copy_from_slice(&h.to_bytes()); + let mut resp = [0u8; MAX_RESPONSE_SIZE]; + let mut fd = MockFd::new(); + let resp_len = dispatch(&mut fd, &req[..RequestHeader::SIZE], &mut resp).unwrap(); + let rh = wire::decode_response_header(&resp[..resp_len]).unwrap(); + assert_eq!(rh.response_code(), ResponseCode::MalformedRequest); + assert_eq!(fd.last_op, None); + } + + #[test] + fn reject_verify_bad_reason_returns_malformed_request() { + let mut req = [0u8; 16]; + let h = RequestHeader { + op: PldmOp::RejectVerify as u8, + flags: 0, + generation: 0, + }; + req[..RequestHeader::SIZE].copy_from_slice(&h.to_bytes()); + req[RequestHeader::SIZE] = 0xFF; + let mut resp = [0u8; MAX_RESPONSE_SIZE]; + let mut fd = MockFd::new(); + let resp_len = dispatch(&mut fd, &req[..RequestHeader::SIZE + 1], &mut resp).unwrap(); + let rh = wire::decode_response_header(&resp[..resp_len]).unwrap(); + assert_eq!(rh.response_code(), ResponseCode::MalformedRequest); + assert_eq!(fd.last_op, None); + } + + #[test] + fn accept_offer_truncated_args_returns_malformed_request() { + let mut req = [0u8; 16]; + let h = RequestHeader { + op: PldmOp::AcceptOffer as u8, + flags: 0, + generation: 0, + }; + req[..RequestHeader::SIZE].copy_from_slice(&h.to_bytes()); + // Only 1 byte of args instead of the 4 needed for the base address. + req[RequestHeader::SIZE] = 0x20; + let mut resp = [0u8; MAX_RESPONSE_SIZE]; + let mut fd = MockFd::new(); + let resp_len = dispatch(&mut fd, &req[..RequestHeader::SIZE + 1], &mut resp).unwrap(); + let rh = wire::decode_response_header(&resp[..resp_len]).unwrap(); + assert_eq!(rh.response_code(), ResponseCode::MalformedRequest); + assert_eq!(fd.last_op, None); + } + + #[test] + fn a_query_status_frame_with_trailing_slack_is_rejected() { + // 12 bytes is MAX_REQUEST_SIZE, so the old length gate let this + // through and the decoder ignored the four extra bytes. + let mut req = [0u8; wire::MAX_REQUEST_SIZE]; + let req_len = wire::encode_query_status(&mut req).unwrap(); + assert!(req_len < wire::MAX_REQUEST_SIZE); + + let mut resp = [0u8; MAX_RESPONSE_SIZE]; + let mut fd = MockFd::new(); + let resp_len = dispatch(&mut fd, &req, &mut resp).unwrap(); + + let h = wire::decode_response_header(&resp[..resp_len]).unwrap(); + assert!(!h.is_success()); + assert_eq!(h.response_code(), ResponseCode::MalformedRequest); + assert_eq!(fd.last_op, None); + } +} + +#[cfg(test)] +mod loopback_tests { + use super::*; + use pldm_api::wire::MAX_REQUEST_SIZE; + use util_service::{AsyncTransport, Loopback, TransportError}; + + /// Start one request and poll the response out, as the client layer + /// does; the loopback always has it ready on the first poll. + fn round_trip( + transport: &mut Loopback, MAX_RESPONSE_SIZE>, + req: &[u8], + resp: &mut [u8], + ) -> usize { + transport.start(req).unwrap(); + transport.poll(resp).unwrap().unwrap() + } + use pldm_api::status::TransferMode; + use pldm_api::wire::{self, MAX_RESPONSE_SIZE}; + use pldm_api::{FdStatus, RejectReason, ResponseCode}; + + /// Minimal handler for loopback tests. + struct StubFd { + status: FdStatus, + } + + impl StubFd { + fn idle() -> Self { + Self { + status: FdStatus::Idle { reason: 0 }, + } + } + + fn with_offer() -> Self { + Self { + status: FdStatus::OfferPending { + target: 0x0001, + total: 0x0010_0000, + mode: TransferMode::InTransport, + svn_delayed: false, + }, + } + } + + fn at(status: FdStatus) -> Self { + Self { status } + } + } + + impl FdIpcHandler for StubFd { + fn accept_offer(&mut self, _base: u32) -> Result<(), ResponseCode> { + self.status = FdStatus::ReadyXfer; + Ok(()) + } + fn reject_offer(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + self.status = FdStatus::Idle { reason: 0 }; + Ok(()) + } + fn perform_verify(&mut self) -> Result<(), ResponseCode> { + self.status = FdStatus::ApplyPending; + Ok(()) + } + fn reject_verify(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + Ok(()) + } + fn perform_apply(&mut self) -> Result<(), ResponseCode> { + self.status = FdStatus::ActivationPending; + Ok(()) + } + fn reject_apply(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + Ok(()) + } + fn query_status(&mut self) -> Result { + Ok(self.status) + } + fn perform_activate(&mut self) -> Result<(), ResponseCode> { + self.status = FdStatus::Idle { reason: 0 }; + Ok(()) + } + fn reject_activate(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + Ok(()) + } + fn ack_cancel(&mut self) -> Result<(), ResponseCode> { + self.status = FdStatus::Idle { reason: 0 }; + Ok(()) + } + fn perform_svn_commit(&mut self) -> Result<(), ResponseCode> { + self.status = FdStatus::Idle { reason: 0 }; + Ok(()) + } + fn reject_svn_commit(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + Ok(()) + } + } + + #[test] + fn query_status_through_loopback() { + let mut transport = Loopback::<_, MAX_RESPONSE_SIZE>::new(FdIpcServer::new(StubFd::idle())); + let mut req = [0u8; 16]; + let req_len = wire::encode_query_status(&mut req).unwrap(); + let mut resp = [0u8; MAX_RESPONSE_SIZE]; + let resp_len = round_trip(&mut transport, &req[..req_len], &mut resp); + let h = wire::decode_response_header(&resp[..resp_len]).unwrap(); + assert!(h.is_success()); + let payload = wire::get_response_payload(&resp[..resp_len], &h).unwrap(); + let status = FdStatus::decode(payload).unwrap(); + assert_eq!(status, FdStatus::Idle { reason: 0 }); + } + + #[test] + fn accept_offer_then_query_shows_ready_xfer() { + let mut transport = + Loopback::<_, MAX_RESPONSE_SIZE>::new(FdIpcServer::new(StubFd::with_offer())); + + // Accept the offer. + let mut req = [0u8; 16]; + let req_len = wire::encode_accept_offer(&mut req, 0x2000_0000).unwrap(); + let mut resp = [0u8; MAX_RESPONSE_SIZE]; + let resp_len = round_trip(&mut transport, &req[..req_len], &mut resp); + let h = wire::decode_response_header(&resp[..resp_len]).unwrap(); + assert!(h.is_success()); + + // Query status: should now be ReadyXfer. + let req_len = wire::encode_query_status(&mut req).unwrap(); + let resp_len = round_trip(&mut transport, &req[..req_len], &mut resp); + let h = wire::decode_response_header(&resp[..resp_len]).unwrap(); + let payload = wire::get_response_payload(&resp[..resp_len], &h).unwrap(); + let status = FdStatus::decode(payload).unwrap(); + assert_eq!(status, FdStatus::ReadyXfer); + } + + #[test] + fn reject_offer_then_query_shows_idle() { + let mut transport = + Loopback::<_, MAX_RESPONSE_SIZE>::new(FdIpcServer::new(StubFd::with_offer())); + + let mut req = [0u8; 16]; + let req_len = wire::encode_reject_offer(&mut req, RejectReason::PolicyViolation).unwrap(); + let mut resp = [0u8; MAX_RESPONSE_SIZE]; + let resp_len = round_trip(&mut transport, &req[..req_len], &mut resp); + let h = wire::decode_response_header(&resp[..resp_len]).unwrap(); + assert!(h.is_success()); + + let req_len = wire::encode_query_status(&mut req).unwrap(); + let resp_len = round_trip(&mut transport, &req[..req_len], &mut resp); + let h = wire::decode_response_header(&resp[..resp_len]).unwrap(); + let payload = wire::get_response_payload(&resp[..resp_len], &h).unwrap(); + let status = FdStatus::decode(payload).unwrap(); + assert_eq!(status, FdStatus::Idle { reason: 0 }); + } + + #[test] + fn start_while_pending_is_wrong_state() { + let mut transport = Loopback::<_, MAX_RESPONSE_SIZE>::new(FdIpcServer::new(StubFd::idle())); + let mut req = [0u8; 16]; + let req_len = wire::encode_query_status(&mut req).unwrap(); + + transport.start(&req[..req_len]).unwrap(); + assert_eq!( + transport.start(&req[..req_len]), + Err(TransportError::WrongState) + ); + } + + #[test] + fn poll_without_start_is_wrong_state() { + let mut transport = Loopback::<_, MAX_RESPONSE_SIZE>::new(FdIpcServer::new(StubFd::idle())); + let mut resp = [0u8; MAX_RESPONSE_SIZE]; + assert_eq!(transport.poll(&mut resp), Err(TransportError::WrongState)); + } + + #[test] + fn cancel_releases_the_round_trip() { + let mut transport = Loopback::<_, MAX_RESPONSE_SIZE>::new(FdIpcServer::new(StubFd::idle())); + let mut req = [0u8; 16]; + let req_len = wire::encode_query_status(&mut req).unwrap(); + + transport.start(&req[..req_len]).unwrap(); + transport.cancel().unwrap(); + assert_eq!(transport.cancel(), Err(TransportError::WrongState)); + + // The transport is usable again after a cancel. + let mut resp = [0u8; MAX_RESPONSE_SIZE]; + let resp_len = round_trip(&mut transport, &req[..req_len], &mut resp); + assert!(wire::decode_response_header(&resp[..resp_len]) + .unwrap() + .is_success()); + } + + #[test] + fn poll_into_a_short_buffer_is_too_large() { + let mut transport = Loopback::<_, MAX_RESPONSE_SIZE>::new(FdIpcServer::new(StubFd::idle())); + let mut req = [0u8; 16]; + let req_len = wire::encode_query_status(&mut req).unwrap(); + + transport.start(&req[..req_len]).unwrap(); + let mut resp = [0u8; 1]; + assert_eq!(transport.poll(&mut resp), Err(TransportError::TooLarge)); + // The failed poll ended the round-trip. + assert_eq!(transport.poll(&mut resp), Err(TransportError::WrongState)); + } + + /// Send a request and assert the response is success. + fn send_ok( + transport: &mut Loopback, MAX_RESPONSE_SIZE>, + encode: impl FnOnce(&mut [u8]) -> Result, + ) { + let mut req = [0u8; 16]; + let req_len = encode(&mut req).unwrap(); + let mut resp = [0u8; MAX_RESPONSE_SIZE]; + let resp_len = round_trip(transport, &req[..req_len], &mut resp); + let h = wire::decode_response_header(&resp[..resp_len]).unwrap(); + assert!(h.is_success()); + } + + /// Send QueryStatus and return the decoded FdStatus. + fn query_status( + transport: &mut Loopback, MAX_RESPONSE_SIZE>, + ) -> FdStatus { + let mut req = [0u8; 16]; + let req_len = wire::encode_query_status(&mut req).unwrap(); + let mut resp = [0u8; MAX_RESPONSE_SIZE]; + let resp_len = round_trip(transport, &req[..req_len], &mut resp); + let h = wire::decode_response_header(&resp[..resp_len]).unwrap(); + assert!(h.is_success()); + let payload = wire::get_response_payload(&resp[..resp_len], &h).unwrap(); + FdStatus::decode(payload).unwrap() + } + + #[test] + fn offer_accept_reaches_ready_xfer() { + let mut t = Loopback::<_, MAX_RESPONSE_SIZE>::new(FdIpcServer::new(StubFd::with_offer())); + + assert_eq!( + query_status(&mut t), + FdStatus::OfferPending { + target: 0x0001, + total: 0x0010_0000, + mode: TransferMode::InTransport, + svn_delayed: false, + } + ); + + send_ok(&mut t, |b| wire::encode_accept_offer(b, 0x2000_0000)); + assert_eq!(query_status(&mut t), FdStatus::ReadyXfer); + } + + // Transfer is UA-driven (no IPC op). The FD enters VerifyPending + // when the transfer completes, so the command sequence starts there. + #[test] + fn command_sequence_verify_through_idle() { + let mut t = Loopback::<_, MAX_RESPONSE_SIZE>::new(FdIpcServer::new(StubFd::at( + FdStatus::VerifyPending, + ))); + + send_ok(&mut t, wire::encode_perform_verify); + assert_eq!(query_status(&mut t), FdStatus::ApplyPending); + + send_ok(&mut t, wire::encode_perform_apply); + assert_eq!(query_status(&mut t), FdStatus::ActivationPending); + + send_ok(&mut t, wire::encode_perform_activate); + assert_eq!(query_status(&mut t), FdStatus::Idle { reason: 0 }); + } + + #[test] + fn svn_commit_after_activation() { + let mut t = Loopback::<_, MAX_RESPONSE_SIZE>::new(FdIpcServer::new(StubFd::at( + FdStatus::SvnCommitPending { component: 1 }, + ))); + + send_ok(&mut t, wire::encode_perform_svn_commit); + assert_eq!(query_status(&mut t), FdStatus::Idle { reason: 0 }); + } + + #[test] + fn ack_cancel_returns_to_idle() { + let mut t = Loopback::<_, MAX_RESPONSE_SIZE>::new(FdIpcServer::new(StubFd::at( + FdStatus::Cancelled, + ))); + + send_ok(&mut t, wire::encode_ack_cancel); + assert_eq!(query_status(&mut t), FdStatus::Idle { reason: 0 }); + } + + #[test] + fn an_oversized_request_is_answered_by_dispatch_not_the_transport() { + // A loopback has no request buffer to overflow, so nothing caps the + // request at the transport. The decoder rejects it instead and the + // caller gets an error frame, the same answer a malformed request of + // any length gets. + let mut transport = Loopback::<_, MAX_RESPONSE_SIZE>::new(FdIpcServer::new(StubFd::idle())); + let req = [0u8; MAX_REQUEST_SIZE + 1]; + let mut resp = [0u8; MAX_RESPONSE_SIZE]; + + transport.start(&req).unwrap(); + let len = transport.poll(&mut resp).unwrap().unwrap(); + + let h = wire::decode_response_header(&resp[..len]).unwrap(); + assert!(!h.is_success()); + } +} diff --git a/services/pldm/src/firmware_device.rs b/services/pldm/src/firmware_device.rs index 2580b29ce..51454e42a 100644 --- a/services/pldm/src/firmware_device.rs +++ b/services/pldm/src/firmware_device.rs @@ -44,6 +44,7 @@ use openprot_mctp_api::MctpClient; use pldm_interface::cmd_interface::CmdInterface; use pldm_interface::control_context::ProtocolCapability; +use pldm_interface::error::MsgHandlerError; use pldm_interface::firmware_device::fd_context::FirmwareDeviceContext; use pldm_interface::firmware_device::fd_ops::FdOps; @@ -104,9 +105,10 @@ impl FdEventSink for () { /// Outcome of [`FirmwareDevice::run_terminus`]. pub enum RunTerminusResult { - /// The loop exited normally (currently unreachable: `run_terminus` only - /// returns via an error today, but this variant exists so a future, - /// well-defined completion condition does not require an API change). + /// The update session ended: the FD left update mode and is `Idle` + /// again, either because the Update Agent activated the new firmware or + /// because it cancelled. A device that serves more than one update calls + /// [`run_terminus`](FirmwareDevice::run_terminus) again. Completed, /// The loop was stopped by an unrecoverable error. StoppedByError(PldmServiceError), @@ -177,7 +179,14 @@ impl<'a, O: FdOps, Cr: MctpClient, Cq: MctpClient> FirmwareDevice<'a, O, Cr, Cq> /// listener is bound, silently dropping any Update Agent command that /// arrives in that window. /// - /// This method loops indefinitely and returns only on error. + /// Between two calls nothing is registered either: the listener is a + /// local variable, and dropping it unregisters it. A command sent + /// then is lost; an Update Agent resends a request that gets no + /// answer. + /// + /// This method loops until the FD leaves update mode — the `Idle` the + /// Update Agent's `ActivateFirmware` or cancel returns it to — or an + /// error stops it. /// A `timeout_millis` of `0` blocks indefinitely while idle. /// /// `requester_timeout_millis` bounds how long each `send_request` call @@ -238,12 +247,25 @@ impl<'a, O: FdOps, Cr: MctpClient, Cq: MctpClient> FirmwareDevice<'a, O, Cr, Cq> // responder poll below (no `continue`) so an Update Agent command // such as CancelUpdate is serviced between every RequestFirmwareData. let initiator_active = self.cmd_interface.fd_ctx.should_start_initiator_mode(); - if initiator_active - && let Some(pldm_len) = self - .cmd_interface - .generate_initiator_request(&mut fw_buf) - .map_err(PldmServiceError::MsgHandler)? - { + let outbound = if initiator_active { + match self.cmd_interface.generate_initiator_request(&mut fw_buf) { + Ok(pldm_len) => pldm_len, + // TEMPORARY. `fd_progress_*` answers "the FD_T2 retry + // timer has not elapsed" with the same error it uses for + // a state mismatch, so a device waiting to re-send has + // nothing else to report. Taken as nothing to send this + // round. The same error covers a request left in + // `Failed`, which then waits for the UA to cancel with no + // timeout, because the T1 check in `fd_progress` sits + // after it. Remove once pldm-lib returns `Ok(0)` for the + // wait, so the T1 check runs again. + Err(MsgHandlerError::FdInitiatorModeError) => None, + Err(e) => return Err(e.into()), + } + } else { + None + }; + if let Some(pldm_len) = outbound { let resp_len = self.requester_transport.send_request( remote_eid, pldm_len, @@ -256,9 +278,7 @@ impl<'a, O: FdOps, Cr: MctpClient, Cq: MctpClient> FirmwareDevice<'a, O, Cr, Cq> let resp = fw_buf .get_mut(..resp_total_len) .ok_or(PldmServiceError::PldmMem(PldmMemError::BufferTooSmall))?; - self.cmd_interface - .process_initiator_response(resp) - .map_err(PldmServiceError::MsgHandler)?; + self.cmd_interface.process_initiator_response(resp)?; } // Phase 2: poll for an inbound command so the responder path @@ -287,15 +307,19 @@ impl<'a, O: FdOps, Cr: MctpClient, Cq: MctpClient> FirmwareDevice<'a, O, Cr, Cq> if source_eid != remote_eid { return Ok(0); } - self.cmd_interface - .handle_responder_msg(framed_buf) - .map_err(PldmServiceError::MsgHandler) + Ok(self.cmd_interface.handle_responder_msg(framed_buf)?) }, ) { Ok(()) => { - if !was_update_mode && self.cmd_interface.fd_ctx.is_update_mode() { + let is_update_mode = self.cmd_interface.fd_ctx.is_update_mode(); + if !was_update_mode && is_update_mode { sink.notify(FdEvent::UpdateRequested); } + // The true→false edge is the end of the session: the FD + // answered ActivateFirmware (or a cancel) and is Idle. + if was_update_mode && !is_update_mode { + return Ok(()); + } } // A short poll timeout while an initiator request is active // just means no UA command arrived in that window; keep diff --git a/services/pldm/src/transport.rs b/services/pldm/src/transport.rs index a9eb34c67..73988b10f 100644 --- a/services/pldm/src/transport.rs +++ b/services/pldm/src/transport.rs @@ -108,10 +108,7 @@ impl MctpPldmTransport { } // Open an outbound request channel. - let mut req_channel = self - .stack - .req(remote_eid, timeout_millis) - .map_err(PldmServiceError::Mctp)?; + let mut req_channel = self.stack.req(remote_eid, timeout_millis)?; // Send the PLDM payload (buf[1..1+pldm_len]). The MCTP layer adds // its own framing, so we exclude buf[0]. @@ -121,15 +118,13 @@ impl MctpPldmTransport { let req_payload = buf .get(1..req_end) .ok_or(PldmServiceError::PldmMem(PldmMemError::BufferTooSmall))?; - req_channel - .send(MCTP_PLDM_MSG_TYPE, req_payload) - .map_err(PldmServiceError::Mctp)?; + req_channel.send(MCTP_PLDM_MSG_TYPE, req_payload)?; // Receive the PLDM response into buf[1..]. let recv_buf = buf .get_mut(1..) .ok_or(PldmServiceError::PldmMem(PldmMemError::BufferTooSmall))?; - let (meta, _) = req_channel.recv(recv_buf).map_err(PldmServiceError::Mctp)?; + let (meta, _) = req_channel.recv(recv_buf)?; Ok(meta.payload_size) } @@ -198,9 +193,7 @@ impl MctpPldmTransport { &self, timeout_millis: u32, ) -> Result, PldmServiceError> { - self.stack - .listener(MCTP_PLDM_MSG_TYPE, timeout_millis) - .map_err(PldmServiceError::Mctp) + Ok(self.stack.listener(MCTP_PLDM_MSG_TYPE, timeout_millis)?) } /// Receive one incoming PLDM request on an already-registered `listener` @@ -230,10 +223,7 @@ impl MctpPldmTransport { let recv_buf = buf .get_mut(1..) .ok_or(PldmServiceError::PldmMem(PldmMemError::BufferTooSmall))?; - let (meta, mut resp_channel) = listener - .recv(recv_buf) - .map(|(m, _, r)| (m, r)) - .map_err(PldmServiceError::Mctp)?; + let (meta, _, mut resp_channel) = listener.recv(recv_buf)?; let payload_size = meta.payload_size; @@ -265,8 +255,6 @@ impl MctpPldmTransport { let resp_payload = buf .get(1..resp_total_len) .ok_or(PldmServiceError::PldmMem(PldmMemError::BufferTooSmall))?; - resp_channel - .send(resp_payload) - .map_err(PldmServiceError::Mctp) + Ok(resp_channel.send(resp_payload)?) } } diff --git a/services/pldm/tests/base_host.rs b/services/pldm/tests/base_host.rs index 29e1fc936..9c19d774e 100644 --- a/services/pldm/tests/base_host.rs +++ b/services/pldm/tests/base_host.rs @@ -13,12 +13,22 @@ use openprot_pldm_service::firmware_device::{FirmwareDevice, RunTerminusResult}; use openprot_pldm_service::{MctpPldmTransport, PldmServiceError}; use pldm_common::codec::PldmCodec; use pldm_common::message::control::{GetPldmVersionRequest, GetTidRequest, SetTidRequest}; +use pldm_common::message::firmware_update::activate_pending_component::{ + PendingComponent, PendingComponentResult, +}; use pldm_common::message::firmware_update::apply_complete::ApplyResult; use pldm_common::message::firmware_update::get_fw_params::FirmwareParameters; use pldm_common::message::firmware_update::get_status::ProgressPercent; +use pldm_common::message::firmware_update::request_cancel::{ + NonFunctioningComponentBitmap, NonFunctioningComponentIndication, +}; use pldm_common::message::firmware_update::transfer_complete::TransferResult; +use pldm_common::message::firmware_update::update_security_revision::{ + SecurityRevisionComponent, SecurityRevisionResult, +}; use pldm_common::message::firmware_update::verify_complete::VerifyResult; use pldm_common::protocol::base::{PldmMsgType, PldmSupportedType, TransferOperationFlag}; +use pldm_common::protocol::firmware_update::PldmFdTime; use pldm_common::protocol::firmware_update::{ComponentResponseCode, Descriptor}; use pldm_common::util::fw_component::FirmwareComponent; use pldm_interface::firmware_device::fd_ops::{ComponentOperation, FdOps, FdOpsError}; @@ -128,6 +138,7 @@ impl FdOps for MockFdOps { fn cancel_update_component(&self, _component: &FirmwareComponent) -> Result<(), FdOpsError> { Ok(()) } + fd_ops_nothing_to_say!(); } #[test] diff --git a/services/pldm/tests/common.rs b/services/pldm/tests/common.rs index 331166860..504261cc6 100644 --- a/services/pldm/tests/common.rs +++ b/services/pldm/tests/common.rs @@ -10,6 +10,7 @@ use mctp_lib::fragment::{Fragmenter, SendOutput}; use mctp_lib::Sender; use openprot_mctp_api::{Handle, MctpClient, MctpError, RecvMetadata, ResponseCode}; use openprot_mctp_server::Server; +use pldm_common::protocol::firmware_update::PldmFdTime; pub const FD_EID: u8 = 42; pub const UA_EID: u8 = 8; @@ -120,3 +121,62 @@ impl MctpClient for DirectClientWithPump< let _ = self.server.borrow_mut().unbind(handle); } } + +/// The clock the host tests measure FD_T1 and FD_T2 against. The wall +/// clock is monotonic enough for a test that runs in milliseconds. +pub fn now_millis() -> PldmFdTime { + std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .map(|d| d.as_millis() as PldmFdTime) + .unwrap_or(0) +} + +/// The four `FdOps` callbacks a host test has nothing to say about: +/// pending-component activation, non-functioning components, the security +/// revision commit, and the clock. pldm-lib made them required, so every +/// implementation names them whether or not its test exercises them. +/// +/// Expands inside an `impl FdOps for ...` block. A test that does exercise +/// one of them writes it out instead of invoking this. +#[macro_export] +macro_rules! fd_ops_nothing_to_say { + () => { + /// Nothing in this test activates a pending image. + fn handle_pending_component( + &self, + _component: &PendingComponent, + _fw_params: &FirmwareParameters, + ) -> Result { + Ok(PendingComponentResult::NotPermitted) + } + + /// No component goes non-functional when this device leaves update mode. + fn get_non_functional_component_info( + &self, + ) -> Result< + ( + NonFunctioningComponentIndication, + NonFunctioningComponentBitmap, + ), + FdOpsError, + > { + Ok(( + NonFunctioningComponentIndication::ComponentsFunctioning, + NonFunctioningComponentBitmap::new(0), + )) + } + + /// This device does not commit security revisions. + fn update_security_revision( + &self, + _component: &SecurityRevisionComponent, + _fw_params: &FirmwareParameters, + ) -> Result { + Ok(SecurityRevisionResult::NotPermitted) + } + + fn now(&self) -> PldmFdTime { + $crate::common::now_millis() + } + }; +} diff --git a/services/pldm/tests/firmware_update_host.rs b/services/pldm/tests/firmware_update_host.rs index 1e8d8752c..5407e14a3 100644 --- a/services/pldm/tests/firmware_update_host.rs +++ b/services/pldm/tests/firmware_update_host.rs @@ -27,16 +27,22 @@ use mctp_lib::Sender; use openprot_mctp_api::Handle; use openprot_mctp_server::Server; use openprot_orchestrator_pldm_adapter::UpdateRequestLatch; -use openprot_orchestrator_sm::Event; +use openprot_orchestrator_sm::{ComponentId, Event}; use openprot_pldm_service::firmware_device::{FirmwareDevice, RunTerminusResult}; use openprot_pldm_service::{MctpPldmTransport, PldmServiceError}; use pldm_common::codec::{PldmCodec, PldmCodecWithLifetime}; +use pldm_common::message::firmware_update::activate_pending_component::{ + PendingComponent, PendingComponentResult, +}; use pldm_common::message::firmware_update::apply_complete::{ApplyCompleteResponse, ApplyResult}; use pldm_common::message::firmware_update::get_fw_params::FirmwareParameters; use pldm_common::message::firmware_update::get_status::{ GetStatusRequest, GetStatusResponse, ProgressPercent, }; use pldm_common::message::firmware_update::pass_component::PassComponentTableRequest; +use pldm_common::message::firmware_update::request_cancel::{ + NonFunctioningComponentBitmap, NonFunctioningComponentIndication, +}; use pldm_common::message::firmware_update::request_fw_data::{ RequestFirmwareDataRequest, RequestFirmwareDataResponse, MAX_TRANSFER_SIZE, }; @@ -45,12 +51,16 @@ use pldm_common::message::firmware_update::transfer_complete::{ TransferCompleteResponse, TransferResult, }; use pldm_common::message::firmware_update::update_component::UpdateComponentRequest; +use pldm_common::message::firmware_update::update_security_revision::{ + SecurityRevisionComponent, SecurityRevisionResult, +}; use pldm_common::message::firmware_update::verify_complete::{ VerifyCompleteResponse, VerifyResult, }; use pldm_common::protocol::base::{ PldmBaseCompletionCode, PldmMsgHeader, PldmMsgType, TransferRespFlag, }; +use pldm_common::protocol::firmware_update::PldmFdTime; use pldm_common::protocol::firmware_update::{ ComponentClassification, ComponentResponseCode, Descriptor, FirmwareDeviceState, FwUpdateCmd, FwUpdateCompletionCode, PldmFirmwareString, UpdateOptionFlags, VersionStringType, @@ -74,6 +84,7 @@ const IMAGE_SIZE: u32 = 1024; struct MockFdOps { component_accepted: Cell, download_bytes_received: Cell, + downloaded_image: RefCell<[u8; IMAGE_SIZE as usize]>, verified: Cell, applied: Cell, } @@ -112,17 +123,29 @@ impl FdOps for MockFdOps { &self, _component: &FirmwareComponent, ) -> Result<(usize, usize), FdOpsError> { - Ok((0, IMAGE_SIZE as usize)) + let offset = self.download_bytes_received.get(); + let length = (IMAGE_SIZE as usize) + .checked_sub(offset) + .ok_or(FdOpsError::FwDownloadError)?; + Ok((offset, length)) } fn download_fw_data( &self, - _offset: usize, + offset: usize, data: &[u8], _component: &FirmwareComponent, ) -> Result { + let end = offset + .checked_add(data.len()) + .ok_or(FdOpsError::FwDownloadError)?; + let mut downloaded_image = self.downloaded_image.borrow_mut(); + let destination = downloaded_image + .get_mut(offset..end) + .ok_or(FdOpsError::FwDownloadError)?; + destination.copy_from_slice(data); self.download_bytes_received - .set(self.download_bytes_received.get() + data.len()); + .set(end.max(self.download_bytes_received.get())); Ok(TransferResult::TransferSuccess) } @@ -173,6 +196,7 @@ impl FdOps for MockFdOps { fn cancel_update_component(&self, _component: &FirmwareComponent) -> Result<(), FdOpsError> { Ok(()) } + fd_ops_nothing_to_say!(); } // --------------------------------------------------------------------------- @@ -200,6 +224,7 @@ fn fw_string(s: &str) -> PldmFirmwareString { fn serve_ua_fw_request( ua_server: &RefCell>, listener: Handle, + component_image: &[u8], ) { let mut req = [0u8; 1024]; let meta = match ua_server.borrow_mut().try_recv(listener, &mut req) { @@ -218,10 +243,14 @@ fn serve_ua_fw_request( Ok(FwUpdateCmd::RequestFirmwareData) => { let fw_req = RequestFirmwareDataRequest::decode(payload).expect("decode RequestFirmwareData"); + let offset = fw_req.offset as usize; let length = fw_req.length as usize; assert!(length <= MAX_TRANSFER_SIZE, "requested chunk exceeds MTU"); - let data = [0xA5u8; MAX_TRANSFER_SIZE]; - let resp_msg = RequestFirmwareDataResponse::new(instance_id, success, &data[..length]); + let end = offset.checked_add(length).expect("firmware range overflow"); + let data = component_image + .get(offset..end) + .expect("requested range should be within the component image"); + let resp_msg = RequestFirmwareDataResponse::new(instance_id, success, data); PldmCodecWithLifetime::encode(&resp_msg, &mut resp) .expect("encode RequestFirmwareData response") } @@ -256,9 +285,12 @@ fn serve_ua_fw_request( #[test] fn firmware_update_full_flow_via_requester() { + let component_image: [u8; IMAGE_SIZE as usize] = + core::array::from_fn(|offset| (offset as u8).wrapping_mul(31).wrapping_add(7)); let fd_ops = MockFdOps { component_accepted: Cell::new(false), download_bytes_received: Cell::new(0), + downloaded_image: RefCell::new([0u8; IMAGE_SIZE as usize]), verified: Cell::new(false), applied: Cell::new(false), }; @@ -291,7 +323,7 @@ fn firmware_update_full_flow_via_requester() { transfer(&fd_to_ua_packets, &mut ua_server.borrow_mut()); fd_to_ua_packets.borrow_mut().clear(); // UA answers the request. - serve_ua_fw_request(&ua_server, ua_fw_listener); + serve_ua_fw_request(&ua_server, ua_fw_listener, &component_image); // Deliver the UA response back to the FD. transfer(&ua_to_fd_packets, &mut fd_server.borrow_mut()); ua_to_fd_packets.borrow_mut().clear(); @@ -317,7 +349,7 @@ fn firmware_update_full_flow_via_requester() { // Orchestrator-facing latch: `run_terminus` marks it on each accepted // RequestUpdate; the assertions below drain it as `Event::UpdateRequest`. - let update_events = RefCell::new(UpdateRequestLatch::new()); + let update_events = RefCell::new(UpdateRequestLatch::new(ComponentId::new(0))); // Run one full UA->FD->UA command round-trip and return the PLDM response // payload (without the MCTP framing byte). @@ -376,12 +408,13 @@ fn firmware_update_full_flow_via_requester() { let len = req_update.encode(&mut buf).expect("encode RequestUpdate"); let resp = ua_transact(&buf[..len]); assert_eq!( - resp[3], 0, + resp[3], + PldmBaseCompletionCode::Success as u8, "RequestUpdate completion code should be success" ); assert_eq!( update_events.borrow_mut().take(), - Some(Event::UpdateRequest), + Some(Event::UpdateRequest(ComponentId::new(0))), "accepted RequestUpdate should latch exactly one orchestrator event" ); assert_eq!( @@ -433,7 +466,8 @@ fn firmware_update_full_flow_via_requester() { .expect("encode PassComponentTable"); let resp = ua_transact(&buf[..len]); assert_eq!( - resp[3], 0, + resp[3], + PldmBaseCompletionCode::Success as u8, "PassComponentTable completion code should be success" ); assert!( @@ -459,7 +493,8 @@ fn firmware_update_full_flow_via_requester() { .expect("encode UpdateComponent"); let resp = ua_transact(&buf[..len]); assert_eq!( - resp[3], 0, + resp[3], + PldmBaseCompletionCode::Success as u8, "UpdateComponent completion code should be success" ); @@ -478,7 +513,8 @@ fn firmware_update_full_flow_via_requester() { let resp = ua_transact(&b[..n]); let status = GetStatusResponse::decode(&resp).expect("decode GetStatusResponse"); assert_eq!( - status.completion_code, 0, + status.completion_code, + PldmBaseCompletionCode::Success as u8, "GetStatus completion should be success" ); assert_eq!( @@ -493,6 +529,11 @@ fn firmware_update_full_flow_via_requester() { IMAGE_SIZE as usize, "the full firmware image should have been downloaded" ); + assert_eq!( + *fd_ops.downloaded_image.borrow(), + component_image, + "the downloaded component image should match the Update Agent image" + ); assert!(fd_ops.verified.get(), "firmware should have been verified"); assert!(fd_ops.applied.get(), "firmware should have been applied"); assert_eq!( diff --git a/services/pldm/tests/inventory_host.rs b/services/pldm/tests/inventory_host.rs new file mode 100644 index 000000000..a29d0dff6 --- /dev/null +++ b/services/pldm/tests/inventory_host.rs @@ -0,0 +1,313 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! End-to-end host test for PLDM firmware-update inventory commands. +//! +//! The Update Agent queries a Firmware Device over in-memory MCTP and verifies +//! the type 5 device identifiers and firmware parameters supplied by `FdOps`. + +use core::cell::RefCell; + +use mctp::Eid; +use openprot_mctp_server::Server; +use openprot_pldm_service::firmware_device::{FirmwareDevice, RunTerminusResult}; +use openprot_pldm_service::{MctpPldmTransport, PldmServiceError}; +use pldm_common::codec::PldmCodec; +use pldm_common::message::firmware_update::activate_pending_component::{ + PendingComponent, PendingComponentResult, +}; +use pldm_common::message::firmware_update::apply_complete::ApplyResult; +use pldm_common::message::firmware_update::get_fw_params::{ + FirmwareParameters, GetFirmwareParametersRequest, GetFirmwareParametersResponse, +}; +use pldm_common::message::firmware_update::get_status::ProgressPercent; +use pldm_common::message::firmware_update::query_devid::{ + QueryDeviceIdentifiersRequest, QueryDeviceIdentifiersResponse, +}; +use pldm_common::message::firmware_update::request_cancel::{ + NonFunctioningComponentBitmap, NonFunctioningComponentIndication, +}; +use pldm_common::message::firmware_update::transfer_complete::TransferResult; +use pldm_common::message::firmware_update::update_security_revision::{ + SecurityRevisionComponent, SecurityRevisionResult, +}; +use pldm_common::message::firmware_update::verify_complete::VerifyResult; +use pldm_common::protocol::base::{PldmBaseCompletionCode, PldmMsgType}; +use pldm_common::protocol::firmware_update::PldmFdTime; +use pldm_common::protocol::firmware_update::{ + ComponentActivationMethods, ComponentClassification, ComponentParameterEntry, + ComponentResponseCode, Descriptor, DescriptorType, FirmwareDeviceCapability, + PldmFirmwareString, PldmFirmwareVersion, +}; +use pldm_common::util::fw_component::FirmwareComponent; +use pldm_interface::firmware_device::fd_ops::{ComponentOperation, FdOps, FdOpsError}; + +mod common; +use common::{transfer, BufferSender, DirectClientWithPump, FD_EID, TIMEOUT_MILLIS, UA_EID}; + +struct InventoryFdOps { + descriptors: [Descriptor; 2], + firmware_parameters: FirmwareParameters, +} + +impl FdOps for InventoryFdOps { + fn get_device_identifiers( + &self, + device_identifiers: &mut [Descriptor], + ) -> Result { + let destination = device_identifiers + .get_mut(..self.descriptors.len()) + .ok_or(FdOpsError::DeviceIdentifiersError)?; + destination.copy_from_slice(&self.descriptors); + Ok(self.descriptors.len()) + } + + fn get_firmware_parms( + &self, + firmware_params: &mut FirmwareParameters, + ) -> Result<(), FdOpsError> { + *firmware_params = self.firmware_parameters.clone(); + Ok(()) + } + + fn get_xfer_size(&self, _ua_transfer_size: usize) -> Result { + Err(FdOpsError::TransferSizeError) + } + + fn handle_component( + &self, + _component: &FirmwareComponent, + _fw_params: &FirmwareParameters, + _op: ComponentOperation, + ) -> Result { + Err(FdOpsError::ComponentError) + } + + fn query_download_offset_and_length( + &self, + _component: &FirmwareComponent, + ) -> Result<(usize, usize), FdOpsError> { + Err(FdOpsError::FwDownloadError) + } + + fn download_fw_data( + &self, + _offset: usize, + _data: &[u8], + _component: &FirmwareComponent, + ) -> Result { + Err(FdOpsError::FwDownloadError) + } + + fn is_download_complete(&self, _component: &FirmwareComponent) -> bool { + false + } + + fn query_download_progress( + &self, + _component: &FirmwareComponent, + _progress_percent: &mut ProgressPercent, + ) -> Result<(), FdOpsError> { + Err(FdOpsError::FwDownloadError) + } + + fn verify( + &self, + _component: &FirmwareComponent, + _progress_percent: &mut ProgressPercent, + ) -> Result { + Err(FdOpsError::VerifyError) + } + + fn apply( + &self, + _component: &FirmwareComponent, + _progress_percent: &mut ProgressPercent, + ) -> Result { + Err(FdOpsError::ApplyError) + } + + fn activate( + &self, + _self_contained_activation: u8, + _estimated_time: &mut u16, + ) -> Result { + Err(FdOpsError::ActivateError) + } + + fn cancel_update_component(&self, _component: &FirmwareComponent) -> Result<(), FdOpsError> { + Err(FdOpsError::CancelUpdateError) + } + fd_ops_nothing_to_say!(); +} + +fn firmware_string(value: &str) -> PldmFirmwareString { + match PldmFirmwareString::new("ASCII", value) { + Ok(value) => value, + Err(error) => panic!("invalid firmware string {value}: {error:?}"), + } +} + +#[test] +fn firmware_update_inventory_commands_return_fd_data() { + let pci_vendor_id = match Descriptor::new(DescriptorType::PciVendorId, &[0x34, 0x12]) { + Ok(descriptor) => descriptor, + Err(error) => panic!("invalid PCI vendor descriptor: {error:?}"), + }; + let uuid = match Descriptor::new( + DescriptorType::Uuid, + &[ + 0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, + 0xcd, 0xef, + ], + ) { + Ok(descriptor) => descriptor, + Err(error) => panic!("invalid UUID descriptor: {error:?}"), + }; + let descriptors = [pci_vendor_id, uuid]; + + let active_image_set_version = firmware_string("platform-2.4.0"); + let pending_image_set_version = firmware_string("platform-2.5.0"); + let active_component_version = firmware_string("controller-2.4.0"); + let pending_component_version = firmware_string("controller-2.5.0"); + let active_version = + PldmFirmwareVersion::new(0x0002_0400, &active_component_version, Some("20260801")); + let pending_version = + PldmFirmwareVersion::new(0x0002_0500, &pending_component_version, Some("20260901")); + let component = ComponentParameterEntry::new( + ComponentClassification::Firmware, + 0x1001, + 0, + &active_version, + &pending_version, + ComponentActivationMethods(0x0009), + FirmwareDeviceCapability(0x0000_0003), + ); + let firmware_parameters = FirmwareParameters::new( + FirmwareDeviceCapability(0x0000_0003), + 1, + &active_image_set_version, + &pending_image_set_version, + &[component], + ); + let fd_ops = InventoryFdOps { + descriptors, + firmware_parameters: firmware_parameters.clone(), + }; + + let ua_to_fd_packets = RefCell::new(Vec::new()); + let ua_sender = BufferSender { + packets: &ua_to_fd_packets, + }; + let ua_server: RefCell> = RefCell::new(Server::new(Eid(UA_EID), 0, ua_sender)); + + let fd_to_ua_packets = RefCell::new(Vec::new()); + let fd_sender = BufferSender { + packets: &fd_to_ua_packets, + }; + let fd_server: RefCell> = RefCell::new(Server::new(Eid(FD_EID), 0, fd_sender)); + + // Create the DirectClientWithPump for the responder role, which handles requests from the UA to the FD. + let responder_client = DirectClientWithPump::new(&fd_server, || { + transfer(&ua_to_fd_packets, &mut fd_server.borrow_mut()); + ua_to_fd_packets.borrow_mut().clear(); + }); + + // Inventory Commands do not invoke the FW FSM and do not invoke FD as an initiator. Therefore the closure is empty. + let requester_client = DirectClientWithPump::new(&fd_server, || {}); + let mut fd = FirmwareDevice::init( + &fd_ops, + &pldm_interface::config::PLDM_PROTOCOL_CAPABILITIES, + MctpPldmTransport::new(responder_client), + MctpPldmTransport::new(requester_client), + ); + let mut fd_buf = [0u8; 1024]; + + let mut transact = |request: &[u8]| -> Vec { + let handle = ua_server + .borrow_mut() + .req(FD_EID) + .expect("allocate UA request handle"); + ua_server + .borrow_mut() + .send(Some(handle), 0x01, None, None, false, request) + .expect("send inventory request"); + + match fd.run_terminus(UA_EID, &mut fd_buf, TIMEOUT_MILLIS, TIMEOUT_MILLIS, &mut ()) { + RunTerminusResult::Completed => {} + RunTerminusResult::StoppedByError(PldmServiceError::Mctp(error)) + if error.is_timeout() => {} + RunTerminusResult::StoppedByError(error) => { + panic!("firmware device failed: {error:?}") + } + } + + transfer(&fd_to_ua_packets, &mut ua_server.borrow_mut()); + fd_to_ua_packets.borrow_mut().clear(); + let mut response = [0u8; 1024]; + let metadata = ua_server + .borrow_mut() + .try_recv(handle, &mut response) + .expect("inventory response should be available"); + let payload = response + .get(..metadata.payload_size) + .expect("response payload should fit the receive buffer") + .to_vec(); + let _ = ua_server.borrow_mut().unbind(handle); + payload + }; + + let mut request_buf = [0u8; 64]; + let mut instance_id = 0u8; + let query_device_identifiers = + QueryDeviceIdentifiersRequest::new(instance_id, PldmMsgType::Request); + let request_len = query_device_identifiers + .encode(&mut request_buf) + .expect("encode QueryDeviceIdentifiers"); + let response = transact( + request_buf + .get(..request_len) + .expect("encoded request should fit the request buffer"), + ); + let response = QueryDeviceIdentifiersResponse::decode(&response) + .expect("decode QueryDeviceIdentifiers response"); + assert_eq!( + response.completion_code, + PldmBaseCompletionCode::Success as u8 + ); + assert_eq!(response.descriptor_count, 2); + let [expected_initial, expected_additional] = descriptors; + assert_eq!(response.initial_descriptor, expected_initial); + let additional = response + .additional_descriptors + .as_ref() + .expect("UUID descriptor should be present"); + let [actual_additional, ..] = additional; + assert_eq!(*actual_additional, expected_additional); + assert_eq!( + response.device_identifiers_len as usize, + descriptors + .iter() + .map(Descriptor::codec_size_in_bytes) + .sum() + ); + + instance_id += 1; + let get_firmware_parameters = + GetFirmwareParametersRequest::new(instance_id, PldmMsgType::Request); + let request_len = get_firmware_parameters + .encode(&mut request_buf) + .expect("encode GetFirmwareParameters"); + let response = transact( + request_buf + .get(..request_len) + .expect("encoded request should fit the request buffer"), + ); + let response = GetFirmwareParametersResponse::decode(&response) + .expect("decode GetFirmwareParameters response"); + assert_eq!( + response.completion_code, + PldmBaseCompletionCode::Success as u8 + ); + assert_eq!(response.parms, firmware_parameters); +} diff --git a/services/pldm/tests/unexpected_eid_fw_host.rs b/services/pldm/tests/unexpected_eid_fw_host.rs index 055b974be..34033ee44 100644 --- a/services/pldm/tests/unexpected_eid_fw_host.rs +++ b/services/pldm/tests/unexpected_eid_fw_host.rs @@ -12,15 +12,25 @@ use openprot_mctp_server::Server; use openprot_pldm_service::firmware_device::{FirmwareDevice, RunTerminusResult}; use openprot_pldm_service::{MctpPldmTransport, PldmServiceError}; use pldm_common::codec::PldmCodec; +use pldm_common::message::firmware_update::activate_pending_component::{ + PendingComponent, PendingComponentResult, +}; use pldm_common::message::firmware_update::apply_complete::ApplyResult; use pldm_common::message::firmware_update::get_fw_params::FirmwareParameters; use pldm_common::message::firmware_update::get_status::{ GetStatusRequest, GetStatusResponse, ProgressPercent, }; +use pldm_common::message::firmware_update::request_cancel::{ + NonFunctioningComponentBitmap, NonFunctioningComponentIndication, +}; use pldm_common::message::firmware_update::request_update::RequestUpdateRequest; use pldm_common::message::firmware_update::transfer_complete::TransferResult; +use pldm_common::message::firmware_update::update_security_revision::{ + SecurityRevisionComponent, SecurityRevisionResult, +}; use pldm_common::message::firmware_update::verify_complete::VerifyResult; -use pldm_common::protocol::base::PldmMsgType; +use pldm_common::protocol::base::{PldmBaseCompletionCode, PldmMsgType}; +use pldm_common::protocol::firmware_update::PldmFdTime; use pldm_common::protocol::firmware_update::{ ComponentResponseCode, Descriptor, FirmwareDeviceState, }; @@ -139,6 +149,7 @@ impl FdOps for MockFdOps { fn cancel_update_component(&self, _component: &FirmwareComponent) -> Result<(), FdOpsError> { Ok(()) } + fd_ops_nothing_to_say!(); } /// Build a fixed-size PLDM firmware version string. @@ -302,7 +313,8 @@ fn responder_ignores_fw_commands_from_unexpected_eid() { let status = GetStatusResponse::decode(&resp).expect("decode GetStatusResponse"); assert_eq!( - status.completion_code, 0, + status.completion_code, + PldmBaseCompletionCode::Success as u8, "GetStatus completion should be success" ); assert_eq!( diff --git a/services/pldm/tests/unexpected_eid_host.rs b/services/pldm/tests/unexpected_eid_host.rs index c074f2571..b52d94364 100644 --- a/services/pldm/tests/unexpected_eid_host.rs +++ b/services/pldm/tests/unexpected_eid_host.rs @@ -13,12 +13,22 @@ use openprot_pldm_service::firmware_device::{FirmwareDevice, RunTerminusResult}; use openprot_pldm_service::{MctpPldmTransport, PldmServiceError}; use pldm_common::codec::PldmCodec; use pldm_common::message::control::{GetTidRequest, SetTidRequest}; +use pldm_common::message::firmware_update::activate_pending_component::{ + PendingComponent, PendingComponentResult, +}; use pldm_common::message::firmware_update::apply_complete::ApplyResult; use pldm_common::message::firmware_update::get_fw_params::FirmwareParameters; use pldm_common::message::firmware_update::get_status::ProgressPercent; +use pldm_common::message::firmware_update::request_cancel::{ + NonFunctioningComponentBitmap, NonFunctioningComponentIndication, +}; use pldm_common::message::firmware_update::transfer_complete::TransferResult; +use pldm_common::message::firmware_update::update_security_revision::{ + SecurityRevisionComponent, SecurityRevisionResult, +}; use pldm_common::message::firmware_update::verify_complete::VerifyResult; use pldm_common::protocol::base::PldmMsgType; +use pldm_common::protocol::firmware_update::PldmFdTime; use pldm_common::protocol::firmware_update::{ComponentResponseCode, Descriptor}; use pldm_common::util::fw_component::FirmwareComponent; use pldm_interface::firmware_device::fd_ops::{ComponentOperation, FdOps, FdOpsError}; @@ -128,6 +138,7 @@ impl FdOps for MockFdOps { fn cancel_update_component(&self, _component: &FirmwareComponent) -> Result<(), FdOpsError> { Ok(()) } + fd_ops_nothing_to_say!(); } /// Security regression: the FD must only act on commands from the Update /// Agent EID it was told to serve (`run_terminus`'s `remote_eid`), not from diff --git a/services/test/mock-downstream-device/BUILD.bazel b/services/test/mock-downstream-device/BUILD.bazel new file mode 100644 index 000000000..153f09984 --- /dev/null +++ b/services/test/mock-downstream-device/BUILD.bazel @@ -0,0 +1,28 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") + +rust_library( + name = "mock_downstream_device", + srcs = [ + "src/boot.rs", + "src/error.rs", + "src/lib.rs", + "src/model.rs", + "src/tests.rs", + ], + crate_name = "openprot_mock_downstream_device", + edition = "2024", + visibility = ["//visibility:public"], + deps = [ + "//hal/blocking", + "@rust_crates//:embedded-hal", + ], +) + +# Host tests: the model is pin-generic, so it runs without a kernel. +rust_test( + name = "mock_downstream_device_test", + crate = ":mock_downstream_device", +) diff --git a/services/test/mock-downstream-device/src/boot.rs b/services/test/mock-downstream-device/src/boot.rs new file mode 100644 index 000000000..5000e3fa0 --- /dev/null +++ b/services/test/mock-downstream-device/src/boot.rs @@ -0,0 +1,36 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! What the modelled device does, and where it is in doing it. + +/// What the mock downstream device does once reset is released. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum BootBehaviour { + /// Raises the ready line `after_millis` after release. A boot that is + /// late rather than healthy is the same variant with a delay past the + /// window the RoT is willing to wait, so there is no third variant for + /// it: late is a property of the deadline, not of the device. + Boots { + /// Milliseconds from release to the ready line going active. + after_millis: u64, + }, + /// Never raises the ready line. The RoT finds out by its deadline + /// expiring, which is the only way it ever finds out. + Hangs, +} + +/// Where the modelled device is in its boot. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Phase { + /// Reset is asserted. The ready line is inactive. + Held, + /// Reset is released and the boot delay has not elapsed. + Booting { + /// When the delay started, in the caller's millisecond count. + released_at_millis: u64, + }, + /// The ready line is active. + Ready, + /// Reset is released and this device will never report ready. + Hung, +} diff --git a/services/test/mock-downstream-device/src/error.rs b/services/test/mock-downstream-device/src/error.rs new file mode 100644 index 000000000..0ba5e9901 --- /dev/null +++ b/services/test/mock-downstream-device/src/error.rs @@ -0,0 +1,30 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! What a poll reports when a line fails. + +/// Why a poll could not be completed. Carries the pin error so a caller +/// sees which line failed, not just that one did. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Error { + /// The reset line could not be read. + Reset(R), + /// The ready line could not be driven. + Ready(Y), +} + +impl core::fmt::Display for Error { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::Reset(e) => write!(f, "reading the reset line: {e}"), + Self::Ready(e) => write!(f, "driving the ready line: {e}"), + } + } +} + +impl core::error::Error for Error +where + R: core::fmt::Debug + core::fmt::Display, + Y: core::fmt::Debug + core::fmt::Display, +{ +} diff --git a/services/test/mock-downstream-device/src/lib.rs b/services/test/mock-downstream-device/src/lib.rs new file mode 100644 index 000000000..8dea39e13 --- /dev/null +++ b/services/test/mock-downstream-device/src/lib.rs @@ -0,0 +1,33 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! A BMC that boots, or does not, on demand. +//! +//! The RoT drives a reset line and watches a ready line. This models what +//! sits on the other end of those two wires: hold the ready line low while +//! reset is asserted, and once reset is released, raise it after a delay, +//! or never. That is the whole vocabulary a boot-sequence test needs from +//! a managed device. +//! +//! Nothing here knows what the lines are made of. On hardware they are +//! GPIO; in a QEMU test both ends live in one image and the pins are +//! whatever the board wiring supplies. The model is generic over +//! `InputPin` and `OutputPin` so neither case is special. +//! +//! Time arrives as an argument. [`MockDownstreamDevice::poll`] is given the current +//! millisecond count and never waits, so a caller can drive it from a +//! kernel event loop, or from a test that moves the clock by hand. + +#![cfg_attr(not(test), no_std)] +#![forbid(unsafe_code)] + +mod boot; +mod error; +mod model; + +pub use boot::{BootBehaviour, Phase}; +pub use error::Error; +pub use model::MockDownstreamDevice; + +#[cfg(test)] +mod tests; diff --git a/services/test/mock-downstream-device/src/model.rs b/services/test/mock-downstream-device/src/model.rs new file mode 100644 index 000000000..9ef71ec93 --- /dev/null +++ b/services/test/mock-downstream-device/src/model.rs @@ -0,0 +1,116 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The model itself: reads the reset line, drives the ready line. + +use openprot_hal_blocking::gpio_port::ActivePolarity; +use openprot_hal_blocking::{InputPin, OutputPin}; + +use crate::boot::{BootBehaviour, Phase}; +use crate::error::Error; + +/// The device on the other end of a reset line and a ready line. +pub struct MockDownstreamDevice { + reset: Reset, + reset_polarity: ActivePolarity, + ready: Ready, + ready_polarity: ActivePolarity, + behaviour: BootBehaviour, + phase: Phase, +} + +impl MockDownstreamDevice { + /// Wires the model to its two lines. + /// + /// Starts in [`Phase::Held`] without touching either line: the first + /// [`poll`](Self::poll) reads reset and drives ready to match, so a + /// caller that constructs this before the RoT has settled its outputs + /// does not latch a stale phase. + pub fn new( + reset: Reset, + reset_polarity: ActivePolarity, + ready: Ready, + ready_polarity: ActivePolarity, + behaviour: BootBehaviour, + ) -> Self { + Self { + reset, + reset_polarity, + ready, + ready_polarity, + behaviour, + phase: Phase::Held, + } + } + + /// Where the device is now. Only moves on [`poll`](Self::poll). + pub fn phase(&self) -> Phase { + self.phase + } + + /// Advances the model to `now_millis` and drives the ready line to + /// match. Never waits. + /// + /// Asserting reset at any point returns the device to [`Phase::Held`] + /// and drops the ready line, so a RoT that resets a device mid-boot + /// sees the evidence go away, exactly as it would on hardware. + /// + /// # Errors + /// + /// Returns [`Error::Reset`] if the reset line cannot be read and + /// [`Error::Ready`] if the ready line cannot be driven. + pub fn poll(&mut self, now_millis: u64) -> Result> { + if self.reset_asserted()? { + if self.phase != Phase::Held { + self.drive_ready(false)?; + self.phase = Phase::Held; + } + return Ok(self.phase); + } + + self.phase = match (self.phase, self.behaviour) { + // Released. Start the delay, or settle into never reporting. + (Phase::Held, BootBehaviour::Boots { .. }) => Phase::Booting { + released_at_millis: now_millis, + }, + (Phase::Held, BootBehaviour::Hangs) => Phase::Hung, + + // The delay is measured from release, so a caller that polls + // late still reports ready rather than restarting the count. + (Phase::Booting { released_at_millis }, BootBehaviour::Boots { after_millis }) => { + if now_millis.saturating_sub(released_at_millis) >= after_millis { + self.drive_ready(true)?; + Phase::Ready + } else { + Phase::Booting { released_at_millis } + } + } + + // Behaviour does not change under the model's feet, so the + // remaining pairs are either terminal or unreachable. + (phase, _) => phase, + }; + + Ok(self.phase) + } + + fn reset_asserted(&mut self) -> Result> { + let high = self.reset.is_high().map_err(Error::Reset)?; + Ok(match self.reset_polarity { + ActivePolarity::ActiveHigh => high, + ActivePolarity::ActiveLow => !high, + }) + } + + fn drive_ready(&mut self, active: bool) -> Result<(), Error> { + let high = match self.ready_polarity { + ActivePolarity::ActiveHigh => active, + ActivePolarity::ActiveLow => !active, + }; + if high { + self.ready.set_high().map_err(Error::Ready) + } else { + self.ready.set_low().map_err(Error::Ready) + } + } +} diff --git a/services/test/mock-downstream-device/src/tests.rs b/services/test/mock-downstream-device/src/tests.rs new file mode 100644 index 000000000..52d1e53a9 --- /dev/null +++ b/services/test/mock-downstream-device/src/tests.rs @@ -0,0 +1,251 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +use super::*; + +use core::cell::Cell; +use std::rc::Rc; + +use openprot_hal_blocking::gpio_port::ActivePolarity; +use openprot_hal_blocking::{InputPin, OutputPin}; + +/// A pin pair the test drives and reads directly. Shared through `Rc` so a +/// test can hold the reset line while the model holds its other end. +#[derive(Clone, Default)] +struct Line(Rc>); + +impl Line { + fn high() -> Self { + Self(Rc::new(Cell::new(true))) + } + + fn low() -> Self { + Self(Rc::new(Cell::new(false))) + } + + fn set(&self, high: bool) { + self.0.set(high); + } + + fn is_set_high(&self) -> bool { + self.0.get() + } +} + +impl embedded_hal::digital::ErrorType for Line { + type Error = core::convert::Infallible; +} + +impl InputPin for Line { + fn is_high(&mut self) -> Result { + Ok(self.0.get()) + } + + fn is_low(&mut self) -> Result { + Ok(!self.0.get()) + } +} + +impl OutputPin for Line { + fn set_high(&mut self) -> Result<(), Self::Error> { + self.0.set(true); + Ok(()) + } + + fn set_low(&mut self) -> Result<(), Self::Error> { + self.0.set(false); + Ok(()) + } +} + +/// Reset active low (the RoT_BMC_RESET_L convention), ready active high. +/// Starts asserted: reset low means held. +fn wire(behaviour: BootBehaviour) -> (Line, Line, MockDownstreamDevice) { + let reset = Line::low(); + let ready = Line::low(); + let device = MockDownstreamDevice::new( + reset.clone(), + ActivePolarity::ActiveLow, + ready.clone(), + ActivePolarity::ActiveHigh, + behaviour, + ); + (reset, ready, device) +} + +/// Releases reset: drives the active-low line high. +fn release(reset: &Line) { + reset.set(true); +} + +/// Asserts reset: drives the active-low line low. +fn assert_reset(reset: &Line) { + reset.set(false); +} + +#[test] +fn held_in_reset_the_ready_line_stays_low() { + let (_reset, ready, mut device) = wire(BootBehaviour::Boots { after_millis: 10 }); + + assert_eq!(device.poll(0).unwrap(), Phase::Held); + assert_eq!(device.poll(1_000).unwrap(), Phase::Held); + assert!(!ready.is_set_high()); +} + +#[test] +fn ready_goes_active_once_the_delay_has_passed() { + let (reset, ready, mut device) = wire(BootBehaviour::Boots { after_millis: 10 }); + + device.poll(0).unwrap(); + release(&reset); + + assert_eq!( + device.poll(100).unwrap(), + Phase::Booting { + released_at_millis: 100 + } + ); + assert!(!ready.is_set_high(), "ready before the delay elapsed"); + + assert_eq!( + device.poll(109).unwrap(), + Phase::Booting { + released_at_millis: 100 + } + ); + assert!(!ready.is_set_high(), "ready one millisecond early"); + + assert_eq!(device.poll(110).unwrap(), Phase::Ready); + assert!(ready.is_set_high()); +} + +#[test] +fn the_delay_runs_from_release_not_from_the_poll_that_notices() { + let (reset, ready, mut device) = wire(BootBehaviour::Boots { after_millis: 10 }); + + device.poll(0).unwrap(); + release(&reset); + device.poll(100).unwrap(); + + // A caller that goes away and comes back late still gets ready on the + // first poll past the deadline, not ten more milliseconds later. + assert_eq!(device.poll(5_000).unwrap(), Phase::Ready); + assert!(ready.is_set_high()); +} + +#[test] +fn a_zero_delay_reports_ready_on_the_first_poll_after_release() { + let (reset, ready, mut device) = wire(BootBehaviour::Boots { after_millis: 0 }); + + device.poll(0).unwrap(); + release(&reset); + + // Release is seen first, then the delay is judged, so this takes two + // polls. An event loop polls on every wake, so that costs nothing. + assert_eq!( + device.poll(7).unwrap(), + Phase::Booting { + released_at_millis: 7 + } + ); + assert_eq!(device.poll(7).unwrap(), Phase::Ready); + assert!(ready.is_set_high()); +} + +#[test] +fn a_hanging_device_never_reports_ready() { + let (reset, ready, mut device) = wire(BootBehaviour::Hangs); + + device.poll(0).unwrap(); + release(&reset); + + assert_eq!(device.poll(1).unwrap(), Phase::Hung); + assert_eq!(device.poll(u64::MAX).unwrap(), Phase::Hung); + assert!(!ready.is_set_high()); +} + +#[test] +fn asserting_reset_drops_the_evidence() { + let (reset, ready, mut device) = wire(BootBehaviour::Boots { after_millis: 10 }); + + device.poll(0).unwrap(); + release(&reset); + device.poll(100).unwrap(); + device.poll(110).unwrap(); + assert!(ready.is_set_high()); + + assert_reset(&reset); + assert_eq!(device.poll(120).unwrap(), Phase::Held); + assert!(!ready.is_set_high(), "ready survived a reset"); +} + +#[test] +fn a_reset_mid_boot_restarts_the_delay() { + let (reset, ready, mut device) = wire(BootBehaviour::Boots { after_millis: 10 }); + + device.poll(0).unwrap(); + release(&reset); + device.poll(100).unwrap(); + + assert_reset(&reset); + assert_eq!(device.poll(105).unwrap(), Phase::Held); + + release(&reset); + assert_eq!( + device.poll(200).unwrap(), + Phase::Booting { + released_at_millis: 200 + } + ); + assert!(!ready.is_set_high(), "the old delay carried over"); + assert_eq!(device.poll(210).unwrap(), Phase::Ready); +} + +#[test] +fn a_hung_device_is_reset_like_any_other() { + let (reset, _ready, mut device) = wire(BootBehaviour::Hangs); + + device.poll(0).unwrap(); + release(&reset); + assert_eq!(device.poll(1).unwrap(), Phase::Hung); + + assert_reset(&reset); + assert_eq!(device.poll(2).unwrap(), Phase::Held); +} + +#[test] +fn an_active_high_reset_reads_the_other_way_round() { + let reset = Line::high(); + let ready = Line::low(); + let mut device = MockDownstreamDevice::new( + reset.clone(), + ActivePolarity::ActiveHigh, + ready.clone(), + ActivePolarity::ActiveHigh, + BootBehaviour::Boots { after_millis: 0 }, + ); + + assert_eq!(device.poll(0).unwrap(), Phase::Held); + reset.set(false); + device.poll(1).unwrap(); + assert_eq!(device.poll(1).unwrap(), Phase::Ready); +} + +#[test] +fn an_active_low_ready_line_is_driven_low_when_active() { + let reset = Line::low(); + let ready = Line::high(); + let mut device = MockDownstreamDevice::new( + reset.clone(), + ActivePolarity::ActiveLow, + ready.clone(), + ActivePolarity::ActiveLow, + BootBehaviour::Boots { after_millis: 0 }, + ); + + device.poll(0).unwrap(); + release(&reset); + device.poll(1).unwrap(); + assert_eq!(device.poll(1).unwrap(), Phase::Ready); + assert!(!ready.is_set_high(), "an active-low ready line reads low"); +} diff --git a/target/ast10x0/BUILD.bazel b/target/ast10x0/BUILD.bazel index 8ecaf62fe..b915118bb 100644 --- a/target/ast10x0/BUILD.bazel +++ b/target/ast10x0/BUILD.bazel @@ -55,6 +55,7 @@ constraint_value( ":__subpackages__", "//drivers:__subpackages__", "//services:__subpackages__", + "//util:__subpackages__", ], ) diff --git a/target/ast10x0/backend/flash/BUILD.bazel b/target/ast10x0/backend/flash/BUILD.bazel new file mode 100644 index 000000000..29acd3f53 --- /dev/null +++ b/target/ast10x0/backend/flash/BUILD.bazel @@ -0,0 +1,21 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library") +load("//target/ast10x0:defs.bzl", "TARGET_COMPATIBLE_WITH") + +rust_library( + name = "flash_backend_ast10x0", + srcs = ["src/lib.rs"], + crate_name = "flash_backend", + edition = "2024", + target_compatible_with = TARGET_COMPATIBLE_WITH, + visibility = ["//visibility:public"], + deps = [ + "//hal/blocking/flash:driver", + "//target/ast10x0/peripherals", + "//util/error", + "//util/region", + "//util/types", + ], +) diff --git a/target/ast10x0/backend/flash/src/lib.rs b/target/ast10x0/backend/flash/src/lib.rs new file mode 100644 index 000000000..c64ff9b6f --- /dev/null +++ b/target/ast10x0/backend/flash/src/lib.rs @@ -0,0 +1,195 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! AST10x0 FMC backend for the generic flash service. +//! +//! Adapts the SMC/FMC SPI-NOR peripheral driver to `hal_flash_driver::FlashDriver` +//! so it can be wrapped by `hal_flash::BlockingFlash` and served over IPC by +//! `services_flash_server::FlashIpcServer`. + +#![no_std] + +use core::marker::PhantomData; +use core::num::NonZero; + +use ast10x0_peripherals::smc::{ + FlashConfig, FlashGeometry, FmcReady, FmcUninit, GeometrySource, SmcConfig, SmcController, + SmcError, SmcInstance, SmcTopology, SpiNorFlash, SpiNorFlashDevice, +}; +use hal_flash_driver::{FlashAddress, FlashDriver}; +use util_error::{self as error, ErrorCode}; +use util_region::{Mmap, Region}; +use util_types::{Blocking, PowerOf2Usize}; + +/// Compile-time descriptor for the wired FMC controller this backend drives. +/// +/// `R` names the register region the hosting process was granted, so the +/// controller's base address comes from that image's `system.json5`. +struct FmcInstance(PhantomData); + +impl SmcInstance for FmcInstance { + type Regs = R; + + const CONTROLLER: SmcController = SmcController::Fmc; + const CONFIG: SmcConfig = SmcConfig { + cs0: Some(FlashConfig { spi_clock_mhz: 50 }), + cs1: Some(FlashConfig { spi_clock_mhz: 50 }), + dma_enabled: false, + enable_interrupts: false, + topology: SmcTopology::BootSpi { master_idx: 0 }, + }; +} + +/// Geometry source for the served chip (CS1). `Pinned` here makes the reported +/// geometry a compile-time constant; `Discover` reports the SFDP-read value. +type Cs1Geometry = as SmcInstance>::Cs1Geometry; + +fn map_smc_error(e: SmcError) -> ErrorCode { + match e { + SmcError::HardwareError => error::FLASH_AST10X0_HARDWARE_ERROR, + SmcError::Timeout => error::FLASH_AST10X0_TIMEOUT, + SmcError::DmaAborted => error::FLASH_AST10X0_DMA_ABORTED, + SmcError::DmaLengthMismatch => error::FLASH_AST10X0_DMA_LENGTH_MISMATCH, + SmcError::InvalidChipSelect => error::FLASH_AST10X0_INVALID_CHIP_SELECT, + SmcError::InvalidCapacity => error::FLASH_AST10X0_INVALID_CAPACITY, + SmcError::DeviceNotSupported => error::FLASH_AST10X0_DEVICE_NOT_SUPPORTED, + SmcError::WriteProtected => error::FLASH_AST10X0_WRITE_PROTECTED, + SmcError::WriteInProgress => error::FLASH_AST10X0_WRITE_IN_PROGRESS, + SmcError::ControllerNotReady => error::FLASH_AST10X0_CONTROLLER_NOT_READY, + SmcError::DmaNotEnabled => error::FLASH_AST10X0_DMA_NOT_ENABLED, + } +} + +/// No-op `Blocking` impl paired with this driver. +/// +/// FMC user-mode SPI-NOR commands have no completion interrupt; the peripheral +/// driver polls the device's WIP status bit to completion inside +/// `program_page`/`erase_sector`, so `start_*` below return with the operation +/// already finished and there is nothing to wait for. +pub struct NoWaitBlocking; + +impl Blocking for NoWaitBlocking { + fn wait_for_notification(&self) {} +} + +/// FMC flash driver. +pub struct Ast10x0FmcFlashDriver { + fmc: FmcReady>, + geometry: FlashGeometry, +} + +/// Stable alias used by the server binary for compile-time backend selection. +pub type Backend = Ast10x0FmcFlashDriver; + +impl Ast10x0FmcFlashDriver { + /// Initialize the FMC from the regions mapped to this process. + /// + /// Takes the register block and both CS decode windows, which `init` lights + /// up: with CS0 and CS1 both present the 256 MiB aperture is split in half, + /// so CS0 decodes low and the served CS1 flash decodes at the midpoint. + /// Consuming the tokens is what bounds this to one driver per process. + /// + /// The FMC pinmux (`PINCTRL_FMC_QUAD`) must already have been applied by the + /// kernel target's pre-task init; this driver never touches the shared SCU. + pub fn new( + regs: Region, + cs0_window: Region, + cs1_window: Region, + ) -> Result + where + Cs0: Mmap, + Cs1: Mmap, + { + let uninit = FmcUninit::>::new(regs, cs0_window, cs1_window) + .map_err(map_smc_error)?; + let mut fmc = uninit.init().map_err(map_smc_error)?; + // Geometry was discovered over SFDP during `init()`; read it back off the + // CS1 handle (no rediscovery, no recalibration). + let geometry = { + let cs1 = fmc.cs1().map_err(map_smc_error)?; + cs1.geometry() + }; + NonZero::new(geometry.capacity_bytes as usize) + .ok_or(error::FLASH_AST10X0_INVALID_CAPACITY)?; + Ok(Self { fmc, geometry }) + } + + fn device(&mut self) -> Result, ErrorCode> { + let cs = self.fmc.cs1().map_err(map_smc_error)?; + SpiNorFlash::new(cs).map_err(map_smc_error) + } +} + +impl FlashDriver for Ast10x0FmcFlashDriver { + type Error = ErrorCode; + + // PAGE_SIZE / PROGRAM_WINDOW_SIZE are defaulted to 0, geometry is discovered instead + const MAX_READ_SIZE: usize = 4096; + const READ_ALIGNMENT: usize = 4; + const PROGRAM_ALIGNMENT: usize = 1; + + fn size(&self) -> NonZero { + NonZero::new(Cs1Geometry::::geometry(&self.geometry).capacity_bytes as usize) + .expect("capacity validated in new()") + } + + /// Default erase page: one SFDP-discovered sector. + fn page_size(&self) -> usize { + Cs1Geometry::::geometry(&self.geometry).sector_size as usize + } + + /// SPI NOR program page: writes must not cross this boundary. + fn program_window_size(&self) -> usize { + Cs1Geometry::::geometry(&self.geometry).page_size as usize + } + + fn erasable_sizes_bitmap(&mut self) -> Result { + // Only sector erase is implemented by the peripheral driver. + Ok(1u32 + << Cs1Geometry::::geometry(&self.geometry) + .sector_size + .trailing_zeros()) + } + + fn read(&mut self, start_addr: FlashAddress, buf: &mut [u8]) -> Result<(), Self::Error> { + let len = buf.len(); + let n = self + .device()? + .read(start_addr.offset(), buf) + .map_err(map_smc_error)?; + if n != len { + return Err(error::FLASH_AST10X0_SHORT_READ); + } + Ok(()) + } + + fn start_erase( + &mut self, + start_addr: FlashAddress, + size: PowerOf2Usize, + ) -> Result<(), Self::Error> { + if size.get() != self.geometry.sector_size as usize { + return Err(error::FLASH_GENERIC_ERASE_INVALID_SIZE); + } + // Blocks until the device's WIP bit clears; see `NoWaitBlocking`. + self.device()? + .erase_sector(start_addr.offset()) + .map_err(map_smc_error) + } + + fn start_program(&mut self, start_addr: FlashAddress, data: &[u8]) -> Result<(), Self::Error> { + // Blocks until the device's WIP bit clears; see `NoWaitBlocking`. + self.device()? + .program_page(start_addr.offset(), data) + .map_err(map_smc_error)?; + Ok(()) + } + + fn is_busy(&mut self) -> bool { + false + } + + fn complete_op(&mut self) -> Result<(), Self::Error> { + Ok(()) + } +} diff --git a/target/ast10x0/backend/i2c/BUILD.bazel b/target/ast10x0/backend/i2c/BUILD.bazel index 4ad851043..5d78edb3f 100644 --- a/target/ast10x0/backend/i2c/BUILD.bazel +++ b/target/ast10x0/backend/i2c/BUILD.bazel @@ -12,6 +12,7 @@ rust_library( target_compatible_with = TARGET_COMPATIBLE_WITH, visibility = ["//visibility:public"], deps = [ + "//hal", "//hal/blocking", "//services/i2c/api:i2c_api", "//target/ast10x0/peripherals", diff --git a/target/ast10x0/backend/i2c/src/lib.rs b/target/ast10x0/backend/i2c/src/lib.rs index e546ea321..6a90d917b 100644 --- a/target/ast10x0/backend/i2c/src/lib.rs +++ b/target/ast10x0/backend/i2c/src/lib.rs @@ -10,28 +10,14 @@ //! decoded wire transaction straight through it with **no typestate shim**. //! //! All this crate adds is: -//! 1. the bus-index → `(I2C, I2CBUFF)` register-pointer mapping for the 14 -//! AST1060 controllers, -//! 2. [`init_bus`] — the per-controller hardware bring-up the board calls -//! eagerly for **every** wired bus, and -//! 3. per-bus open constructors ([`open_bus`] / [`open_bus_dma`]) that wrap an -//! already-initialized controller (no re-init). +//! 1. [`i2c_bus`] — const-wire a bus from its two SCL/SDA pin tokens, and +//! 2. [`open_bus_dma`] — bring up a server's DmaMode controller from its two pin tokens (init hardware, +//! then wrap with non-cached DMA buffers) in one step, so a driver can never front an uninit controller. //! -//! ## Initialization split (settled) -//! -//! Per-controller config (`I2CC00` master-enable, `configure_timing`, -//! interrupts) depends on each bus's [`I2cConfig`], which is **board -//! topology**, so it now lives in the board descriptor. `Ast10x0Board::init()` -//! does subsystem bring-up (pin-mux / SCU clock+reset / `init_i2c_global`) -//! **and then eagerly calls [`init_bus`] for every wired bus** (DMA buses -//! included — `init_hardware()` does not touch the DMA buffer). The server -//! therefore opens each bus with the cheap no-init [`Ast1060I2c::from_initialized`] -//! path; `new()` is no longer used. -//! -//! DMA exception: the non-cached SRAM transfer buffer cannot live in a -//! `&'static` descriptor, so DMA buses are opened with [`open_bus_dma`], which -//! takes a server-owned `&'static mut` `.ram_nc` buffer. Register init for DMA -//! buses still happens in [`init_bus`] like any other bus. +//! Per-controller config (`I2CC00` master-enable, `configure_timing`, interrupts) depends on each bus's +//! [`I2cConfig`] (board topology), so each server brings up its own bus — the board does not. The DMA +//! buffers are non-cached SRAM (`&'static mut` `.ram_nc`), which cannot live in a `&'static` descriptor, +//! so the server hands them to [`open_bus_dma`]. //! //! The server holds **one driver instance per bus it owns** (one IPC channel //! per bus — see `i2c_server`). Slave/target mode is intentionally absent: the @@ -39,9 +25,11 @@ #![no_std] -use ast1060_pac::{i2c::RegisterBlock, i2cbuff::RegisterBlock as BuffRegisterBlock}; +use ast10x0_peripherals::scu::{scu414_30, scu414_31, scu418_0, scu418_1}; use embedded_hal::i2c::{ErrorType, I2c, Operation, SevenBitAddress}; use i2c_api::seam::I2cSlaveEvent; +use openprot_hal::i2c::{I2cBus, I2cScl, I2cSda}; +use openprot_hal::resource::{Pin, Routes}; use openprot_hal_blocking::i2c_hardware::slave::{I2cIsrEvent, I2cSlaveBuffer, I2cSlaveCore}; use openprot_hal_blocking::i2c_hardware::I2cBusRecovery; @@ -59,13 +47,69 @@ pub type Yield = fn(u32); /// The concrete driver type the server owns, one per bus. pub type BusDriver = Ast1060I2cBackend; -/// Highest AST1060 I2C controller index (controllers 0..=13). -pub const MAX_BUS: u8 = 13; +/// Controller 1's bus: SCL2/SDA2 on SCU414[30:31], base carried by the pins (silicon-fixed). +pub type I2c1Bus = I2cBus; + +/// Controller 2's bus: SCL3/SDA3 on SCU418[0:1], base carried by the pins (silicon-fixed). +pub type I2c2Bus = I2cBus; + +/// A DMA transfer buffer proven to sit in non-cached SRAM and be uniquely owned — the type-level +/// discharge of [`open_bus_dma`]'s buffer contract. Mint one only via [`non_cached_buf!`]. +pub struct NonCachedBuf(&'static mut [u8]); + +impl NonCachedBuf { + /// Wrap a `.ram_nc` buffer; the macro is the sole caller and upholds placement + take-once. + #[doc(hidden)] + #[must_use] + pub fn __from_ram_nc(buf: &'static mut [u8]) -> Self { + Self(buf) + } +} + +/// Declare a `.ram_nc` DMA buffer of `$len` bytes and mint its [`NonCachedBuf`] once (`None` on any +/// later call). The only `unsafe` for a server's DMA buffers, authored here so the binary has none. +#[macro_export] +macro_rules! non_cached_buf { + ($len:expr) => {{ + #[unsafe(link_section = ".ram_nc")] + static mut BUF: [u8; $len] = [0u8; $len]; + static TAKEN: ::core::sync::atomic::AtomicBool = + ::core::sync::atomic::AtomicBool::new(false); + if TAKEN.swap(true, ::core::sync::atomic::Ordering::AcqRel) { + ::core::option::Option::None + } else { + // SAFETY: the take-once guard yields a single &'static mut, and `.ram_nc` places it in + // non-cached SRAM — exactly the two facts `NonCachedBuf` stands for. + ::core::option::Option::Some($crate::NonCachedBuf::__from_ram_nc(unsafe { + &mut *::core::ptr::addr_of_mut!(BUF) + })) + } + }}; +} fn spin(_ns: u32) { core::hint::spin_loop(); } +/// Per-controller register bring-up over an already-minted handle (safe). +/// +/// Runs `init_hardware()` (`I2CC00` master-enable, `configure_timing`, interrupt enable). The +/// transient driver is dropped; only the hardware registers persist. +fn init_regs(mmio: Ast1060I2cRegisters, config: &I2cConfig) -> Result<(), I2cError> { + let mut i2c = Ast1060I2c::from_initialized(mmio, config, spin as Yield); + i2c.init_hardware(config) +} + +/// Bind an I2C bus from its two SCL/SDA pin tokens; the bus's routes ride in via `MuxRoutes`, applied by `route`. +#[must_use] +pub const fn i2c_bus + Pin, Sda: Routes + Pin>( + scl: Scl, + sda: Sda, +) -> I2cBus { + let regs = Ast1060I2cRegisters::from_pins(&scl, &sda); + I2cBus::new(scl, sda, regs) +} + /// AST10x0 I2C backend — owns MMIO pointers and DMA buffers for one bus, /// constructs a transient [`Ast1060I2c`] driver per HAL operation. /// @@ -74,6 +118,7 @@ fn spin(_ns: u32) { /// method boundaries. DMA buffers are reborrowed for each driver's lifetime /// and released when the transient driver is dropped at end of call. pub struct Ast1060I2cBackend { + /// This bus's controller register façade, bound from the pin tokens the server holds. regs: Ast1060I2cRegisters, config: I2cConfig, /// Master DMA staging buffer; `None` for buffer-mode (non-DMA) buses. @@ -210,91 +255,18 @@ impl I2cSlaveEvent for Ast1060I2cBackend { } } -/// Resolve a bus index to its `(I2C, I2CBUFF)` register-block pointers. -/// -/// AST1060 exposes 14 controllers; instances 1..=13 are `derivedFrom` I2C0 in -/// the PAC, so every `::ptr()` is the same `*const RegisterBlock` type. -fn regs_for(bus: u8) -> Option<(*const RegisterBlock, *const BuffRegisterBlock)> { - use ast1060_pac as p; - Some(match bus { - 0 => (p::I2c::ptr(), p::I2cbuff::ptr()), - 1 => (p::I2c1::ptr(), p::I2cbuff1::ptr()), - 2 => (p::I2c2::ptr(), p::I2cbuff2::ptr()), - 3 => (p::I2c3::ptr(), p::I2cbuff3::ptr()), - 4 => (p::I2c4::ptr(), p::I2cbuff4::ptr()), - 5 => (p::I2c5::ptr(), p::I2cbuff5::ptr()), - 6 => (p::I2c6::ptr(), p::I2cbuff6::ptr()), - 7 => (p::I2c7::ptr(), p::I2cbuff7::ptr()), - 8 => (p::I2c8::ptr(), p::I2cbuff8::ptr()), - 9 => (p::I2c9::ptr(), p::I2cbuff9::ptr()), - 10 => (p::I2c10::ptr(), p::I2cbuff10::ptr()), - 11 => (p::I2c11::ptr(), p::I2cbuff11::ptr()), - 12 => (p::I2c12::ptr(), p::I2cbuff12::ptr()), - 13 => (p::I2c13::ptr(), p::I2cbuff13::ptr()), - _ => return None, - }) -} - -/// Per-controller hardware bring-up for one bus. -/// -/// Runs `init_hardware()` (controller.rs:193-240: `I2CC00` master-enable, -/// `configure_timing`, interrupt enable) against controller `bus`. Called -/// **by the board**, eagerly, for every wired bus — including DMA buses, -/// since register init is independent of the DMA buffer. -/// -/// The transient driver is dropped; only the hardware registers persist. The -/// server later re-wraps the same registers via [`open_bus`] / -/// [`open_bus_dma`] with no re-init. -/// -/// # Precondition -/// -/// Subsystem bring-up (pin-mux / SCU clock+reset / `init_i2c_global`) has -/// already run — i.e. called from `Ast10x0Board::init()` after that sequence. -/// -/// # Safety -/// -/// Exclusive access to controller `bus` for the duration of the call; `bus` -/// must be `<= MAX_BUS`. -pub unsafe fn init_bus(bus: u8, config: &I2cConfig) -> Result<(), I2cError> { - let (regs, buff) = regs_for(bus).ok_or(I2cError::Invalid)?; - // SAFETY: the single MMIO-pointer perimeter — PAC pointers for the same - // controller `bus`, valid for the program; caller upholds exclusive - // access and prior subsystem init. - let mmio = unsafe { Ast1060I2cRegisters::new(regs, buff) }; - let mut i2c = Ast1060I2c::from_initialized(mmio, config, spin as Yield); - i2c.init_hardware(config) -} - -/// Open a BufferMode controller the board has already initialized. -/// -/// Cheap no-init wrap ([`Ast1060I2c::from_initialized`]): [`init_bus`] (called -/// by the board for this bus) already did the per-controller register -/// config. Returns the bare [`Ast1060I2c`], which already satisfies -/// `embedded_hal::i2c::I2c` — the server is generic over that -/// trait and never names this type. -/// -/// `config` must be the **same** entry the board used for this bus (it sets -/// the driver struct's mode fields; mismatch would desync struct vs hardware). -/// -/// For DMA-mode buses use [`open_bus_dma`] instead. -/// -/// # Precondition -/// -/// `Ast10x0Board::init()` (which calls [`init_bus`] for every wired bus) has -/// run exactly once before this call. -/// -/// # Safety -/// -/// The caller must guarantee exclusive ownership of controller `bus` for the -/// returned driver's lifetime (the i2c server thread is the sole owner). `bus` -/// must be `<= MAX_BUS`. -pub unsafe fn open_bus(bus: u8, config: &I2cConfig) -> Result { - let (regs, buff) = regs_for(bus).ok_or(I2cError::Invalid)?; - // SAFETY: single MMIO-pointer perimeter; caller upholds exclusive - // ownership and prior board init (incl. `init_bus`). - let mmio = unsafe { Ast1060I2cRegisters::new(regs, buff) }; +/// Bring up and open a buffer-mode (non-DMA) bus from its two pin tokens — init hardware then wrap +/// with no DMA buffers, so the driver is structurally incapable of a DMA transfer. Use for buses that +/// never master a DMA transaction (e.g. slave-only), which then cost no `.ram_nc`. +pub fn open_bus, Sda: Routes>( + scl: Scl, + sda: Sda, + config: &I2cConfig, +) -> Result { + let regs = Ast1060I2cRegisters::from_pins(&scl, &sda); + init_regs(regs, config)?; Ok(Ast1060I2cBackend { - regs: mmio, + regs, config: *config, master_dma_buf: None, slave_dma_buf: None, @@ -303,34 +275,23 @@ pub unsafe fn open_bus(bus: u8, config: &I2cConfig) -> Result, Sda: Routes>( + scl: Scl, + sda: Sda, config: &I2cConfig, - master_dma_buf: &'static mut [u8], - slave_dma_buf: &'static mut [u8], + master_dma_buf: NonCachedBuf, + slave_dma_buf: NonCachedBuf, ) -> Result { - let (regs, buff) = regs_for(bus).ok_or(I2cError::Invalid)?; - // SAFETY: single MMIO-pointer perimeter; both buffers are non-cached + - // uniquely owned per the contract. - let mmio = unsafe { Ast1060I2cRegisters::new(regs, buff) }; + let regs = Ast1060I2cRegisters::from_pins(&scl, &sda); + init_regs(regs, config)?; Ok(Ast1060I2cBackend { - regs: mmio, + regs, config: *config, - master_dma_buf: Some(master_dma_buf), - slave_dma_buf: Some(slave_dma_buf), + master_dma_buf: Some(master_dma_buf.0), + slave_dma_buf: Some(slave_dma_buf.0), slave_enabled: false, slave_addr: None, }) diff --git a/target/ast10x0/board/BUILD.bazel b/target/ast10x0/board/BUILD.bazel index 29ec348cb..4c2c64523 100644 --- a/target/ast10x0/board/BUILD.bazel +++ b/target/ast10x0/board/BUILD.bazel @@ -1,12 +1,14 @@ # Licensed under the Apache-2.0 license # SPDX-License-Identifier: Apache-2.0 -load("@rules_rust//rust:defs.bzl", "rust_library") +load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") load("//target/ast10x0:defs.bzl", "TARGET_COMPATIBLE_WITH") rust_library( name = "ast10x0_board", srcs = [ + "src/bmc.rs", + "src/board.rs", "src/lib.rs", "src/spi_monitor.rs", "src/spim_wiring.rs", @@ -16,8 +18,36 @@ rust_library( target_compatible_with = TARGET_COMPATIBLE_WITH, visibility = ["//visibility:public"], deps = [ + "//hal", + "//hal/blocking", + "//services/orchestrator/adapters/hal:orchestrator_hal_adapters", + "//services/orchestrator/capabilities:orchestrator_capabilities", + "//services/orchestrator/config:orchestrator_config", + "//services/orchestrator/sm:orchestrator_sm", "//target/ast10x0/backend/i2c:i2c_backend_ast10x0", "//target/ast10x0/peripherals", "@ast1060_pac", ], ) + +# The BMC supervision vocabulary names no hardware, so it compiles as its own +# crate root on the host and its tests run without the kernel. +rust_test( + name = "bmc_host_test", + srcs = ["src/bmc.rs"], + crate_root = "src/bmc.rs", + edition = "2024", + target_compatible_with = [ + "@platforms//cpu:x86_64", + "@platforms//os:linux", + ], + deps = [ + "//hal/blocking", + "//services/orchestrator/adapters/hal:orchestrator_hal_adapters", + "//services/orchestrator/adapters/walk:orchestrator_checkpoint_walk", + "//services/orchestrator/capabilities:orchestrator_capabilities", + "//services/orchestrator/config:orchestrator_config", + "//services/orchestrator/sm:orchestrator_sm", + "@rust_crates//:embedded-hal", + ], +) diff --git a/target/ast10x0/board/src/bmc.rs b/target/ast10x0/board/src/bmc.rs new file mode 100644 index 000000000..351181ce0 --- /dev/null +++ b/target/ast10x0/board/src/bmc.rs @@ -0,0 +1,338 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The mock downstream device: this board's supervision vocabulary. +//! +//! Everything here is the RoT's view. The RoT drives the BMC's reset line and +//! reads its ready line, so the ids naming those two wires, the window the RoT +//! is willing to wait, and the reader that resolves an id to evidence all live +//! on this side. The BMC itself knows none of it — it boots and drives one pin. +//! +//! Both ids are enums rather than pin numbers: the table stays printable and +//! comparable, and a forgotten signal is a non-exhaustive `match`, which is a +//! build error rather than a runtime hole. + +use core::time::Duration; +use openprot_hal_blocking::gpio_port::ActivePolarity; +use openprot_hal_blocking::{DelayNs, InputPin, OutputPin}; +use openprot_orchestrator_sm::ComponentAttrs; +use orchestrator_capabilities::{BootStatus, EvidenceReader}; +use orchestrator_config::{chain_of, BootCheckpoint, ChainEntries, DeviceConfig}; +use orchestrator_hal_adapters::{ + GpioReadyMonitor, GpioResetControl, ReadyLineError, ResetLineError, +}; + +/// Reset lines this board drives. `RoT_BMC_RESET_L` is the only one. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum BmcReset { + /// The mock downstream device's reset input. + Bmc, +} + +/// Boot evidence this board can read from the mock downstream device. +/// +/// One ready line answers only "up yet?", so the vocabulary has one entry; +/// a second checkpoint would need a second wire or a message path. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum BmcProbe { + /// The BMC's boot-complete line, driven high once it has booted. + Ready, +} + +/// How long the RoT waits for the BMC to report ready before calling the +/// attempt failed. Generous: a missed window costs a reset cycle, and nothing +/// downstream is racing it. +const READY_WINDOW: Duration = Duration::from_secs(10); + +const CHECKPOINTS: &[BootCheckpoint] = &[BootCheckpoint::new( + "bmc-ready", + BmcProbe::Ready, + READY_WINDOW, +)]; + +/// The mock downstream device's entry in this board's device table. Passive: it has no +/// iRoT to self-verify, so its ready line is the only post-release signal +/// it produces. Required: the platform has nothing to run without it. +pub const BMC: DeviceConfig = DeviceConfig::new( + "bmc", + BmcReset::Bmc, + CHECKPOINTS, + None, + ComponentAttrs::passive_required(), +); + +/// The eRoT itself, at chain position 0. It is in the table so the +/// orchestrator can address it. This board does not update the eRoT, so the +/// entry carries no layout. +pub const EROT: DeviceConfig = DeviceConfig::erot("erot", None); + +/// Every device this board manages, in the order that assigns their ids. The +/// eRoT comes first, so the BMC is ComponentId(1). +pub const DEVICES: [DeviceConfig; 2] = [EROT, BMC]; + +/// The orchestrator's chain, derived from [`DEVICES`]. +pub const CHAIN: ChainEntries<{ DEVICES.len() }> = chain_of(&DEVICES); + +/// The BMC's ready line is driven high when it has booted. +/// +/// Active high is the fail-safe direction here: held in reset, unpowered, and +/// a disconnected wire all read low, so the RoT waits out its window and +/// reports honestly instead of believing a device that is not there. +const READY_ACTIVE: ActivePolarity = ActivePolarity::ActiveHigh; + +/// `RoT_BMC_RESET_L` holds the BMC in reset when driven low. +const RESET_ACTIVE: ActivePolarity = ActivePolarity::ActiveLow; + +/// This board's reset control, once a pin and a delay are bound to it. +pub type BmcResetControl = GpioResetControl; + +/// Binds `reset_pin` as `RoT_BMC_RESET_L`, driving the BMC into reset. +/// +/// # Errors +/// +/// Returns an error if the line cannot be driven. +pub fn bind_reset( + reset_pin: P, + delay: D, +) -> Result, ResetLineError> { + GpioResetControl::new(reset_pin, delay, BmcReset::Bmc, RESET_ACTIVE) +} + +/// Resolves this board's probe ids to evidence. +/// +/// Generic over the input pin so the vocabulary is independent of how the pin +/// is obtained; bring-up supplies the real GPIO. +pub struct BmcReader

{ + ready: GpioReadyMonitor

, +} + +impl BmcReader

{ + /// Binds `ready_pin` as the BMC's boot-complete line. + pub fn new(ready_pin: P) -> Self { + Self { + ready: GpioReadyMonitor::new(ready_pin, READY_ACTIVE), + } + } +} + +impl EvidenceReader for BmcReader

+where + P::Error: 'static, +{ + type Error = ReadyLineError; + + fn read(&mut self, probe: &BmcProbe) -> Result { + match probe { + BmcProbe::Ready => self.ready.boot_status(), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use embedded_hal::digital; + use openprot_hal_blocking::system_control::ResetControl; + use orchestrator_capabilities::{BootWatch, FailureCause, WalkVerdict}; + use orchestrator_checkpoint_walk::CheckpointWalk; + + #[derive(Debug)] + struct PinFault; + + impl digital::Error for PinFault { + fn kind(&self) -> digital::ErrorKind { + digital::ErrorKind::Other + } + } + + /// The BMC's ready line as the RoT sees it: low until the device has + /// booted, which it does after `boots_after` reads. `None` is a device + /// that never comes up. + struct ReadyLine { + boots_after: Option, + reads: usize, + } + + impl ReadyLine { + fn booted() -> Self { + Self { + boots_after: Some(0), + reads: 0, + } + } + + fn hung() -> Self { + Self { + boots_after: None, + reads: 0, + } + } + + fn late(reads: usize) -> Self { + Self { + boots_after: Some(reads), + reads: 0, + } + } + } + + impl digital::ErrorType for ReadyLine { + type Error = PinFault; + } + + impl digital::InputPin for ReadyLine { + fn is_high(&mut self) -> Result { + self.reads += 1; + Ok(matches!(self.boots_after, Some(n) if self.reads > n)) + } + + fn is_low(&mut self) -> Result { + Ok(!self.is_high()?) + } + } + + /// The BMC's reset line as the RoT drives it, remembering its level. + struct ResetLine { + high: bool, + } + + impl digital::ErrorType for ResetLine { + type Error = PinFault; + } + + impl digital::OutputPin for ResetLine { + fn set_low(&mut self) -> Result<(), PinFault> { + self.high = false; + Ok(()) + } + + fn set_high(&mut self) -> Result<(), PinFault> { + self.high = true; + Ok(()) + } + } + + /// Takes the pulse's wait instantly; the hold time is the HAL's business. + struct NoDelay; + + impl DelayNs for NoDelay { + fn delay_ns(&mut self, _ns: u32) {} + } + + #[test] + fn the_table_declares_one_ready_checkpoint() { + assert_eq!(BMC.name(), "bmc"); + assert_eq!(BMC.reset_signal(), Some(&BmcReset::Bmc)); + + let checkpoints = BMC.checkpoints(); + assert_eq!(checkpoints.len(), 1); + assert_eq!(checkpoints[0].name(), "bmc-ready"); + assert_eq!(*checkpoints[0].probe(), BmcProbe::Ready); + assert_eq!(checkpoints[0].timeout(), READY_WINDOW); + } + + #[test] + fn the_reader_resolves_ready_to_the_line_level() { + let mut booting = BmcReader::new(ReadyLine::hung()); + let mut booted = BmcReader::new(ReadyLine::booted()); + + assert_eq!( + booting.read(&BmcProbe::Ready).expect("read failed"), + BootStatus::Booting + ); + assert_eq!( + booted.read(&BmcProbe::Ready).expect("read failed"), + BootStatus::Booted + ); + } + + /// The table's signals must be exactly what the reader answers — the walk + /// reads whatever the checkpoints name. + #[test] + fn the_reader_answers_every_signal_the_table_names() { + let mut reader = BmcReader::new(ReadyLine::booted()); + + for checkpoint in BMC.checkpoints() { + assert_eq!( + reader.read(checkpoint.probe()).expect("read failed"), + BootStatus::Booted + ); + } + } + + /// Binding drives the line rather than assuming it: the BMC is held from + /// the moment the RoT owns its reset. + #[test] + fn binding_the_reset_line_holds_the_bmc() { + let reset = bind_reset(ResetLine { high: true }, NoDelay).expect("bind failed"); + + assert!(!reset.pin().high); + assert!(reset + .reset_is_asserted(&BmcReset::Bmc) + .expect("read failed")); + } + + #[test] + fn a_pulse_leaves_the_bmc_released_to_boot() { + let mut reset = bind_reset(ResetLine { high: true }, NoDelay).expect("bind failed"); + + reset + .reset_pulse(&BmcReset::Bmc, Duration::from_millis(10)) + .expect("pulse failed"); + + assert!(reset.pin().high); + assert!(!reset + .reset_is_asserted(&BmcReset::Bmc) + .expect("read failed")); + } + + fn walk(ready: P) -> CheckpointWalk, BmcProbe> + where + P::Error: 'static, + { + CheckpointWalk::new(BmcReader::new(ready), &BMC) + } + + #[test] + fn a_booted_bmc_completes_the_walk_on_the_first_poll() { + let mut walk = walk(ReadyLine::booted()); + walk.start(); + + assert_eq!(walk.poll(0), WalkVerdict::Complete); + } + + #[test] + fn a_bmc_still_booting_holds_the_walk_until_its_line_rises() { + let mut walk = walk(ReadyLine::late(2)); + walk.start(); + + let waiting = WalkVerdict::Waiting { + deadline_millis: READY_WINDOW.as_millis() as u64, + }; + assert_eq!(walk.poll(0), waiting); + assert_eq!(walk.poll(1), waiting); + assert_eq!(walk.poll(2), WalkVerdict::Complete); + } + + /// A BMC that never comes up costs the window and is reported by name. + #[test] + fn a_bmc_that_never_reports_ready_times_out() { + let mut walk = walk(ReadyLine::hung()); + walk.start(); + + let deadline = READY_WINDOW.as_millis() as u64; + assert_eq!( + walk.poll(0), + WalkVerdict::Waiting { + deadline_millis: deadline + } + ); + assert_eq!( + walk.poll(deadline), + WalkVerdict::Failed { + checkpoint: "bmc-ready", + cause: FailureCause::TimedOut, + } + ); + } +} diff --git a/target/ast10x0/board/src/board.rs b/target/ast10x0/board/src/board.rs new file mode 100644 index 000000000..893d07492 --- /dev/null +++ b/target/ast10x0/board/src/board.rs @@ -0,0 +1,36 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The board manifest: bring up the SoC once, then wire AST1060 pins to capabilities. +//! [`Pins::take`] is the sole `unsafe` gate; every `open` downstream is safe. + +use ast10x0_peripherals::scu::{create_pins, route, ScuRegisters}; +use i2c_backend::{i2c_bus, I2c1Bus, I2c2Bus}; + +/// The board's claimable hardware: each I2C controller wired to (and its pins muxed for) its bus. +pub struct Pins { + /// I2C controller 1 — SCL2/SDA2 on SCU414[30:31]. + pub i2c1: I2c1Bus, + /// I2C controller 2 — SCL3/SDA3 on SCU418[0:1]. + pub i2c2: I2c2Bus, +} + +impl Pins { + /// Bring up the SoC, bind the board's I2C buses from their pin tokens, and route them in one folded SCU pass; the one runtime `unsafe` gate. + /// + /// # Safety + /// Call once, at boot, with exclusive SoC access. + #[must_use] + pub unsafe fn take() -> Self { + // SAFETY: sole boot gate — single-threaded, exclusive SoC access, so the one SCU unlock and + // the bring-up it feeds happen exactly once. + let scu = unsafe { ScuRegisters::new_global_unlocked() }; + ast10x0_peripherals::i2c::bringup(scu, crate::delay_us); + // SAFETY: sole pin creation site — created once here at boot; the pins! table is this chip's true pin map. + let pins = unsafe { create_pins() }; + let i2c1 = i2c_bus(pins.scu414_30, pins.scu414_31); + let i2c2 = i2c_bus(pins.scu418_0, pins.scu418_1); + route(&(&i2c1, &i2c2)); + Pins { i2c1, i2c2 } + } +} diff --git a/target/ast10x0/board/src/lib.rs b/target/ast10x0/board/src/lib.rs index dd7445df6..9d747f2d8 100644 --- a/target/ast10x0/board/src/lib.rs +++ b/target/ast10x0/board/src/lib.rs @@ -12,12 +12,14 @@ )] use ast10x0_peripherals::hace::HaceDevice; -use ast10x0_peripherals::scu::{ClockRegisterHalf, ScuRegisterHalf}; use ast10x0_peripherals::scu::{PinctrlPin, ScuRegisters}; +pub mod bmc; +pub mod board; pub mod spi_monitor; pub mod spim_wiring; +pub use board::Pins; pub use spi_monitor::Ast1060SpiMonitor; pub use spim_wiring::{ apply_spim_external_mux, apply_spim_pinctrl, apply_spim_wiring, apply_spim_wiring_with_log, @@ -28,26 +30,12 @@ pub use spim_wiring::{ pub use ast10x0_peripherals::i2c::{I2cConfig, I2cError}; -/// Per-bus I2C bring-up entry: which controller, and the config its -/// `init_hardware()` (timing/master/interrupts) is run with. -#[derive(Clone, Debug)] -pub struct I2cBusCfg { - /// Controller index (`0..=i2c_backend::MAX_BUS`). - pub bus: u8, - /// Per-controller configuration applied by `init_bus`. - pub config: I2cConfig, -} - /// Board descriptor metadata for AST10x0 board initialization. #[derive(Clone, Debug)] pub struct Ast10x0BoardDescriptor { /// Pin control groups to apply during board init. /// Applied in order via `ScuRegisters::apply_pinctrl_group()`. pub pinctrl_groups: &'static [&'static [PinctrlPin]], - /// I2C controllers this board wires, with their per-bus config. The board - /// brings every one up eagerly during [`Ast10x0Board::init`]. Empty for - /// boards/tests that manage I2C themselves. - pub i2c_buses: &'static [I2cBusCfg], } /// Runtime board object that executes hardware initialization steps. @@ -77,21 +65,11 @@ impl Ast10x0Board { unsafe { HaceDevice::new_global(yield_fn) } } - /// Initialize board: apply pinctrl groups and initialize I2C subsystem. - /// - /// This performs the complete platform-level initialization: - /// 1. Apply pinctrl groups - /// 2. Enable I2C clock via SCU - /// 3. Assert I2C/SMBus controller reset - /// 4. Delay for reset to settle - /// 5. Deassert reset - /// 6. Delay for recovery - /// 7. Configure I2C global registers (clock dividers, etc.) - /// 8. Per-controller bring-up (`init_bus`) for every wired bus in - /// `descriptor.i2c_buses`. + /// Apply pinctrl groups and bring up the shared I2C subsystem (clock/reset/global); per-controller + /// bring-up is each server's own via `i2c_backend::open_bus_dma`. /// /// # Errors - /// Returns the first per-controller init failure. Steps 1-7 are infallible. + /// Infallible today; keeps a `Result` for forward-compatible platform init. /// /// # Safety /// - Must be called only once during board initialization. @@ -105,27 +83,9 @@ impl Ast10x0Board { scu.apply_pinctrl_group(group); } - // Enable I2C clock (Group 0, bit 2) - scu.ungate_clock_mask(ClockRegisterHalf::Lower, 1 << 2); - - // Assert I2C reset (Upper half, bit 2) - scu.assert_reset_mask(ScuRegisterHalf::Upper, 1 << 2); - delay_us(1000); - - // Deassert I2C reset - scu.deassert_reset_mask(ScuRegisterHalf::Upper, 1 << 2); - delay_us(1000); - - // Configure I2C global registers (clock dividers, etc.) - unsafe { ast10x0_peripherals::i2c::init_i2c_global() }; - - // Eagerly bring up every wired controller. The server later re-wraps - // these with no re-init via `open_bus` / `open_bus_dma`. - for b in self.descriptor.i2c_buses { - // SAFETY: subsystem init (clock/reset/global/pin-mux) is complete; - // board init is single-threaded and owns every controller here. - unsafe { i2c_backend::init_bus(b.bus, &b.config)? }; - } + // Bring up the shared I2C subsystem through its one home, reusing the SCU handle already + // unlocked above — same sequence Pins::take runs, no second unlock. + ast10x0_peripherals::i2c::bringup(scu, delay_us); Ok(()) } @@ -139,7 +99,7 @@ impl Ast10x0Board { pub fn delay_us(micros: u32) { // Very rough approximation: ~16 cycles per microsecond on Cortex-M4 @ ~50MHz // This is calibration-free but inaccurate; improve for production. - for _ in 0..(micros * 16) { + for _ in 0..micros.saturating_mul(16) { core::hint::spin_loop(); } } diff --git a/target/ast10x0/boot_evidence/BUILD.bazel b/target/ast10x0/boot_evidence/BUILD.bazel new file mode 100644 index 000000000..80385d77b --- /dev/null +++ b/target/ast10x0/boot_evidence/BUILD.bazel @@ -0,0 +1,27 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") + +rust_library( + name = "ast10x0_boot_evidence", + srcs = ["src/lib.rs"], + edition = "2024", + visibility = ["//visibility:public"], + deps = [ + "//hal/blocking", + "//services/orchestrator/adapters/hal:orchestrator_hal_adapters", + "//services/orchestrator/capabilities:orchestrator_capabilities", + "//services/orchestrator/config:orchestrator_config", + "//services/orchestrator/sm:orchestrator_sm", + ], +) + +rust_test( + name = "ast10x0_boot_evidence_test", + crate = ":ast10x0_boot_evidence", + target_compatible_with = [ + "@platforms//cpu:x86_64", + "@platforms//os:linux", + ], +) diff --git a/target/ast10x0/boot_evidence/src/lib.rs b/target/ast10x0/boot_evidence/src/lib.rs new file mode 100644 index 000000000..972cc45a8 --- /dev/null +++ b/target/ast10x0/boot_evidence/src/lib.rs @@ -0,0 +1,179 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Boot-evidence wiring for the AST10x0 eRoT board. +//! +//! Binds the board's boot-checkpoint signals to concrete hardware: each +//! signal in the device table maps to one `GpioBootMonitor` on a +//! specific SGPIOM pin. The orchestrator never learns which pin belongs +//! to which device; this crate makes that binding once. + +#![no_std] + +use openprot_hal_blocking::gpio_port::{ActivePolarity, GpioPort}; +use orchestrator_capabilities::{BootStatus, EvidenceReader}; +use orchestrator_hal_adapters::{GpioBootMonitor, MonitorError}; + +/// Bit offset of BL1's ready line in SGPIOM bank EH (pin 42, bank base 32). +/// The typed `SgpiomMask` binding lives in the platform driver; this crate +/// records the offset so the table and the wiring agree on a single source. +pub const BL1_PIN_OFFSET: u32 = 10; + +/// BL1 ready line is active-high: the BMC asserts the pin when bl1 is up. +pub const BL1_POLARITY: ActivePolarity = ActivePolarity::ActiveHigh; + +/// Boot-checkpoint signal vocabulary for the BMC. Each variant names +/// one checkpoint in the device table; the `EvidenceReader` impl +/// dispatches it to the right `GpioBootMonitor`. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum BmcSignal { + /// First-stage bootloader ready (SGPIOM pin 42, bank EH bit 10). + Bl1, +} + +/// Reads the BMC's boot evidence off the SGPIOM. One `GpioBootMonitor` +/// per checkpoint signal, all sharing the same bank port. +pub struct BmcBootReader<'a, P: GpioPort> { + bl1: GpioBootMonitor<'a, P>, +} + +impl<'a, P: GpioPort> BmcBootReader<'a, P> { + /// Binds the reader to its monitors. Each monitor is constructed by + /// the platform driver at bring-up from a `(port, pin, polarity)` + /// triple. + pub fn new(bl1: GpioBootMonitor<'a, P>) -> Self { + Self { bl1 } + } +} + +impl EvidenceReader for BmcBootReader<'_, P> +where + P::Error: 'static, +{ + type Error = MonitorError; + + fn read(&mut self, probe: &BmcSignal) -> Result { + match probe { + BmcSignal::Bl1 => self.bl1.boot_status(), + } + } +} + +/// The BMC's device table entry. One checkpoint: bl1 on SGPIOM pin 42, +/// 500 ms window. +pub const BMC_DEVICE: orchestrator_config::DeviceConfig = + orchestrator_config::DeviceConfig::new( + "bmc", + 0, + &[orchestrator_config::BootCheckpoint::new( + "bl1", + BmcSignal::Bl1, + core::time::Duration::from_millis(500), + )], + None, + openprot_orchestrator_sm::ComponentAttrs::passive_required(), + ); + +#[cfg(test)] +mod tests { + use super::*; + use openprot_hal_blocking::gpio_port::{GpioError, GpioErrorKind, GpioErrorType, PinMask}; + + #[derive(Debug, Clone, Copy, PartialEq, Eq)] + struct Mask(u32); + + impl PinMask for Mask { + fn empty() -> Self { + Self(0) + } + fn all() -> Self { + Self(u32::MAX) + } + fn is_empty(&self) -> bool { + self.0 == 0 + } + fn contains(&self, other: Self) -> bool { + self.0 & other.0 == other.0 + } + fn union(&self, other: Self) -> Self { + Self(self.0 | other.0) + } + fn intersection(&self, other: Self) -> Self { + Self(self.0 & other.0) + } + fn toggle(&self) -> Self { + Self(!self.0) + } + } + + #[derive(Debug, Clone, Copy, PartialEq, Eq)] + struct MockError; + + impl GpioError for MockError { + fn kind(&self) -> GpioErrorKind { + GpioErrorKind::HardwareFailure + } + } + + struct MockPort { + input: Mask, + } + + impl GpioErrorType for MockPort { + type Error = MockError; + } + + impl GpioPort for MockPort { + type Config = (); + type Mask = Mask; + + fn read_input(&self) -> Result { + Ok(self.input) + } + fn configure(&mut self, _: Mask, _: ()) -> Result<(), MockError> { + panic!("reader must not configure pins"); + } + fn set_reset(&mut self, _: Mask, _: Mask) -> Result<(), MockError> { + panic!("reader must not drive outputs"); + } + fn toggle(&mut self, _: Mask) -> Result<(), MockError> { + panic!("reader must not drive outputs"); + } + } + + const BL1_PIN: Mask = Mask(1 << BL1_PIN_OFFSET); + + #[test] + fn bl1_reads_booted_when_pin42_is_high() { + let port = MockPort { + input: Mask(1 << 10), + }; + let mon = GpioBootMonitor::new(&port, BL1_PIN, BL1_POLARITY); + let mut reader = BmcBootReader::new(mon); + + assert_eq!( + reader.read(&BmcSignal::Bl1).expect("read failed"), + BootStatus::Booted, + ); + } + + #[test] + fn bl1_reads_booting_when_pin42_is_low() { + let port = MockPort { input: Mask(0) }; + let mon = GpioBootMonitor::new(&port, BL1_PIN, BL1_POLARITY); + let mut reader = BmcBootReader::new(mon); + + assert_eq!( + reader.read(&BmcSignal::Bl1).expect("read failed"), + BootStatus::Booting, + ); + } + + #[test] + fn bmc_device_table_has_one_bl1_checkpoint() { + assert_eq!(BMC_DEVICE.name(), "bmc"); + assert_eq!(BMC_DEVICE.checkpoints().len(), 1); + assert_eq!(BMC_DEVICE.checkpoints()[0].name(), "bl1"); + assert_eq!(*BMC_DEVICE.checkpoints()[0].probe(), BmcSignal::Bl1); + } +} diff --git a/target/ast10x0/defs.bzl b/target/ast10x0/defs.bzl index 7e2e827bb..b2322e8ca 100644 --- a/target/ast10x0/defs.bzl +++ b/target/ast10x0/defs.bzl @@ -9,7 +9,7 @@ TARGET_COMPATIBLE_WITH = select({ "//conditions:default": ["@platforms//:incompatible"], }) -def _system_image_test_impl(ctx): +def _system_image_test_impl(ctx, extra_runfiles = []): image_info = ctx.attr.image[SystemImageInfo] executable_symlink = ctx.actions.declare_file(ctx.label.name) ctx.actions.symlink(output = executable_symlink, target_file = image_info.elf) @@ -31,11 +31,54 @@ def _system_image_test_impl(ctx): runfiles.merge(ctx.attr.slave_image[DefaultInfo].default_runfiles), ) + if extra_runfiles: + runfiles = runfiles.merge(ctx.runfiles(files = extra_runfiles)) + return [DefaultInfo( executable = executable_symlink, runfiles = runfiles, )] +def _flash_system_image_test_impl(ctx): + # fmc_model describes the QEMU FMC device uniformly (JEDEC ID + SFDP + # geometry), shared by both chip selects. The qemu_runner seeds fresh + # images at $TEST_TMPDIR/ and attaches each present CS image as + # FMC flash (if=mtd): cs0_image at index 0, cs1_image at index 1. + env = { + "AST10X0_FLASH_SIZE": str(ctx.attr.flash_size), + "AST10X0_FMC_MODEL": ctx.attr.fmc_model, + } + if ctx.attr.cs0_image: + env["AST10X0_CS0_IMAGE"] = ctx.attr.cs0_image + env["AST10X0_CS0_FILL"] = str(ctx.attr.cs0_fill) + if ctx.attr.cs1_image: + env["AST10X0_CS1_IMAGE"] = ctx.attr.cs1_image + env["AST10X0_CS1_FILL"] = str(ctx.attr.cs1_fill) + + # A contents file is copied into the image instead of filling it, so the + # device already holds something when the guest boots. The runner opens + # the path relative to the runfiles tree the test runs in. + # Read back after the run: what the guest left in CS1 has to match the + # file, at the offset it was told to write. + if ctx.file.cs1_expect: + env["AST10X0_CS1_EXPECT"] = ctx.file.cs1_expect.short_path + env["AST10X0_CS1_EXPECT_OFFSET"] = str(ctx.attr.cs1_expect_offset) + + contents = [] + if ctx.file.cs0_contents: + contents.append(ctx.file.cs0_contents) + env["AST10X0_CS0_CONTENTS"] = ctx.file.cs0_contents.short_path + if ctx.file.cs1_contents: + contents.append(ctx.file.cs1_contents) + env["AST10X0_CS1_CONTENTS"] = ctx.file.cs1_contents.short_path + if ctx.file.cs1_expect: + contents.append(ctx.file.cs1_expect) + + providers = [_system_image_test_impl(ctx, extra_runfiles = contents)[0]] + if ctx.attr.cs0_image or ctx.attr.cs1_image: + providers.append(RunEnvironmentInfo(environment = env)) + return providers + system_image_test = rule( implementation = _system_image_test_impl, test = True, @@ -56,3 +99,71 @@ system_image_test = rule( ), }, ) + +flash_system_image_test = rule( + implementation = _flash_system_image_test_impl, + test = True, + attrs = { + "cs0_contents": attr.label( + doc = "File copied into cs0_image at offset 0 instead of filling " + + "it. The rest stays erased. Longer than flash_size is an error.", + allow_single_file = True, + ), + "cs0_fill": attr.int( + doc = "Byte value the qemu_runner seeds cs0_image with (default 0xFF, erased).", + default = 0xFF, + ), + "cs0_image": attr.string( + doc = "Basename of the SPI-NOR image seeded in $TEST_TMPDIR and " + + "attached as FMC CS0 flash (if=mtd, index=0).", + default = "", + ), + "cs1_contents": attr.label( + doc = "File copied into cs1_image at offset 0 instead of filling " + + "it. The rest stays erased. Longer than flash_size is an error.", + allow_single_file = True, + ), + "cs1_expect": attr.label( + doc = "File the CS1 image must hold at cs1_expect_offset once " + + "the run is over. The host reads it back, so a guest that " + + "says it wrote an image and did not fails the test.", + allow_single_file = True, + ), + "cs1_expect_offset": attr.int( + doc = "Offset in cs1_image that cs1_expect is compared against.", + default = 0, + ), + "cs1_fill": attr.int( + doc = "Byte value the qemu_runner seeds cs1_image with (default 0xFF, erased).", + default = 0xFF, + ), + "cs1_image": attr.string( + doc = "Basename of the SPI-NOR image seeded in $TEST_TMPDIR and " + + "attached as FMC CS1 flash (if=mtd, index=1).", + default = "", + ), + "flash_size": attr.int( + doc = "Size in bytes of each seeded flash image.", + default = 8 * 1024 * 1024, + ), + "fmc_model": attr.string( + doc = "QEMU fmc-model applied controller-wide (JEDEC ID + SFDP " + + "geometry). Default is the 1 MiB w25q80bl.", + default = "w25q80bl", + ), + "image": attr.label( + doc = "The system_image target to test.", + mandatory = True, + providers = [SystemImageInfo], + executable = True, + cfg = "target", + ), + "slave_image": attr.label( + doc = "Optional slave system_image for paired two-device tests.", + mandatory = False, + default = None, + providers = [SystemImageInfo], + cfg = "target", + ), + }, +) diff --git a/target/ast10x0/harness/BUILD.bazel b/target/ast10x0/harness/BUILD.bazel index 419fab50e..aa53726f4 100644 --- a/target/ast10x0/harness/BUILD.bazel +++ b/target/ast10x0/harness/BUILD.bazel @@ -3,6 +3,7 @@ load("@rules_platform//platform_data:defs.bzl", "platform_data") load("@rules_python//python:py_binary.bzl", "py_binary") +load("@rules_python//python:py_test.bzl", "py_test") py_binary( name = "qemu_runner_bin", @@ -25,6 +26,21 @@ platform_data( visibility = ["//visibility:public"], ) +py_test( + name = "qemu_runner_test", + srcs = [ + "qemu_runner.py", + "qemu_runner_test.py", + ], + imports = ["."], + main = "qemu_runner_test.py", + deps = [ + "@@pigweed++cipd+pigweed.qemu//:qemu-system-arm-runfiles", + "@pigweed//pw_tokenizer/py:detokenize", + "@rules_python//python/runfiles", + ], +) + py_binary( name = "test_runner_bin", srcs = [ diff --git a/target/ast10x0/harness/pi_test_runner.py b/target/ast10x0/harness/pi_test_runner.py index 9f418f9f4..30280f488 100644 --- a/target/ast10x0/harness/pi_test_runner.py +++ b/target/ast10x0/harness/pi_test_runner.py @@ -28,6 +28,10 @@ sys.exit(1) +# All elapsed times reported by this script are relative to process start. +_T0 = time.monotonic() + + def _gpio_set(pin: int, state: str) -> None: subprocess.run(["pinctrl", "set", str(pin), "op"] + state.split(), check=True) @@ -74,7 +78,11 @@ def _upload_firmware(port: serial.Serial, firmware_path: Path) -> None: padding = aligned - size if padding: port.write(bytes(padding)) - print(f"Uploaded {size} bytes ({padding} bytes padding)", file=sys.stderr) + print( + f"[{time.monotonic() - _T0:7.2f}] Uploaded {size} bytes" + f" ({padding} bytes padding); board boots now", + file=sys.stderr, + ) _stdout_lock = threading.Lock() @@ -83,18 +91,29 @@ def _upload_firmware(port: serial.Serial, firmware_path: Path) -> None: _FAILURE_SENTINELS = [b"TEST_RESULT:FAIL", b"panic"] -def _stream_uart(port: serial.Serial, lock=None) -> bool: +def _stream_uart(port: serial.Serial, lock=None, label: str = "") -> bool: port.timeout = 1.0 buf = b"" + # Held back so the prefix only ever lands at a line start: a pw_tokenizer + # $base64 frame is terminated by the newline, never split across one. + partial = b"" while True: data = port.read(1024) if data: - try: - with lock or nullcontext(): - sys.stdout.buffer.write(data) - sys.stdout.buffer.flush() - except (BrokenPipeError, OSError): - return False + partial += data + lines = partial.split(b"\n") + partial = lines.pop() + if lines: + stamped = b"".join( + b"[%7.2f %s] %s\n" % (time.monotonic() - _T0, label.encode(), line) + for line in lines + ) + try: + with lock or nullcontext(): + sys.stdout.buffer.write(stamped) + sys.stdout.buffer.flush() + except (BrokenPipeError, OSError): + return False buf += data if _SUCCESS_SENTINEL in buf: return True @@ -134,22 +153,28 @@ def _run_paired(args, firmware_path: Path, slave_firmware_path: Path) -> bool: return False _upload_firmware(port_b, slave_firmware_path) - _sequence_to_fwspick_mode(args.srst_pin, args.fwspick_pin, port_a) - if not _wait_for_uart_ready(port_a): - return False - _upload_firmware(port_a, firmware_path) - results = [None, None] - def _monitor(idx, port): - results[idx] = _stream_uart(port, _stdout_lock) + def _monitor(idx, port, label): + results[idx] = _stream_uart(port, _stdout_lock, label) + # Started before card A is flashed: the slave boots a full upload + # earlier, and its output would otherwise sit in the tty buffer and + # arrive all at once with the wrong timestamps. threads = [ - threading.Thread(target=_monitor, args=(0, port_a)), - threading.Thread(target=_monitor, args=(1, port_b)), + threading.Thread(target=_monitor, args=(1, port_b, "slave"), daemon=True) ] - for t in threads: - t.start() + threads[0].start() + + _sequence_to_fwspick_mode(args.srst_pin, args.fwspick_pin, port_a) + if not _wait_for_uart_ready(port_a): + return False + _upload_firmware(port_a, firmware_path) + + threads.append( + threading.Thread(target=_monitor, args=(0, port_a, "main"), daemon=True) + ) + threads[1].start() for t in threads: t.join() diff --git a/target/ast10x0/harness/qemu_runner.py b/target/ast10x0/harness/qemu_runner.py index 198698a8e..f41235b46 100644 --- a/target/ast10x0/harness/qemu_runner.py +++ b/target/ast10x0/harness/qemu_runner.py @@ -55,6 +55,19 @@ def _parse_args(): parser.add_argument( "--qemu-args", nargs="*", help="Extra arguments to pass to qemu" ) + parser.add_argument( + "--flash-image", + type=str, + help="Path to a raw SPI-NOR image to attach as the FMC CS0 flash " + "(if=mtd). Re-seeded to an erased (0xFF) state of --flash-size bytes " + "on every run so tests start from a known device state.", + ) + parser.add_argument( + "--flash-size", + type=int, + default=8 * 1024 * 1024, + help="Size in bytes of the --flash-image backing store (default: 8 MiB).", + ) parser.add_argument( "--timeout", type=int, @@ -118,11 +131,128 @@ def _sentinel_watcher( print(f"Exception watching sentinel: {e}", file=sys.stderr) +def _seed_flash_image( + path: str, size: int, fill: int = 0xFF, contents: str = "" +) -> None: + """Create/overwrite `path` with `size` bytes. + + Without `contents` the image is `size` bytes of `fill` (0xFF = erased). + With it, the file is copied in at offset 0 and the remainder is left + erased, so a test can hand the device a real image to read. + + A `contents` file longer than `size` is an error rather than a truncation: + a half-written image still parses far enough to fail verification, which + would make a verify-failure scenario pass for the wrong reason. + """ + if not contents: + with open(path, "wb") as f: + f.write(bytes([fill & 0xFF]) * size) + return + + data = Path(contents).read_bytes() + if len(data) > size: + raise ValueError( + f"{contents} is {len(data)} bytes, larger than the {size}-byte " + f"flash it seeds" + ) + with open(path, "wb") as f: + f.write(data) + f.write(b"\xff" * (size - len(data))) + + +def _check_flash_contents(drives) -> bool: + """Compare a backing image against what the guest said it wrote. + + AST10X0_CS1_EXPECT names a file, AST10X0_CS1_EXPECT_OFFSET where in the + CS1 image it should appear. The guest's own verdict is a log line it + produced about its own memory; this is the host reading the device's + flash afterwards, which is the only check the guest cannot talk its way + past. Returns True when there is nothing to check. + """ + expect = os.environ.get("AST10X0_CS1_EXPECT") + if not expect: + return True + + cs1 = [path for index, path, _, _, _ in drives if index == 1] + if not cs1: + _LOG.error("AST10X0_CS1_EXPECT is set but no CS1 image was attached") + return False + + want = Path(expect).read_bytes() + offset = int(os.environ.get("AST10X0_CS1_EXPECT_OFFSET", "0")) + with open(cs1[0], "rb") as f: + f.seek(offset) + got = f.read(len(want)) + + if got == want: + _LOG.info("CS1 holds the expected %d bytes at %#x", len(want), offset) + return True + + if len(got) != len(want): + _LOG.error( + "CS1 image ends at %#x, short of the expected %d bytes", + offset + len(got), + len(want), + ) + return False + + first = next(i for i, (a, b) in enumerate(zip(got, want)) if a != b) + _LOG.error( + "CS1 differs from the expected image at %#x: got %#04x, want %#04x", + offset + first, + got[first], + want[first], + ) + return False + + +def _resolve_flash_drives(args): + """Return a list of (index, path, size, fill, contents) FMC backing images. + + index 0 -> FMC CS0, index 1 -> FMC CS1. Each image is re-seeded on every + run so tests start from a known device state. An explicit --flash-image + (manual runs) attaches at CS1. A flash_system_image_test sets + AST10X0_CS0_IMAGE / AST10X0_CS1_IMAGE (basenames) plus AST10X0_FLASH_SIZE + and per-CS AST10X0_CS0_FILL / AST10X0_CS1_FILL, resolved against + $TEST_TMPDIR so each run gets private, freshly-seeded images. + + AST10X0_CS0_CONTENTS / AST10X0_CS1_CONTENTS name a file to copy in at + offset 0 instead of filling, for a test that needs the device to already + hold an image. The path is a runfile, resolved by the test rule. + """ + base = os.environ.get("TEST_TMPDIR", tempfile.gettempdir()) + size = int(os.environ.get("AST10X0_FLASH_SIZE", str(args.flash_size))) + drives = [] + if args.flash_image: + drives.append((1, args.flash_image, size, 0xFF, "")) + cs0 = os.environ.get("AST10X0_CS0_IMAGE") + if cs0: + fill = int(os.environ.get("AST10X0_CS0_FILL", "255")) + contents = os.environ.get("AST10X0_CS0_CONTENTS", "") + drives.append((0, os.path.join(base, cs0), size, fill, contents)) + cs1 = os.environ.get("AST10X0_CS1_IMAGE") + if cs1: + fill = int(os.environ.get("AST10X0_CS1_FILL", "255")) + contents = os.environ.get("AST10X0_CS1_CONTENTS", "") + drives.append((1, os.path.join(base, cs1), size, fill, contents)) + return drives + + def _main(args) -> None: + drives = _resolve_flash_drives(args) + + machine = args.machine + if drives: + # ast1030-evb models one flash type for the whole FMC controller. + # w25q80bl matches internal flash on evb CS0, but is smaller than evb CS1. + # Both CS share this model — only the attached backing images differ. + model = os.environ.get("AST10X0_FMC_MODEL", "w25q80bl") + machine = f"{machine},fmc-model={model}" + qemu_args = [ _QEMU_ARM, "-machine", - args.machine, + machine, "-cpu", args.cpu, "-bios", @@ -136,6 +266,13 @@ def _main(args) -> None: args.image, ] + for index, path, size, fill, contents in drives: + _seed_flash_image(path, size, fill, contents) + qemu_args += [ + "-drive", + f"file={path},format=raw,if=mtd,index={index}", + ] + if args.qemu_args: qemu_args.extend(args.qemu_args) @@ -178,15 +315,19 @@ def _main(args) -> None: stdout_thread.join(timeout=5) + # Checked whatever the guest said, so a run that claims to have written + # an image and did not fails here rather than passing. + flash_ok = _check_flash_contents(drives) + if result[0] is None: # No UART sentinel — check if QEMU exited naturally via semihosting. # Processes killed by timeout have a negative returncode (SIGKILL = -9). if proc.returncode >= 0: - sys.exit(0 if proc.returncode == 0 else 1) + sys.exit(0 if proc.returncode == 0 and flash_ok else 1) _LOG.error("No TEST_RESULT sentinel found in UART output") sys.exit(1) - sys.exit(result[0]) + sys.exit(result[0] if flash_ok else 1) if __name__ == "__main__": diff --git a/target/ast10x0/harness/qemu_runner_test.py b/target/ast10x0/harness/qemu_runner_test.py new file mode 100644 index 000000000..d2fe10098 --- /dev/null +++ b/target/ast10x0/harness/qemu_runner_test.py @@ -0,0 +1,55 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 +"""Tests for the flash seeding in qemu_runner.""" + +import tempfile +import unittest + +from pathlib import Path + +from qemu_runner import _seed_flash_image + + +class SeedFlashImageTest(unittest.TestCase): + """A seeded image is always exactly flash_size bytes.""" + + def setUp(self) -> None: + self._dir = tempfile.TemporaryDirectory() + self.addCleanup(self._dir.cleanup) + self.image = str(Path(self._dir.name) / "cs1.img") + + def _contents_file(self, data: bytes) -> str: + path = Path(self._dir.name) / "contents.bin" + path.write_bytes(data) + return str(path) + + def test_without_contents_the_image_is_all_fill(self) -> None: + _seed_flash_image(self.image, 32, fill=0xFF) + self.assertEqual(Path(self.image).read_bytes(), b"\xff" * 32) + + def test_fill_is_honoured(self) -> None: + _seed_flash_image(self.image, 8, fill=0x00) + self.assertEqual(Path(self.image).read_bytes(), b"\x00" * 8) + + def test_contents_land_at_offset_zero_and_the_rest_is_erased(self) -> None: + _seed_flash_image(self.image, 16, contents=self._contents_file(b"openprot")) + self.assertEqual(Path(self.image).read_bytes(), b"openprot" + b"\xff" * 8) + + def test_contents_override_fill(self) -> None: + """Fill describes the erased remainder, not the seeded bytes.""" + _seed_flash_image(self.image, 4, fill=0x00, contents=self._contents_file(b"ab")) + self.assertEqual(Path(self.image).read_bytes(), b"ab\xff\xff") + + def test_contents_may_fill_the_whole_image(self) -> None: + _seed_flash_image(self.image, 4, contents=self._contents_file(b"abcd")) + self.assertEqual(Path(self.image).read_bytes(), b"abcd") + + def test_contents_larger_than_the_flash_is_an_error(self) -> None: + """Truncating would hand the guest an image that fails for the + wrong reason.""" + with self.assertRaises(ValueError): + _seed_flash_image(self.image, 4, contents=self._contents_file(b"abcde")) + + +if __name__ == "__main__": + unittest.main() diff --git a/target/ast10x0/harness/test_runner.py b/target/ast10x0/harness/test_runner.py index cba88d74e..a3966cf2d 100644 --- a/target/ast10x0/harness/test_runner.py +++ b/target/ast10x0/harness/test_runner.py @@ -155,6 +155,21 @@ def _release_lock(host: str) -> None: _ssh(host, f"rm -f {_LOCK_PATH}", capture_output=True) +def _reap_stale_runners(host: str) -> None: + """Kill orphaned runners left behind when an SSH session drops. + + The remote python does not die with its SSH client, and an orphan that still + holds the UARTs silently swallows the bootloader handshake of every later + run. Only called while holding the lock, so any match is an orphan. + """ + # The [p] keeps the pattern from matching the shell that runs pkill. + r = _ssh(host, "pkill -f '[p]i_test_runner.py'", capture_output=True) + if r.returncode == 0: + print("RUNNER: reaped orphaned pi_test_runner.py on the Pi", file=sys.stderr) + # Let the kernel release the serial ports before we reopen them. + time.sleep(1) + + def _touch_lock_forever(host: str, stop: threading.Event) -> None: """Background thread: touch the lock file every _LOCK_TOUCH_INTERVAL seconds.""" while not stop.wait(_LOCK_TOUCH_INTERVAL): @@ -279,6 +294,8 @@ def _run_remote( return False print("RUNNER: lock acquired, starting test", file=sys.stderr) + _reap_stale_runners(host) + stop_touch = threading.Event() touch_thread = threading.Thread( target=_touch_lock_forever, args=(host, stop_touch), daemon=True @@ -342,6 +359,7 @@ def _run_remote( except subprocess.TimeoutExpired: proc.kill() proc.wait() + _reap_stale_runners(host) stop_touch.set() _release_lock(host) diff --git a/target/ast10x0/peripherals/BUILD.bazel b/target/ast10x0/peripherals/BUILD.bazel index 356492c9e..9f1880eac 100644 --- a/target/ast10x0/peripherals/BUILD.bazel +++ b/target/ast10x0/peripherals/BUILD.bazel @@ -9,9 +9,9 @@ package(default_visibility = ["//visibility:public"]) rust_library( name = "peripherals", srcs = [ + "aperture.rs", + "gpio/map.rs", "gpio/mod.rs", - "gpio/registers.rs", - "gpio/types.rs", "hace/aes.rs", "hace/constants.rs", "hace/context.rs", @@ -34,6 +34,7 @@ rust_library( "i2c/recovery.rs", "i2c/registers.rs", "i2c/slave.rs", + "i2c/subsystem.rs", "i2c/target_adapter.rs", "i2c/timing.rs", "i2c/transfer.rs", @@ -55,6 +56,8 @@ rust_library( "scu/clock.rs", "scu/mod.rs", "scu/pinctrl.rs", + "scu/pinmux.rs", + "scu/pins.rs", "scu/registers.rs", "scu/reset.rs", "scu/routing.rs", @@ -96,7 +99,10 @@ rust_library( ], target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ + "//hal", "//hal/blocking", + "//util/region", + "//util/sfdp", "@ast1060_pac", "@pigweed//pw_log/rust:pw_log", "@rust_crates//:bitflags", diff --git a/target/ast10x0/peripherals/aperture.rs b/target/ast10x0/peripherals/aperture.rs new file mode 100644 index 000000000..f52b7a5a8 --- /dev/null +++ b/target/ast10x0/peripherals/aperture.rs @@ -0,0 +1,26 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The whole address space, as a region token. + +use util_region::{Mmap, Region}; + +/// Every address on the chip. +/// +/// Kernel mode runs with no MPU applied, so a kernel-only binary's grant is the +/// whole space rather than a range carved out of `system.json5`. Drivers still +/// take a region by value, so ownership is tracked the same way either side of +/// the kernel boundary. +pub struct Aperture; + +impl Mmap for Aperture { + const START: usize = 0; + const LEN: usize = usize::MAX; +} + +/// # Safety +/// Mints ownership of the entire address space from nothing. Call once, and +/// only from a kernel-only binary, where no process holds a conflicting grant. +pub const unsafe fn take_aperture() -> Region { + unsafe { Region::new() } +} diff --git a/target/ast10x0/peripherals/gpio/map.rs b/target/ast10x0/peripherals/gpio/map.rs new file mode 100644 index 000000000..0d41707b4 --- /dev/null +++ b/target/ast10x0/peripherals/gpio/map.rs @@ -0,0 +1,81 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! This SoC's GPIO register groups as data: one `GpioMap` per pin-group (ABCD/EFGH/IJKL), each a +//! datasheet offset table. Role composition is shared; only the per-group offsets differ. + +use crate::scu::pins::GPIO_BASE; +use openprot_hal::gpio::{role_cfgs_ok, GpioMap, Reg, RegOp}; + +// Stamp one pin-group's `GpioMap` from its datasheet offsets; role composition is fixed. +macro_rules! gpio_group { + ( + dataval: $dataval:expr, dir: $dir:expr, int_en: $int_en:expr, + sen0: $sen0:expr, sen1: $sen1:expr, senboth: $senboth:expr, + int_sts: $int_sts:expr, in_level: $in_level:expr, out_read: $out_read:expr $(,)? + ) => { + GpioMap { + base: GPIO_BASE, + output: &[RegOp::set($dir)], + input: &[RegOp::clear($dir)], + set_high: &[RegOp::set($dataval)], + set_low: &[RegOp::clear($dataval)], + enable_rising: &[ + RegOp::set($sen0), + RegOp::clear($sen1), + RegOp::clear($senboth), + RegOp::set($int_en), + ], + enable_falling: &[ + RegOp::clear($sen0), + RegOp::clear($sen1), + RegOp::clear($senboth), + RegOp::set($int_en), + ], + enable_level_high: &[ + RegOp::set($sen0), + RegOp::set($sen1), + RegOp::clear($senboth), + RegOp::set($int_en), + ], + enable_level_low: &[ + RegOp::clear($sen0), + RegOp::set($sen1), + RegOp::clear($senboth), + RegOp::set($int_en), + ], + // Both-edge sets only the override register, then arms — enable last, never armed mid-select. + enable_both: &[RegOp::set($senboth), RegOp::set($int_en)], + disable_int: &[RegOp::clear($int_en)], + in_level: Reg::new($in_level), + out_level: Reg::new($out_read), + int_enable: Reg::new($int_en), + int_status: Reg::new($int_sts), + sense_both: Reg::new($senboth), + } + }; +} + +/// GPIO group ABCD (GPIOA–GPIOD): write latch at 0x000, input sampled at 0x000, latch read at 0x0c0. +pub const ABCD: GpioMap = gpio_group!( + dataval: 0x000, dir: 0x004, int_en: 0x008, + sen0: 0x00c, sen1: 0x010, senboth: 0x014, int_sts: 0x018, in_level: 0x000, out_read: 0x0c0, +); + +/// GPIO group EFGH (GPIOE–GPIOH): input-read offset unverified; reads the data reg (no test reads it). +pub const EFGH: GpioMap = gpio_group!( + dataval: 0x020, dir: 0x024, int_en: 0x028, + sen0: 0x02c, sen1: 0x030, senboth: 0x034, int_sts: 0x038, in_level: 0x020, out_read: 0x0c4, +); + +/// GPIO group IJKL (GPIOI–GPIOL): int_en breaks stride (0x098); input-read reads the data reg. +pub const IJKL: GpioMap = gpio_group!( + dataval: 0x070, dir: 0x074, int_en: 0x098, + sen0: 0x09c, sen1: 0x0a0, senboth: 0x0a4, int_sts: 0x0a8, in_level: 0x070, out_read: 0x0c8, +); + +/// Reject a contradictory or unevenly-slotted role in any group at compile time — zero runtime cost. +const _: () = assert!( + role_cfgs_ok(&ABCD) && role_cfgs_ok(&EFGH) && role_cfgs_ok(&IJKL), + "an AST GPIO group has a self-conflicting or unevenly-slotted role" +); diff --git a/target/ast10x0/peripherals/gpio/mod.rs b/target/ast10x0/peripherals/gpio/mod.rs index f569880cc..537eaa842 100644 --- a/target/ast10x0/peripherals/gpio/mod.rs +++ b/target/ast10x0/peripherals/gpio/mod.rs @@ -1,720 +1,12 @@ // Licensed under the Apache-2.0 license // SPDX-License-Identifier: Apache-2.0 -//! AST10x0 GPIO peripheral driver. -//! -//! Each GPIO bank (A–U) is exposed as a sub-module (`gpioa`, `gpiob`, …). -//! Obtain a bank via `GPIOX::new_global()` (unsafe), then call `split()` to -//! get the individual typed pins. +//! AST10x0 GPIO peripheral: pin-token-driven, `unsafe`-free access; `.into_gpio(&block)` binds a pin token +//! to a handle whose route `scu::route` applies, `bind_gpio` binds a pin privileged init already muxed. -mod registers; -mod types; +mod map; -pub use registers::GpioRegisters; -pub use types::{ - ActiveHigh, ActiveLow, Floating, GpioError, GpioExt, Input, InputMode, InterruptMode, - OpenDrain, OpenDrainMode, Output, OutputMode, PullDown, PullUp, PushPull, Tristate, +pub(crate) use map::{ABCD, EFGH, IJKL}; +pub use openprot_hal::gpio::{ + bind_gpio, GpioBlock, GpioPin, Input, InputPin, IntTrigger, IntoGpio, Output, OutputPin, }; - -macro_rules! gpio_macro { - ($GPIOX:ident, $gpiox:ident, $x:literal, $pos:literal, $data_val_reg:ident, - $dir_reg:ident, $int_en_reg:ident, $int_sen_t0:ident, - $int_sen_t1:ident, $int_sen_t2:ident, $int_sts_reg:ident, - $rst_tolerant_reg:ident, $deb1_reg:ident, $deb2_reg:ident, - $cmd_src0_reg:ident, $cmd_src1_reg:ident, $data_read_reg:ident, - $intput_mask_reg:ident, [ - $($PXi:ident: ($pxi:ident, $i:literal, $MODE:ty),)+ - ]) => { - - pub mod $gpiox { - use super::*; - use ast1060_pac as device; - use core::marker::PhantomData; - use embedded_hal::digital::{InputPin, OutputPin, StatefulOutputPin}; - - pub struct $GPIOX { - _regs: GpioRegisters, - } - - impl $GPIOX { - /// Create a GPIO bank instance from a [`GpioRegisters`] handle. - /// - /// # Safety - /// - /// Caller must ensure exclusive access to the GPIO register block is - /// coordinated for the lifetime of this value. - pub const unsafe fn new(regs: GpioRegisters) -> Self { - Self { _regs: regs } - } - - /// Create a GPIO bank instance using the global GPIO register block. - /// - /// # Safety - /// - /// Caller must ensure exclusive access to the singleton GPIO peripheral - /// is coordinated for the lifetime of this value. - pub unsafe fn new_global() -> Self { - Self { - _regs: unsafe { GpioRegisters::new_global() }, - } - } - - /// Initialize command-source and debounce registers for this bank. - pub fn init(&self) { - let p = self._regs.regs(); - p.$cmd_src0_reg().modify(|r, w| unsafe { - w.bits(r.bits() & !(0xff << $pos)) - }); - p.$cmd_src1_reg().modify(|r, w| unsafe { - w.bits(r.bits() & !(0xff << $pos)) - }); - p.$deb1_reg().modify(|r, w| unsafe { - w.bits(r.bits() & !(0xff << $pos)) - }); - p.$deb2_reg().modify(|r, w| unsafe { - w.bits(r.bits() & !(0xff << $pos)) - }); - } - } - - pub struct Parts { - $( - pub $pxi: $PXi<$MODE>, - )+ - } - - impl GpioExt for $GPIOX { - type Parts = Parts; - - fn split(self) -> Self::Parts { - Parts { - $( - $pxi: $PXi { - _mode: PhantomData, - }, - )+ - } - } - } - - $( - pub struct $PXi { - _mode: PhantomData, - } - - impl $PXi { - /// Configures the pin as a pulled-down input. - #[must_use] - pub fn into_pull_down_input(self) -> $PXi> { - let p = unsafe { &*device::Gpio::ptr() }; - p.$dir_reg().modify(|r, w| unsafe { - w.bits(r.bits() & !(1u32 << ($pos + $i))) - }); - p.$data_val_reg().modify(|r, w| unsafe { - w.bits(r.bits() & !(1u32 << ($pos + $i))) - }); - $PXi { _mode: PhantomData } - } - - /// Configures the pin as a pulled-up input. - #[must_use] - pub fn into_pull_up_input(self) -> $PXi> { - let p = unsafe { &*device::Gpio::ptr() }; - p.$dir_reg().modify(|r, w| unsafe { - w.bits(r.bits() & !(1u32 << ($pos + $i))) - }); - p.$data_val_reg().modify(|r, w| unsafe { - w.bits(r.bits() | (1u32 << ($pos + $i))) - }); - $PXi { _mode: PhantomData } - } - - /// Configures the pin as an open-drain output. - #[must_use] - pub fn into_open_drain_output(self) -> $PXi>> - where - ODM: OpenDrainMode, - { - let p = unsafe { &*device::Gpio::ptr() }; - p.$data_val_reg().modify(|r, w| unsafe { - let mask = 1u32 << ($pos + $i); - w.bits(if ODM::ACTIVE_HIGH { - r.bits() | mask - } else { - r.bits() & !mask - }) - }); - // Start released in the inactive state. - p.$dir_reg().modify(|r, w| unsafe { - w.bits(r.bits() & !(1u32 << ($pos + $i))) - }); - $PXi { _mode: PhantomData } - } - - /// Configures the pin as a push-pull output. - #[must_use] - pub fn into_push_pull_output(self) -> $PXi> { - let p = unsafe { &*device::Gpio::ptr() }; - p.$dir_reg().modify(|r, w| unsafe { - w.bits(r.bits() | (1u32 << ($pos + $i))) - }); - p.$data_val_reg().modify(|r, w| unsafe { - w.bits(r.bits() | (1u32 << ($pos + $i))) - }); - $PXi { _mode: PhantomData } - } - } - - impl StatefulOutputPin for $PXi> { - fn is_set_high(&mut self) -> Result { - let p = unsafe { &*device::Gpio::ptr() }; - Ok( - (p.$data_read_reg().read().bits() & (1u32 << ($pos + $i))) - == (1u32 << ($pos + $i)), - ) - } - - fn is_set_low(&mut self) -> Result { - self.is_set_high().map(|v| !v) - } - } - - impl OutputPin for $PXi> { - fn set_high(&mut self) -> Result<(), Self::Error> { - let p = unsafe { &*device::Gpio::ptr() }; - p.$data_val_reg().modify(|r, w| unsafe { - w.bits(r.bits() | (1u32 << ($pos + $i))) - }); - Ok(()) - } - - fn set_low(&mut self) -> Result<(), Self::Error> { - let p = unsafe { &*device::Gpio::ptr() }; - p.$data_val_reg().modify(|r, w| unsafe { - w.bits(r.bits() & !(1u32 << ($pos + $i))) - }); - Ok(()) - } - } - - impl StatefulOutputPin for $PXi>> - where - ODM: OpenDrainMode, - { - fn is_set_high(&mut self) -> Result { - let p = unsafe { &*device::Gpio::ptr() }; - let is_output = - (p.$dir_reg().read().bits() & (1u32 << ($pos + $i))) != 0; - Ok(is_output == ODM::ACTIVE_HIGH) - } - - fn is_set_low(&mut self) -> Result { - self.is_set_high().map(|v| !v) - } - } - - impl OutputPin for $PXi>> - where - ODM: OpenDrainMode, - { - fn set_high(&mut self) -> Result<(), Self::Error> { - let p = unsafe { &*device::Gpio::ptr() }; - p.$dir_reg().modify(|r, w| unsafe { - let mask = 1u32 << ($pos + $i); - w.bits(if ODM::ACTIVE_HIGH { - r.bits() | mask - } else { - r.bits() & !mask - }) - }); - Ok(()) - } - - fn set_low(&mut self) -> Result<(), Self::Error> { - let p = unsafe { &*device::Gpio::ptr() }; - p.$dir_reg().modify(|r, w| unsafe { - let mask = 1u32 << ($pos + $i); - w.bits(if ODM::ACTIVE_HIGH { - r.bits() & !mask - } else { - r.bits() | mask - }) - }); - Ok(()) - } - } - - impl InputPin for $PXi> - where - MODE: InputMode, - { - fn is_high(&mut self) -> Result { - let p = unsafe { &*device::Gpio::ptr() }; - Ok( - (p.$data_val_reg().read().bits() & (1u32 << ($pos + $i))) - == (1u32 << ($pos + $i)), - ) - } - - fn is_low(&mut self) -> Result { - self.is_high().map(|v| !v) - } - } - - impl $PXi> - where - MODE: InputMode, - { - /// Enable or disable interrupts on this pin. - pub fn set_interrupt_mode(&mut self, mode: InterruptMode) { - let p = unsafe { &*device::Gpio::ptr() }; - match mode { - InterruptMode::LevelHigh => { - p.$int_sen_t0().modify(|r, w| unsafe { - w.bits(r.bits() | (1u32 << ($pos + $i))) - }); - p.$int_sen_t1().modify(|r, w| unsafe { - w.bits(r.bits() | (1u32 << ($pos + $i))) - }); - p.$int_sen_t2().modify(|r, w| unsafe { - w.bits(r.bits() & !(1u32 << ($pos + $i))) - }); - p.$int_en_reg().modify(|r, w| unsafe { - w.bits(r.bits() | (1u32 << ($pos + $i))) - }); - } - InterruptMode::LevelLow => { - p.$int_sen_t0().modify(|r, w| unsafe { - w.bits(r.bits() & !(1u32 << ($pos + $i))) - }); - p.$int_sen_t1().modify(|r, w| unsafe { - w.bits(r.bits() | (1u32 << ($pos + $i))) - }); - p.$int_sen_t2().modify(|r, w| unsafe { - w.bits(r.bits() & !(1u32 << ($pos + $i))) - }); - p.$int_en_reg().modify(|r, w| unsafe { - w.bits(r.bits() | (1u32 << ($pos + $i))) - }); - } - InterruptMode::EdgeRising => { - p.$int_sen_t0().modify(|r, w| unsafe { - w.bits(r.bits() | (1u32 << ($pos + $i))) - }); - p.$int_sen_t1().modify(|r, w| unsafe { - w.bits(r.bits() & !(1u32 << ($pos + $i))) - }); - p.$int_sen_t2().modify(|r, w| unsafe { - w.bits(r.bits() & !(1u32 << ($pos + $i))) - }); - p.$int_en_reg().modify(|r, w| unsafe { - w.bits(r.bits() | (1u32 << ($pos + $i))) - }); - } - InterruptMode::EdgeFalling => { - p.$int_sen_t0().modify(|r, w| unsafe { - w.bits(r.bits() & !(1u32 << ($pos + $i))) - }); - p.$int_sen_t1().modify(|r, w| unsafe { - w.bits(r.bits() & !(1u32 << ($pos + $i))) - }); - p.$int_sen_t2().modify(|r, w| unsafe { - w.bits(r.bits() & !(1u32 << ($pos + $i))) - }); - p.$int_en_reg().modify(|r, w| unsafe { - w.bits(r.bits() | (1u32 << ($pos + $i))) - }); - } - InterruptMode::EdgeBoth => { - p.$int_sen_t2().modify(|r, w| unsafe { - w.bits(r.bits() | (1u32 << ($pos + $i))) - }); - p.$int_en_reg().modify(|r, w| unsafe { - w.bits(r.bits() | (1u32 << ($pos + $i))) - }); - } - InterruptMode::Disabled => { - p.$int_en_reg().modify(|r, w| unsafe { - w.bits(r.bits() & !(1u32 << ($pos + $i))) - }); - } - } - } - - /// Returns the current interrupt-pending status for this pin. - #[must_use] - pub fn get_interrupt_status(&self) -> bool { - let p = unsafe { &*device::Gpio::ptr() }; - (p.$int_sts_reg().read().bits() & (1u32 << ($pos + $i))) - == (1u32 << ($pos + $i)) - } - - /// Clear the pending interrupt for this pin. - pub fn clear_interrupt(&self) { - let p = unsafe { &*device::Gpio::ptr() }; - p.$int_sts_reg().write(|w| unsafe { w.bits(1u32 << ($pos + $i)) }); - } - - /// Set the command-source bits for this pin. - pub fn set_cmd_src(&self, cmd_src0: u32, cmd_src1: u32) { - let p = unsafe { &*device::Gpio::ptr() }; - p.$cmd_src0_reg().modify(|r, w| unsafe { - w.bits( - (r.bits() & !(1u32 << ($pos + $i))) - | (cmd_src0 << ($pos + $i)), - ) - }); - p.$cmd_src1_reg().modify(|r, w| unsafe { - w.bits( - (r.bits() & !(1u32 << ($pos + $i))) - | (cmd_src1 << ($pos + $i)), - ) - }); - } - - /// Select the debounce timer for this pin. - pub fn select_debounce_timer(&self, deb_setting1: u32, deb_setting2: u32) { - let p = unsafe { &*device::Gpio::ptr() }; - p.$deb1_reg().modify(|r, w| unsafe { - w.bits( - (r.bits() & !(1u32 << ($pos + $i))) - | (deb_setting1 << ($pos + $i)), - ) - }); - p.$deb2_reg().modify(|r, w| unsafe { - w.bits( - (r.bits() & !(1u32 << ($pos + $i))) - | (deb_setting2 << ($pos + $i)), - ) - }); - } - } - - impl embedded_hal::digital::ErrorType for $PXi { - type Error = GpioError; - } - )+ - } - }; -} - -// GPIO ABCD — register group 0x000–0x01c -gpio_macro!( - GPIOA, gpioa, 'a', 0, gpio000, gpio004, gpio008, gpio00c, gpio010, gpio014, gpio018, - gpio01c, gpio040, gpio044, gpio060, gpio064, gpio0c0, gpio1d0, - [ - PA0: (pa0, 0, Tristate), - PA1: (pa1, 1, Tristate), - PA2: (pa2, 2, Tristate), - PA3: (pa3, 3, Tristate), - PA4: (pa4, 4, Tristate), - PA5: (pa5, 5, Tristate), - PA6: (pa6, 6, Tristate), - PA7: (pa7, 7, Tristate), - ] -); - -gpio_macro!( - GPIOB, gpiob, 'b', 8, gpio000, gpio004, gpio008, gpio00c, gpio010, gpio014, gpio018, - gpio01c, gpio040, gpio044, gpio060, gpio064, gpio0c0, gpio1d0, - [ - PB0: (pb0, 0, Tristate), - PB1: (pb1, 1, Tristate), - PB2: (pb2, 2, Tristate), - PB3: (pb3, 3, Tristate), - PB4: (pb4, 4, Tristate), - PB5: (pb5, 5, Tristate), - PB6: (pb6, 6, Tristate), - PB7: (pb7, 7, Tristate), - ] -); - -gpio_macro!( - GPIOC, gpioc, 'c', 16, gpio000, gpio004, gpio008, gpio00c, gpio010, gpio014, gpio018, - gpio01c, gpio040, gpio044, gpio060, gpio064, gpio0c0, gpio1d0, - [ - PC0: (pc0, 0, Tristate), - PC1: (pc1, 1, Tristate), - PC2: (pc2, 2, Tristate), - PC3: (pc3, 3, Tristate), - PC4: (pc4, 4, Tristate), - PC5: (pc5, 5, Tristate), - PC6: (pc6, 6, Tristate), - PC7: (pc7, 7, Tristate), - ] -); - -gpio_macro!( - GPIOD, gpiod, 'd', 24, gpio000, gpio004, gpio008, gpio00c, gpio010, gpio014, gpio018, - gpio01c, gpio040, gpio044, gpio060, gpio064, gpio0c0, gpio1d0, - [ - PD0: (pd0, 0, Tristate), - PD1: (pd1, 1, Tristate), - PD2: (pd2, 2, Tristate), - PD3: (pd3, 3, Tristate), - PD4: (pd4, 4, Tristate), - PD5: (pd5, 5, Tristate), - PD6: (pd6, 6, Tristate), - PD7: (pd7, 7, Tristate), - ] -); - -// GPIO EFGH — register group 0x020–0x03c -gpio_macro!( - GPIOE, gpioe, 'e', 0, gpio020, gpio024, gpio028, gpio02c, gpio030, gpio034, gpio038, - gpio03c, gpio048, gpio04c, gpio068, gpio06c, gpio0c4, gpio1d4, - [ - PE0: (pe0, 0, Tristate), - PE1: (pe1, 1, Tristate), - PE2: (pe2, 2, Tristate), - PE3: (pe3, 3, Tristate), - PE4: (pe4, 4, Tristate), - PE5: (pe5, 5, Tristate), - PE6: (pe6, 6, Tristate), - PE7: (pe7, 7, Tristate), - ] -); - -gpio_macro!( - GPIOF, gpiof, 'f', 8, gpio020, gpio024, gpio028, gpio02c, gpio030, gpio034, gpio038, - gpio03c, gpio048, gpio04c, gpio068, gpio06c, gpio0c4, gpio1d4, - [ - PF0: (pf0, 0, Tristate), - PF1: (pf1, 1, Tristate), - PF2: (pf2, 2, Tristate), - PF3: (pf3, 3, Tristate), - PF4: (pf4, 4, Tristate), - PF5: (pf5, 5, Tristate), - PF6: (pf6, 6, Tristate), - PF7: (pf7, 7, Tristate), - ] -); - -gpio_macro!( - GPIOG, gpiog, 'g', 16, gpio020, gpio024, gpio028, gpio02c, gpio030, gpio034, gpio038, - gpio03c, gpio048, gpio04c, gpio068, gpio06c, gpio0c4, gpio1d4, - [ - PG0: (pg0, 0, Tristate), - PG1: (pg1, 1, Tristate), - PG2: (pg2, 2, Tristate), - PG3: (pg3, 3, Tristate), - PG4: (pg4, 4, Tristate), - PG5: (pg5, 5, Tristate), - PG6: (pg6, 6, Tristate), - PG7: (pg7, 7, Tristate), - ] -); - -gpio_macro!( - GPIOH, gpioh, 'h', 24, gpio020, gpio024, gpio028, gpio02c, gpio030, gpio034, gpio038, - gpio03c, gpio048, gpio04c, gpio068, gpio06c, gpio0c4, gpio1d4, - [ - PH0: (ph0, 0, Tristate), - PH1: (ph1, 1, Tristate), - PH2: (ph2, 2, Tristate), - PH3: (ph3, 3, Tristate), - PH4: (ph4, 4, Tristate), - PH5: (ph5, 5, Tristate), - PH6: (ph6, 6, Tristate), - PH7: (ph7, 7, Tristate), - ] -); - -// GPIO IJKL — register group 0x070–0x0b8 -gpio_macro!( - GPIOI, gpioi, 'i', 0, gpio070, gpio074, gpio098, gpio09c, gpio0a0, gpio0a4, gpio0a8, - gpio0ac, gpio0b0, gpio0b4, gpio090, gpio094, gpio0b8, gpio0c8, - [ - PI0: (pi0, 0, Tristate), - PI1: (pi1, 1, Tristate), - PI2: (pi2, 2, Tristate), - PI3: (pi3, 3, Tristate), - PI4: (pi4, 4, Tristate), - PI5: (pi5, 5, Tristate), - PI6: (pi6, 6, Tristate), - PI7: (pi7, 7, Tristate), - ] -); - -gpio_macro!( - GPIOJ, gpioj, 'j', 8, gpio070, gpio074, gpio098, gpio09c, gpio0a0, gpio0a4, gpio0a8, - gpio0ac, gpio0b0, gpio0b4, gpio090, gpio094, gpio0b8, gpio0c8, - [ - PJ0: (pj0, 0, Tristate), - PJ1: (pj1, 1, Tristate), - PJ2: (pj2, 2, Tristate), - PJ3: (pj3, 3, Tristate), - PJ4: (pj4, 4, Tristate), - PJ5: (pj5, 5, Tristate), - PJ6: (pj6, 6, Tristate), - PJ7: (pj7, 7, Tristate), - ] -); - -gpio_macro!( - GPIOK, gpiok, 'k', 16, gpio070, gpio074, gpio098, gpio09c, gpio0a0, gpio0a4, gpio0a8, - gpio0ac, gpio0b0, gpio0b4, gpio090, gpio094, gpio0b8, gpio0c8, - [ - PK0: (pk0, 0, Tristate), - PK1: (pk1, 1, Tristate), - PK2: (pk2, 2, Tristate), - PK3: (pk3, 3, Tristate), - PK4: (pk4, 4, Tristate), - PK5: (pk5, 5, Tristate), - PK6: (pk6, 6, Tristate), - PK7: (pk7, 7, Tristate), - ] -); - -gpio_macro!( - GPIOL, gpiol, 'l', 24, gpio070, gpio074, gpio098, gpio09c, gpio0a0, gpio0a4, gpio0a8, - gpio0ac, gpio0b0, gpio0b4, gpio090, gpio094, gpio0b8, gpio0c8, - [ - PL0: (pl0, 0, Tristate), - PL1: (pl1, 1, Tristate), - PL2: (pl2, 2, Tristate), - PL3: (pl3, 3, Tristate), - PL4: (pl4, 4, Tristate), - PL5: (pl5, 5, Tristate), - PL6: (pl6, 6, Tristate), - PL7: (pl7, 7, Tristate), - ] -); - -// GPIO MNOP — register group 0x078–0x108 -gpio_macro!( - GPIOM, gpiom, 'm', 0, gpio078, gpio07c, gpio0e8, gpio0ec, gpio0f0, gpio0f4, gpio0f8, - gpio0fc, gpio100, gpio104, gpio0e0, gpio0e4, gpio0cc, gpio108, - [ - PM0: (pm0, 0, Tristate), - PM1: (pm1, 1, Tristate), - PM2: (pm2, 2, Tristate), - PM3: (pm3, 3, Tristate), - PM4: (pm4, 4, Tristate), - PM5: (pm5, 5, Tristate), - PM6: (pm6, 6, Tristate), - PM7: (pm7, 7, Tristate), - ] -); - -gpio_macro!( - GPION, gpion, 'n', 8, gpio078, gpio07c, gpio0e8, gpio0ec, gpio0f0, gpio0f4, gpio0f8, - gpio0fc, gpio100, gpio104, gpio0e0, gpio0e4, gpio0cc, gpio108, - [ - PN0: (pn0, 0, Tristate), - PN1: (pn1, 1, Tristate), - PN2: (pn2, 2, Tristate), - PN3: (pn3, 3, Tristate), - PN4: (pn4, 4, Tristate), - PN5: (pn5, 5, Tristate), - PN6: (pn6, 6, Tristate), - PN7: (pn7, 7, Tristate), - ] -); - -gpio_macro!( - GPIOO, gpioo, 'o', 16, gpio078, gpio07c, gpio0e8, gpio0ec, gpio0f0, gpio0f4, gpio0f8, - gpio0fc, gpio100, gpio104, gpio0e0, gpio0e4, gpio0cc, gpio108, - [ - PO0: (po0, 0, Tristate), - PO1: (po1, 1, Tristate), - PO2: (po2, 2, Tristate), - PO3: (po3, 3, Tristate), - PO4: (po4, 4, Tristate), - PO5: (po5, 5, Tristate), - PO6: (po6, 6, Tristate), - PO7: (po7, 7, Tristate), - ] -); - -gpio_macro!( - GPIOP, gpiop, 'p', 24, gpio078, gpio07c, gpio0e8, gpio0ec, gpio0f0, gpio0f4, gpio0f8, - gpio0fc, gpio100, gpio104, gpio0e0, gpio0e4, gpio0cc, gpio108, - [ - PP0: (pp0, 0, Tristate), - PP1: (pp1, 1, Tristate), - PP2: (pp2, 2, Tristate), - PP3: (pp3, 3, Tristate), - PP4: (pp4, 4, Tristate), - PP5: (pp5, 5, Tristate), - PP6: (pp6, 6, Tristate), - PP7: (pp7, 7, Tristate), - ] -); - -// GPIO QRST — register group 0x080–0x138 -gpio_macro!( - GPIOQ, gpioq, 'q', 0, gpio080, gpio084, gpio118, gpio11c, gpio120, gpio124, gpio128, - gpio12c, gpio130, gpio134, gpio110, gpio114, gpio0d0, gpio138, - [ - PQ0: (pq0, 0, Tristate), - PQ1: (pq1, 1, Tristate), - PQ2: (pq2, 2, Tristate), - PQ3: (pq3, 3, Tristate), - PQ4: (pq4, 4, Tristate), - PQ5: (pq5, 5, Tristate), - PQ6: (pq6, 6, Tristate), - PQ7: (pq7, 7, Tristate), - ] -); - -gpio_macro!( - GPIOR, gpior, 'r', 8, gpio080, gpio084, gpio118, gpio11c, gpio120, gpio124, gpio128, - gpio12c, gpio130, gpio134, gpio110, gpio114, gpio0d0, gpio138, - [ - PR0: (pr0, 0, Tristate), - PR1: (pr1, 1, Tristate), - PR2: (pr2, 2, Tristate), - PR3: (pr3, 3, Tristate), - PR4: (pr4, 4, Tristate), - PR5: (pr5, 5, Tristate), - PR6: (pr6, 6, Tristate), - PR7: (pr7, 7, Tristate), - ] -); - -gpio_macro!( - GPIOS, gpios, 's', 16, gpio080, gpio084, gpio118, gpio11c, gpio120, gpio124, gpio128, - gpio12c, gpio130, gpio134, gpio110, gpio114, gpio0d0, gpio138, - [ - PS0: (ps0, 0, Tristate), - PS1: (ps1, 1, Tristate), - PS2: (ps2, 2, Tristate), - PS3: (ps3, 3, Tristate), - PS4: (ps4, 4, Tristate), - PS5: (ps5, 5, Tristate), - PS6: (ps6, 6, Tristate), - PS7: (ps7, 7, Tristate), - ] -); - -gpio_macro!( - GPIOT, gpiot, 't', 24, gpio080, gpio084, gpio118, gpio11c, gpio120, gpio124, gpio128, - gpio12c, gpio130, gpio134, gpio110, gpio114, gpio0d0, gpio138, - [ - PT0: (pt0, 0, Tristate), - PT1: (pt1, 1, Tristate), - PT2: (pt2, 2, Tristate), - PT3: (pt3, 3, Tristate), - PT4: (pt4, 4, Tristate), - PT5: (pt5, 5, Tristate), - PT6: (pt6, 6, Tristate), - PT7: (pt7, 7, Tristate), - ] -); - -// GPIO U — register group 0x088–0x168 -gpio_macro!( - GPIOU, gpiou, 'u', 0, gpio088, gpio08c, gpio148, gpio14c, gpio150, gpio154, gpio158, - gpio15c, gpio160, gpio164, gpio140, gpio144, gpio0d4, gpio168, - [ - PU0: (pu0, 0, Tristate), - PU1: (pu1, 1, Tristate), - PU2: (pu2, 2, Tristate), - PU3: (pu3, 3, Tristate), - PU4: (pu4, 4, Tristate), - PU5: (pu5, 5, Tristate), - PU6: (pu6, 6, Tristate), - PU7: (pu7, 7, Tristate), - ] -); diff --git a/target/ast10x0/peripherals/gpio/registers.rs b/target/ast10x0/peripherals/gpio/registers.rs deleted file mode 100644 index a9e243b67..000000000 --- a/target/ast10x0/peripherals/gpio/registers.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Licensed under the Apache-2.0 license -// SPDX-License-Identifier: Apache-2.0 - -//! AST10x0 GPIO low-level register accessor. - -use ast1060_pac as device; -use core::marker::PhantomData; - -/// Safe wrapper around the AST1060 GPIO register block. -pub struct GpioRegisters { - base: *const device::gpio::RegisterBlock, - /// Prevent `Send` and `Sync`. - /// - /// MMIO register blocks must not be transferred across threads or - /// shared by reference due to potential side effects and lack of - /// synchronization guarantees. - _not_send_sync: PhantomData<*const ()>, -} - -impl GpioRegisters { - /// Create a register accessor from a raw GPIO register block pointer. - /// - /// # Safety - /// - /// - `base` must be a valid, non-null pointer to the AST1060 GPIO register block. - /// - The block must remain valid for the lifetime of this value. - /// - Caller must enforce exclusive (or otherwise coordinated) access to the - /// register block for the duration of use. - pub const unsafe fn new(base: *const device::gpio::RegisterBlock) -> Self { - Self { - base, - _not_send_sync: PhantomData, - } - } - - /// Create a register accessor for the global GPIO instance. - /// - /// # Safety - /// - /// Caller must ensure exclusive access to the singleton GPIO peripheral is - /// coordinated for the lifetime of this value. - pub unsafe fn new_global() -> Self { - // SAFETY: Caller upholds the singleton access contract. - unsafe { Self::new(device::Gpio::ptr()) } - } - - #[inline] - pub(crate) fn regs(&self) -> &device::gpio::RegisterBlock { - // SAFETY: Constructor guarantees a valid, non-null register block pointer. - unsafe { &*self.base } - } -} diff --git a/target/ast10x0/peripherals/gpio/types.rs b/target/ast10x0/peripherals/gpio/types.rs deleted file mode 100644 index 50e90b5ab..000000000 --- a/target/ast10x0/peripherals/gpio/types.rs +++ /dev/null @@ -1,115 +0,0 @@ -// Licensed under the Apache-2.0 license -// SPDX-License-Identifier: Apache-2.0 - -//! GPIO type states, traits, and error types. - -use core::marker::PhantomData; - -/// All input modes implement this trait. -pub trait InputMode {} - -/// All output modes implement this trait. -pub trait OutputMode {} - -/// `OpenDrain` modes implement this trait. -pub trait OpenDrainMode { - /// Whether the actively driven level is high. - const ACTIVE_HIGH: bool; -} - -/// Active-low open-drain mode: output drives low and input releases high. -pub struct ActiveLow; -impl OpenDrainMode for ActiveLow { - const ACTIVE_HIGH: bool = false; -} - -/// Active-high open-drain mode: output drives high and input releases low. -pub struct ActiveHigh; -impl OpenDrainMode for ActiveHigh { - const ACTIVE_HIGH: bool = true; -} - -/// Input mode (type state). -pub struct Input -where - MODE: InputMode, -{ - pub(super) _mode: PhantomData, -} - -/// Sub-mode of Input: Floating input (type state). -pub struct Floating; -impl InputMode for Floating {} - -/// Sub-mode of Input: Pulled down input (type state). -pub struct PullDown; -impl InputMode for PullDown {} - -/// Sub-mode of Input: Pulled up input (type state). -pub struct PullUp; -impl InputMode for PullUp {} - -/// Tri-state mode (type state). -pub struct Tristate; - -/// Output mode (type state). -pub struct Output -where - MODE: OutputMode, -{ - pub(super) _mode: PhantomData, -} - -/// Sub-mode of Output: Push-pull output (type state). -pub struct PushPull; -impl OutputMode for PushPull {} -impl OutputMode for PullDown {} -impl OutputMode for PullUp {} - -/// Sub-mode of Output: Open drain output (type state). -pub struct OpenDrain -where - ODM: OpenDrainMode, -{ - pub(super) _mode: PhantomData, -} -impl OutputMode for OpenDrain where ODM: OpenDrainMode {} - -/// Sets when a GPIO pin triggers an interrupt. -pub enum InterruptMode { - /// Interrupt when level is low. - LevelLow, - /// Interrupt when level is high. - LevelHigh, - /// Interrupt on rising edge. - EdgeRising, - /// Interrupt on falling edge. - EdgeFalling, - /// Interrupt on both rising and falling edges. - EdgeBoth, - /// Disable interrupts on this pin. - Disabled, -} - -/// Extension trait to split a GPIO bank peripheral into individual pins. -pub trait GpioExt { - /// The type returned by [`split`](GpioExt::split). - type Parts; - - /// Consume the bank peripheral and return its individual pins. - fn split(self) -> Self::Parts; -} - -/// Error type for GPIO operations. -#[derive(Debug)] -pub enum GpioError { - Unknown, -} - -impl embedded_hal::digital::Error for GpioError { - fn kind(&self) -> embedded_hal::digital::ErrorKind { - match self { - GpioError::Unknown => embedded_hal::digital::ErrorKind::Other, - } - } -} diff --git a/target/ast10x0/peripherals/i2c/constants.rs b/target/ast10x0/peripherals/i2c/constants.rs index 146a5d56d..a44b12bf0 100644 --- a/target/ast10x0/peripherals/i2c/constants.rs +++ b/target/ast10x0/peripherals/i2c/constants.rs @@ -64,6 +64,49 @@ pub const ABORT_TIMEOUT_US: u32 = 10_000; /// Maximum retry attempts for operations pub const MAX_RETRY_ATTEMPTS: u32 = 3; +/// Bit index of "Bus Busy Status" within [`I2CC08`]. +pub const AST_I2CC_BUS_BUSY_BIT: u8 = 16; + +// ============================================================================ +// Register offsets (byte offsets into the I2C controller block) +// ============================================================================ +/// Function control register. +pub const I2CC00: u32 = 0x00; +/// AC timing register. +pub const I2CC04: u32 = 0x04; +/// Byte buffer / line status register. +pub const I2CC08: u32 = 0x08; +/// Pool buffer control register. +pub const I2CC0C: u32 = 0x0c; +/// Master interrupt control register. +pub const I2CM10: u32 = 0x10; +/// Master interrupt status register (write-to-clear). +pub const I2CM14: u32 = 0x14; +/// Master command register. +pub const I2CM18: u32 = 0x18; +/// Master DMA length register. +pub const I2CM1C: u32 = 0x1c; +/// Slave interrupt control register. +pub const I2CS20: u32 = 0x20; +/// Slave interrupt status register (write-to-clear). +pub const I2CS24: u32 = 0x24; +/// Slave command register. +pub const I2CS28: u32 = 0x28; +/// Slave DMA length register. +pub const I2CS2C: u32 = 0x2c; +/// Master DMA TX buffer base address. +pub const I2CM30: u32 = 0x30; +/// Master DMA RX buffer base address. +pub const I2CM34: u32 = 0x34; +/// Slave DMA RX buffer base address. +pub const I2CS38: u32 = 0x38; +/// Slave DMA RX buffer base address (second). +pub const I2CS3C: u32 = 0x3c; +/// Slave device address register. +pub const I2CS40: u32 = 0x40; +/// Slave DMA RX actual-length register. +pub const I2CS4C: u32 = 0x4c; + // ============================================================================ // Register bit definitions // Reference: aspeed-rust/src/i2c/ast1060_i2c.rs lines 55-100 @@ -72,6 +115,8 @@ pub const MAX_RETRY_ATTEMPTS: u32 = 3; // Function Control Register (I2CC00) /// Enable slave function pub const AST_I2CC_SLAVE_EN: u32 = 1 << 1; +/// Enable bus auto-release on SCL-low/SDA-low or slave-mode inactive timeout +pub const AST_I2CC_BUS_AUTO_RELEASE: u32 = 1 << 17; /// Enable master function pub const AST_I2CC_MASTER_EN: u32 = 1 << 0; /// Disable multi-master capability @@ -179,6 +224,51 @@ pub const AST_I2CS_WAIT_RX_DMA: u32 = 1 << 24; /// Helper to build packet mode address field #[inline] #[must_use] -pub fn ast_i2cm_pkt_addr(addr: u8) -> u32 { - u32::from(addr & 0x7F) << 24 +pub const fn ast_i2cm_pkt_addr(addr: u8) -> u32 { + ((addr & 0x7F) as u32) << 24 } + +/// This SoC's I2C master command/status map: fill the HAL's named slots with AST1060 values. +#[derive(Clone, Copy)] +pub struct AstMasterBits; + +impl openprot_hal::i2c_cmd_words::I2cMasterCmdBits for AstMasterBits { + const OFFSET: u32 = I2CM18; + const PACKET: u32 = AST_I2CM_PKT_EN; + const START: u32 = AST_I2CM_START_CMD; + const STOP: u32 = AST_I2CM_STOP_CMD; + const TX: u32 = AST_I2CM_TX_CMD; + const RX: u32 = AST_I2CM_RX_CMD; + const RX_LAST: u32 = AST_I2CM_RX_CMD_LAST; + const TX_BUFF: u32 = AST_I2CM_TX_BUFF_EN; + const RX_BUFF: u32 = AST_I2CM_RX_BUFF_EN; + const TX_DMA: u32 = AST_I2CM_TX_DMA_EN; + const RX_DMA: u32 = AST_I2CM_RX_DMA_EN; + const RECOVER: u32 = 1 << 11; + fn pkt_addr(addr: u8) -> u32 { + ast_i2cm_pkt_addr(addr) + } +} + +impl openprot_hal::i2c_cmd_words::I2cMasterStatusBits for AstMasterBits { + const OFFSET: u32 = I2CM14; + const TX_ACK: u32 = AST_I2CM_TX_ACK; + const TX_NAK: u32 = AST_I2CM_TX_NAK; + const RX_DONE: u32 = AST_I2CM_RX_DONE; + const ARBIT_LOSS: u32 = AST_I2CM_ARBIT_LOSS; + const NORMAL_STOP: u32 = AST_I2CM_NORMAL_STOP; + const ABNORMAL: u32 = AST_I2CM_ABNORMAL; + const SCL_LOW_TO: u32 = AST_I2CM_SCL_LOW_TO; + const PKT_DONE: u32 = AST_I2CM_PKT_DONE; + const PKT_ERROR: u32 = AST_I2CM_PKT_ERROR; + const BUS_RECOVER: u32 = AST_I2CM_BUS_RECOVER; + const BUS_RECOVER_FAIL: u32 = AST_I2CM_BUS_RECOVER_FAIL; + const SDA_DL_TO: u32 = AST_I2CM_SDA_DL_TO; +} + +/// AST1060 master command builder — the HAL type filled with this chip's bit values. +pub type I2cMasterCommand = openprot_hal::i2c_cmd_words::I2cMasterCmd; +/// AST1060 master status flag-set — the HAL type filled with this chip's bit values. +pub type I2cMasterStatus = openprot_hal::i2c_cmd_words::I2cMasterStatus; + +pub use openprot_hal::i2c_cmd_words::{I2cCmd, I2cStat}; diff --git a/target/ast10x0/peripherals/i2c/controller.rs b/target/ast10x0/peripherals/i2c/controller.rs index 9b107cd78..01976d755 100644 --- a/target/ast10x0/peripherals/i2c/controller.rs +++ b/target/ast10x0/peripherals/i2c/controller.rs @@ -3,11 +3,11 @@ //! AST1060 I2C controller implementation +use super::constants::{I2cMasterStatus, I2cStat}; use super::registers::Ast1060I2cRegisters; use super::timing::configure_timing; use super::types::{I2cConfig, I2cXferMode}; use super::{constants, error::I2cError}; -use ast1060_pac::{i2c::RegisterBlock, i2cbuff::RegisterBlock as BuffRegisterBlock}; /// Main I2C hardware abstraction. /// @@ -24,7 +24,7 @@ use ast1060_pac::{i2c::RegisterBlock, i2cbuff::RegisterBlock as BuffRegisterBloc pub struct Ast1060I2c<'a, Y: FnMut(u32)> { /// MMIO façade — the sole site of register-pointer `unsafe`. Not `Sync` /// (and not `Send`) by construction, so `Ast1060I2c` isn't either. - mmio: Ast1060I2cRegisters, + pub(crate) mmio: Ast1060I2cRegisters, /// Transfer mode (visible to other modules for optimization decisions) pub(crate) xfer_mode: I2cXferMode, @@ -61,7 +61,7 @@ impl<'a, Y: FnMut(u32)> Ast1060I2c<'a, Y> { /// `new()` call. /// /// Safe: the `unsafe` register-pointer perimeter was discharged once at - /// [`Ast1060I2cRegisters::new`]; this only consumes the resulting façade. + /// [`Ast1060I2cRegisters::from_pins`]; this only consumes the resulting façade. pub fn new( mmio: Ast1060I2cRegisters, config: &I2cConfig, @@ -130,7 +130,7 @@ impl<'a, Y: FnMut(u32)> Ast1060I2c<'a, Y> { /// /// Like [`from_initialized`] but attaches separate master and slave DMA /// buffers. Use when the bus was already initialized via [`new_with_dma`] - /// or `init_bus` and you want to avoid redundant hardware init. + /// or `open_bus_dma` and you want to avoid redundant hardware init. /// /// Both buffers must reside in non-cached SRAM and remain valid for this /// `Ast1060I2c`'s lifetime. @@ -148,27 +148,6 @@ impl<'a, Y: FnMut(u32)> Ast1060I2c<'a, Y> { i2c } - /// Copy of the MMIO façade, for handing to short-lived helpers (e.g. the - /// [`super::dma::ArmedDma`] teardown guard) that must outlive an `&mut self` - /// borrow. Sound because the façade is `Copy` and access stays serialized. - #[inline] - pub(crate) fn mmio(&self) -> super::registers::Ast1060I2cRegisters { - self.mmio - } - - /// I2C register block, via the MMIO façade (sole `unsafe` deref is inside - /// [`Ast1060I2cRegisters`]). Driver-internal use. - #[inline] - pub(crate) fn regs(&self) -> &RegisterBlock { - self.mmio.i2c() - } - - /// I2CBUFF register block, via the MMIO façade. Driver-internal use. - #[inline] - pub(crate) fn buff_regs(&self) -> &BuffRegisterBlock { - self.mmio.buff() - } - /// Initialize hardware #[inline(never)] pub fn init_hardware(&mut self, config: &I2cConfig) -> Result<(), I2cError> { @@ -176,45 +155,38 @@ impl<'a, Y: FnMut(u32)> Ast1060I2c<'a, Y> { // See: super::global::init_i2c_global(). // Reset I2C controller - unsafe { - self.regs().i2cc00().write(|w| w.bits(0)); - } + self.mmio.i2c.write_reg(constants::I2CC00, 0); // Configure multi-master if !self.multi_master { - self.regs() - .i2cc00() - .modify(|_, w| w.dis_multimaster_capability_for_master_fn_only().set_bit()); + self.mmio.i2c.modify_field(constants::I2CC00, 15, 1, 1); } // Enable master function and bus auto-release - self.regs().i2cc00().modify(|_, w| { - w.enbl_bus_autorelease_when_scllow_sdalow_or_slave_mode_inactive_timeout() - .set_bit() - .enbl_master_fn() - .set_bit() - }); + let v = self.mmio.i2c.read_reg(constants::I2CC00); + self.mmio.i2c.write_reg( + constants::I2CC00, + v | constants::AST_I2CC_BUS_AUTO_RELEASE | constants::AST_I2CC_MASTER_EN, + ); // Configure timing - configure_timing(self.regs(), config)?; + configure_timing(&self.mmio.i2c, config)?; // Clear all interrupts - unsafe { - self.regs().i2cm14().write(|w| w.bits(0xffff_ffff)); - } + I2cMasterStatus::all().clear(&self.mmio.i2c); // Enable interrupts for packet mode - self.regs().i2cm10().modify(|_, w| { - w.enbl_pkt_cmd_done_int() - .set_bit() - .enbl_bus_recover_done_int() - .set_bit() - }); + let v = self.mmio.i2c.read_reg(constants::I2CM10); + self.mmio.i2c.write_reg( + constants::I2CM10, + v | constants::AST_I2CM_PKT_DONE | constants::AST_I2CM_BUS_RECOVER, + ); if self.smbus_alert { - self.regs() - .i2cm10() - .modify(|_, w| w.enbl_smbus_dev_alert_int().set_bit()); + let v = self.mmio.i2c.read_reg(constants::I2CM10); + self.mmio + .i2c + .write_reg(constants::I2CM10, v | constants::AST_I2CM_SMBUS_ALT); } Ok(()) @@ -222,30 +194,21 @@ impl<'a, Y: FnMut(u32)> Ast1060I2c<'a, Y> { /// Enable interrupts pub fn enable_interrupts(&mut self, mask: u32) { - unsafe { - self.regs().i2cm10().write(|w| w.bits(mask)); - } + self.mmio.i2c.write_reg(constants::I2CM10, mask); } - /// Clear interrupts - pub fn clear_interrupts(&mut self, mask: u32) { - unsafe { - self.regs().i2cm14().write(|w| w.bits(mask)); - } + /// Clear interrupts (write-1-to-clear the flags held in `mask`) + pub fn clear_interrupts(&mut self, mask: I2cMasterStatus) { + mask.clear(&self.mmio.i2c); } /// Check if bus is busy /// - /// Checks if any I2C transfer is currently active by examining status register bits. + /// Bus is active if any of the low status flags (ACK/NAK/arbitration) are set. #[must_use] pub fn is_bus_busy(&self) -> bool { - let status = self.regs().i2cm14().read().bits(); - // Bus is busy if any transfer command bits are set - (status - & (constants::AST_I2CM_TX_CMD - | constants::AST_I2CM_RX_CMD - | constants::AST_I2CM_START_CMD)) - != 0 + let status = I2cMasterStatus::read(&self.mmio.i2c); + status.has(I2cStat::TxAck) || status.has(I2cStat::TxNak) || status.has(I2cStat::ArbitLoss) } /// Wait for completion with timeout (visible to master/transfer modules). diff --git a/target/ast10x0/peripherals/i2c/dma.rs b/target/ast10x0/peripherals/i2c/dma.rs index bb26bbfac..d507f17ec 100644 --- a/target/ast10x0/peripherals/i2c/dma.rs +++ b/target/ast10x0/peripherals/i2c/dma.rs @@ -11,72 +11,84 @@ //! //! [`ArmedDma`] makes that teardown a property of the type system: constructing //! it arms the engine, and its [`Drop`] soft-resets the controller -//! unconditionally. [`ArmedDma::commit`] *consumes* the guard (defusing the -//! teardown by forgetting it), so a committed transaction is no longer a -//! droppable `ArmedDma` — "committed" is the absence of the value, not a runtime -//! flag. Every error path that returns before commit therefore drops a live -//! guard and tears the engine down; there is no state in which the teardown can -//! be skipped by mistake. All DMA-lifecycle `unsafe` is confined to this module, -//! holding its own `Copy` of the [`Ast1060I2cRegisters`] façade. +//! unconditionally. [`ArmedDma::run`] drives the transaction to completion and +//! *consumes* the guard on success (defusing the teardown by forgetting it), so +//! a committed transaction is no longer a droppable `ArmedDma` — "committed" is +//! the absence of the value, not a runtime flag. Every error path returns +//! before that point and therefore drops a live guard; there is no state in +//! which the teardown can be skipped by mistake. +//! +//! The guard borrows the controller mutably for the whole armed window, so a +//! second transaction cannot be armed while one is live — exclusivity of the +//! engine is the borrow checker's, not a comment's. -use super::constants; -use super::registers::Ast1060I2cRegisters; +use super::constants::{self, I2cMasterCommand, I2cMasterStatus}; +use super::controller::Ast1060I2c; +use super::error::I2cError; /// Guard for one armed master DMA transaction. /// /// Constructing an `ArmedDma` programs the DMA length + buffer-base registers /// (the engine is now a potential AHB bus master). [`Drop`] soft-resets the -/// controller and waits for the engine to go idle. The happy path calls -/// [`commit`](ArmedDma::commit), which consumes the guard so its `Drop` never -/// runs — there is no "committed" flag, the committed state is simply the guard -/// no longer existing. +/// controller and waits for the engine to go idle. [`run`](ArmedDma::run) +/// issues the command and forgets the guard once the engine has quiesced +/// normally — there is no "committed" flag, the committed state is simply the +/// guard no longer existing. #[must_use = "drop tears down the DMA engine; bind it for the transfer's lifetime"] -pub(crate) struct ArmedDma { - mmio: Ast1060I2cRegisters, +pub(crate) struct ArmedDma<'i, 'b, Y: FnMut(u32)> { + i2c: &'i mut Ast1060I2c<'b, Y>, } -impl ArmedDma { +impl<'i, 'b, Y: FnMut(u32)> ArmedDma<'i, 'b, Y> { /// Arm a TX DMA transaction: program i2cm1c (len-1) + i2cm30 (base addr). - pub(crate) fn arm_tx(mmio: Ast1060I2cRegisters, phy_addr: u32, len: usize) -> Self { + pub(crate) fn arm_tx(i2c: &'i mut Ast1060I2c<'b, Y>, phy_addr: u32, len: usize) -> Self { #[allow(clippy::cast_possible_truncation)] - mmio.i2c().i2cm1c().write(|w| unsafe { - w.dmatx_buf_len_byte() - .bits((len - 1) as u16) - .dmatx_buf_len_wr_enbl_for_cur_write_cmd() - .set_bit() - }); - mmio.i2c() - .i2cm30() - .write(|w| unsafe { w.sdramdmabuffer_base_addr().bits(phy_addr) }); - Self { mmio } + i2c.mmio + .i2c + .write_reg(constants::I2CM1C, (((len - 1) as u32) & 0xfff) | (1 << 15)); + i2c.mmio + .i2c + .write_reg(constants::I2CM30, phy_addr & 0x7fff_ffff); + Self { i2c } } /// Arm an RX DMA transaction: program i2cm1c (len-1) + i2cm34 (base addr). - pub(crate) fn arm_rx(mmio: Ast1060I2cRegisters, phy_addr: u32, len: usize) -> Self { + pub(crate) fn arm_rx(i2c: &'i mut Ast1060I2c<'b, Y>, phy_addr: u32, len: usize) -> Self { + let cur = i2c.mmio.i2c.read_reg(constants::I2CM1C); #[allow(clippy::cast_possible_truncation)] - mmio.i2c().i2cm1c().modify(|_, w| unsafe { - w.dmarx_buf_len_byte() - .bits((len - 1) as u16) - .dmarx_buf_len_wr_enbl_for_cur_write_cmd() - .set_bit() - }); - mmio.i2c() - .i2cm34() - .modify(|_, w| unsafe { w.sdramdmabuffer_base_addr1().bits(phy_addr) }); - Self { mmio } + let v = + (cur & !((0xfff << 16) | (1 << 31))) | ((((len - 1) as u32) & 0xfff) << 16) | (1 << 31); + i2c.mmio.i2c.write_reg(constants::I2CM1C, v); + i2c.mmio + .i2c + .modify_field(constants::I2CM34, 0, 0x7fff_ffff, phy_addr); + Self { i2c } } - /// Transfer completed cleanly (STOP issued); no teardown needed. - pub(crate) fn commit(self) { - core::mem::forget(self); + /// Issue `cmd` on i2cm18 and wait for the engine to quiesce. On success the + /// guard is forgotten, so no teardown runs; on timeout it drops live here + /// and soft-resets the controller. + pub(crate) fn run(self, cmd: I2cMasterCommand) -> Result<(), I2cError> { + self.i2c.clear_interrupts(I2cMasterStatus::all()); + self.i2c.completion = false; + + cmd.issue(&self.i2c.mmio.i2c); + + match self.i2c.wait_completion(constants::DEFAULT_TIMEOUT_US) { + Ok(()) => { + core::mem::forget(self); + Ok(()) + } + Err(e) => Err(e), + } } } -impl Drop for ArmedDma { +impl Drop for ArmedDma<'_, '_, Y> { fn drop(&mut self) { - // Reached only for an *uncommitted* guard: `commit` consumes and forgets - // the value, so a committed transaction never drops here. Teardown is - // therefore unconditional. + // Reached only for an *uncommitted* guard: `run` forgets the value on + // the success path, so a committed transaction never drops here. + // Teardown is therefore unconditional. // // No master-only abort exists; soft-reset the controller (datasheet // §27.6.8): clear I2CC00 function-control, then restore it. Timing in @@ -86,21 +98,23 @@ impl Drop for ArmedDma { // This disables the slave function for the reset window, which is safe // here: the i2c-server-runtime backend is master-only and never arms a // concurrent slave on this controller. - let fun_ctrl = self.mmio.i2c().i2cc00().read().bits(); - unsafe { - self.mmio.i2c().i2cc00().write(|w| w.bits(0)); - self.mmio.i2c().i2cc00().write(|w| w.bits(fun_ctrl)); - } + let fun_ctrl = self.i2c.mmio.i2c.read_reg(constants::I2CC00); + self.i2c.mmio.i2c.write_reg(constants::I2CC00, 0); + self.i2c.mmio.i2c.write_reg(constants::I2CC00, fun_ctrl); let mut timeout = constants::ABORT_TIMEOUT_US; - while timeout > 0 && self.mmio.i2c().i2cc08().read().bus_busy_status().bit() { + while timeout > 0 + && self + .i2c + .mmio + .i2c + .read_bit(constants::I2CC08, constants::AST_I2CC_BUS_BUSY_BIT) + { timeout = timeout.saturating_sub(1); core::hint::spin_loop(); } // Clear any latched interrupts from the aborted transaction. - unsafe { - self.mmio.i2c().i2cm14().write(|w| w.bits(0xffff_ffff)); - } + I2cMasterStatus::all().clear(&self.i2c.mmio.i2c); } } diff --git a/target/ast10x0/peripherals/i2c/hal_slave_impl.rs b/target/ast10x0/peripherals/i2c/hal_slave_impl.rs index e8009bdf0..708ee2f30 100644 --- a/target/ast10x0/peripherals/i2c/hal_slave_impl.rs +++ b/target/ast10x0/peripherals/i2c/hal_slave_impl.rs @@ -19,6 +19,7 @@ use embedded_hal::i2c::SevenBitAddress; use openprot_hal_blocking::i2c_hardware::slave::{I2cIsrEvent, I2cSlaveBuffer, I2cSlaveCore}; use openprot_hal_blocking::i2c_hardware::I2cBusRecovery; +use super::constants; use super::controller::Ast1060I2c; use super::error::I2cError; use super::slave::{SlaveConfig, SlaveEvent}; @@ -63,12 +64,12 @@ impl I2cSlaveCore for Ast1060I2c<'_, Y> { } fn is_slave_mode_enabled(&self) -> bool { - self.regs().i2cc00().read().enbl_slave_fn().bit() + self.mmio.i2c.read_bit(constants::I2CC00, 1) } fn slave_address(&self) -> Option { if self.is_slave_mode_enabled() { - Some(self.regs().i2cs40().read().slave_dev_addr1().bits()) + Some((self.mmio.i2c.read_reg(constants::I2CS40) & 0x7f) as u8) } else { None } diff --git a/target/ast10x0/peripherals/i2c/master.rs b/target/ast10x0/peripherals/i2c/master.rs index 8ffecc70d..49030a69a 100644 --- a/target/ast10x0/peripherals/i2c/master.rs +++ b/target/ast10x0/peripherals/i2c/master.rs @@ -28,6 +28,7 @@ //! - **i2cm14** (Interrupt Status Register): Read status, write-to-clear //! - Reference: `ast1060_i2c.rs:849-870` (`aspeed_i2c_master_irq`) +use super::constants::{I2cCmd, I2cMasterCommand, I2cMasterStatus, I2cStat}; use super::{ constants, controller::Ast1060I2c, dma::ArmedDma, error::I2cError, types::I2cXferMode, }; @@ -108,40 +109,40 @@ impl Ast1060I2c<'_, Y> { self.completion = false; // Clear any previous status - self.clear_interrupts(0xffff_ffff); + self.clear_interrupts(I2cMasterStatus::all()); for (i, &byte) in bytes.iter().enumerate() { let is_first = i == 0; let is_last = i == msg_len - 1; // Write data byte to TX byte buffer (i2cc08) - self.regs() - .i2cc08() - .modify(|_, w| unsafe { w.tx_byte_buffer().bits(byte) }); + self.mmio + .i2c + .modify_field(constants::I2CC08, 0, 0xff, u32::from(byte)); // Build command - let mut cmd = constants::AST_I2CM_PKT_EN | constants::AST_I2CM_TX_CMD; + let mut cmd = I2cMasterCommand::packet().with(I2cCmd::Tx); // Only send START and address on first byte if is_first { - cmd |= constants::ast_i2cm_pkt_addr(addr) | constants::AST_I2CM_START_CMD; + cmd = cmd.address(addr).with(I2cCmd::Start); } // Send STOP on last byte (omitted when caller wants repeated-START) if is_last && stop { - cmd |= constants::AST_I2CM_STOP_CMD; + cmd = cmd.with(I2cCmd::Stop); } // Issue command to i2cm18 - self.regs().i2cm18().write(|w| unsafe { w.bits(cmd) }); + cmd.issue(&self.mmio.i2c); // Wait for completion self.completion = false; self.wait_completion(constants::DEFAULT_TIMEOUT_US)?; // Check for errors (read from i2cm14 - interrupt status register) - let status = self.regs().i2cm14().read().bits(); - if status & constants::AST_I2CM_TX_NAK != 0 { + let status = I2cMasterStatus::read(&self.mmio.i2c); + if status.has(I2cStat::TxNak) { return Err(I2cError::NoAcknowledge); } @@ -168,38 +169,38 @@ impl Ast1060I2c<'_, Y> { self.completion = false; // Clear any previous status - self.clear_interrupts(0xffff_ffff); + self.clear_interrupts(I2cMasterStatus::all()); for (i, byte) in buffer.iter_mut().enumerate() { let is_first = i == 0; let is_last = i == msg_len - 1; // Build command - let mut cmd = constants::AST_I2CM_PKT_EN | constants::AST_I2CM_RX_CMD; + let mut cmd = I2cMasterCommand::packet().with(I2cCmd::Rx); // Only send START and address on first byte if is_first { - cmd |= constants::ast_i2cm_pkt_addr(addr) | constants::AST_I2CM_START_CMD; + cmd = cmd.address(addr).with(I2cCmd::Start); } // Send NACK and STOP on last byte if is_last { - cmd |= constants::AST_I2CM_RX_CMD_LAST | constants::AST_I2CM_STOP_CMD; + cmd = cmd.with(I2cCmd::RxLast).with(I2cCmd::Stop); } // Issue command to i2cm18 - self.regs().i2cm18().write(|w| unsafe { w.bits(cmd) }); + cmd.issue(&self.mmio.i2c); // Wait for completion self.completion = false; self.wait_completion(constants::DEFAULT_TIMEOUT_US)?; // Read data from RX byte buffer (i2cc08) - *byte = self.regs().i2cc08().read().rx_byte_buffer().bits(); + *byte = ((self.mmio.i2c.read_reg(constants::I2CC08) >> 8) & 0xff) as u8; // Check status (read from i2cm14 - interrupt status register) - let status = self.regs().i2cm14().read().bits(); - if status & constants::AST_I2CM_TX_NAK != 0 { + let status = I2cMasterStatus::read(&self.mmio.i2c); + if status.has(I2cStat::TxNak) { return Err(I2cError::NoAcknowledge); } @@ -240,41 +241,41 @@ impl Ast1060I2c<'_, Y> { // Set TX byte count in i2cc0c (len - 1) #[allow(clippy::cast_possible_truncation)] - self.regs() - .i2cc0c() - .modify(|_, w| unsafe { w.tx_data_byte_count().bits((chunk_len - 1) as u8) }); + self.mmio + .i2c + .modify_field(constants::I2CC0C, 8, 0x1f, (chunk_len - 1) as u32); // Clear interrupts before command - self.clear_interrupts(0xffff_ffff); + self.clear_interrupts(I2cMasterStatus::all()); self.completion = false; // Build command based on chunk position // First chunk: PKT_EN + addr + START + TX_CMD + TX_BUFF_EN // Subsequent chunks: PKT_EN + TX_CMD + TX_BUFF_EN (NO START, NO addr) - let mut cmd = constants::AST_I2CM_PKT_EN - | constants::AST_I2CM_TX_CMD - | constants::AST_I2CM_TX_BUFF_EN; + let mut cmd = I2cMasterCommand::packet() + .with(I2cCmd::Tx) + .with(I2cCmd::TxBuff); // Only send START and address on first chunk if is_first { - cmd |= constants::ast_i2cm_pkt_addr(addr) | constants::AST_I2CM_START_CMD; + cmd = cmd.address(addr).with(I2cCmd::Start); } // Add STOP on last chunk (omitted when caller wants repeated-START) if is_last && stop { - cmd |= constants::AST_I2CM_STOP_CMD; + cmd = cmd.with(I2cCmd::Stop); } // Issue command to i2cm18 - self.regs().i2cm18().write(|w| unsafe { w.bits(cmd) }); + cmd.issue(&self.mmio.i2c); // Wait for completion self.wait_completion(constants::DEFAULT_TIMEOUT_US)?; // Check for errors - let status = self.regs().i2cm14().read().bits(); - if status & constants::AST_I2CM_PKT_ERROR != 0 { - if status & constants::AST_I2CM_TX_NAK != 0 { + let status = I2cMasterStatus::read(&self.mmio.i2c); + if status.has(I2cStat::PktError) { + if status.has(I2cStat::TxNak) { return Err(I2cError::NoAcknowledge); } return Err(I2cError::Abnormal); @@ -315,41 +316,41 @@ impl Ast1060I2c<'_, Y> { // Set RX buffer size in i2cc0c (len - 1) #[allow(clippy::cast_possible_truncation)] - self.regs() - .i2cc0c() - .modify(|_, w| unsafe { w.rx_pool_buffer_size().bits((chunk_len - 1) as u8) }); + self.mmio + .i2c + .modify_field(constants::I2CC0C, 16, 0x1f, (chunk_len - 1) as u32); // Clear interrupts before command - self.clear_interrupts(0xffff_ffff); + self.clear_interrupts(I2cMasterStatus::all()); self.completion = false; // Build command based on chunk position // First chunk: PKT_EN + addr + START + RX_CMD + RX_BUFF_EN // Subsequent chunks: PKT_EN + RX_CMD + RX_BUFF_EN (NO START, NO addr) - let mut cmd = constants::AST_I2CM_PKT_EN - | constants::AST_I2CM_RX_CMD - | constants::AST_I2CM_RX_BUFF_EN; + let mut cmd = I2cMasterCommand::packet() + .with(I2cCmd::Rx) + .with(I2cCmd::RxBuff); // Only send START and address on first chunk if is_first { - cmd |= constants::ast_i2cm_pkt_addr(addr) | constants::AST_I2CM_START_CMD; + cmd = cmd.address(addr).with(I2cCmd::Start); } // Add NACK and STOP on last chunk if is_last { - cmd |= constants::AST_I2CM_RX_CMD_LAST | constants::AST_I2CM_STOP_CMD; + cmd = cmd.with(I2cCmd::RxLast).with(I2cCmd::Stop); } // Issue command to i2cm18 - self.regs().i2cm18().write(|w| unsafe { w.bits(cmd) }); + cmd.issue(&self.mmio.i2c); // Wait for completion self.wait_completion(constants::DEFAULT_TIMEOUT_US)?; // Check for errors - let status = self.regs().i2cm14().read().bits(); - if status & constants::AST_I2CM_PKT_ERROR != 0 { - if status & constants::AST_I2CM_TX_NAK != 0 { + let status = I2cMasterStatus::read(&self.mmio.i2c); + if status.has(I2cStat::PktError) { + if status.has(I2cStat::TxNak) { return Err(I2cError::NoAcknowledge); } return Err(I2cError::Abnormal); @@ -373,37 +374,35 @@ impl Ast1060I2c<'_, Y> { /// Handle interrupt (process completion status) pub fn handle_interrupt(&mut self) -> Result<(), I2cError> { - let status = self.regs().i2cm14().read().bits(); + let status = I2cMasterStatus::read(&self.mmio.i2c); // Check for packet mode completion - if status & constants::AST_I2CM_PKT_DONE != 0 { + if status.has(I2cStat::PktDone) { // Workaround: master/slave packet mode TX_ACK stuck issue. // When master gets TX_ACK mid-transaction (no STOP yet) while slave // packet mode is active, the slave state machine latches a spurious // RX_DONE and will NACK the next master byte. Pulse i2cs28 to clear it. // Ref: Zephyr i2c_aspeed.c aspeed_i2c_master_irq() ~line 1284 - if status & (constants::AST_I2CM_TX_ACK | constants::AST_I2CM_NORMAL_STOP) - == constants::AST_I2CM_TX_ACK - { - if self.regs().i2cs28().read().enbl_slave_pkt_op_mode().bit() { - let slave_cmd = self.regs().i2cs28().read().bits(); - self.regs().i2cs28().write(|w| unsafe { w.bits(0) }); - self.regs().i2cs28().write(|w| unsafe { w.bits(slave_cmd) }); + if status.has(I2cStat::TxAck) && !status.has(I2cStat::NormalStop) { + if self.mmio.i2c.read_bit(constants::I2CS28, 16) { + let slave_cmd = self.mmio.i2c.read_reg(constants::I2CS28); + self.mmio.i2c.write_reg(constants::I2CS28, 0); + self.mmio.i2c.write_reg(constants::I2CS28, slave_cmd); } } self.completion = true; - self.clear_interrupts(constants::AST_I2CM_PKT_DONE); + self.clear_interrupts(I2cMasterStatus::flag(I2cStat::PktDone)); // Check for errors - if status & constants::AST_I2CM_PKT_ERROR != 0 { - if status & constants::AST_I2CM_TX_NAK != 0 { + if status.has(I2cStat::PktError) { + if status.has(I2cStat::TxNak) { return Err(I2cError::NoAcknowledge); } - if status & constants::AST_I2CM_ARBIT_LOSS != 0 { + if status.has(I2cStat::ArbitLoss) { return Err(I2cError::ArbitrationLoss); } - if status & constants::AST_I2CM_ABNORMAL != 0 { + if status.has(I2cStat::Abnormal) { return Err(I2cError::Abnormal); } return Err(I2cError::Bus); @@ -413,29 +412,29 @@ impl Ast1060I2c<'_, Y> { } // Check for byte mode completion - if status & (constants::AST_I2CM_TX_ACK | constants::AST_I2CM_RX_DONE) != 0 { + if status.has(I2cStat::TxAck) || status.has(I2cStat::RxDone) { self.completion = true; self.clear_interrupts(status); return Ok(()); } // Check for errors - if status & constants::AST_I2CM_TX_NAK != 0 { + if status.has(I2cStat::TxNak) { self.clear_interrupts(status); return Err(I2cError::NoAcknowledge); } - if status & constants::AST_I2CM_ABNORMAL != 0 { + if status.has(I2cStat::Abnormal) { self.clear_interrupts(status); return Err(I2cError::Abnormal); } - if status & constants::AST_I2CM_ARBIT_LOSS != 0 { + if status.has(I2cStat::ArbitLoss) { self.clear_interrupts(status); return Err(I2cError::ArbitrationLoss); } - if status & constants::AST_I2CM_SCL_LOW_TO != 0 { + if status.has(I2cStat::SclLowTo) { self.clear_interrupts(status); return Err(I2cError::Timeout); } @@ -502,38 +501,26 @@ impl Ast1060I2c<'_, Y> { dma_buf.as_ptr() as u32 }; - // Arm the DMA engine (i2cm1c length + i2cm30 base addr). The guard - // tears the engine down automatically if we return before commit. - let dma = ArmedDma::arm_tx(self.mmio(), phy_addr, chunk_len); - - self.clear_interrupts(0xffff_ffff); - self.completion = false; - // Build command - let mut cmd = constants::AST_I2CM_PKT_EN - | constants::AST_I2CM_TX_CMD - | constants::AST_I2CM_TX_DMA_EN; + let mut cmd = I2cMasterCommand::packet() + .with(I2cCmd::Tx) + .with(I2cCmd::TxDma); if is_first { - cmd |= constants::ast_i2cm_pkt_addr(addr) | constants::AST_I2CM_START_CMD; + cmd = cmd.address(addr).with(I2cCmd::Start); } // Add STOP on last chunk (omitted when caller wants repeated-START) if is_last && stop { - cmd |= constants::AST_I2CM_STOP_CMD; + cmd = cmd.with(I2cCmd::Stop); } - self.regs().i2cm18().write(|w| unsafe { w.bits(cmd) }); - - match self.wait_completion(constants::DEFAULT_TIMEOUT_US) { - // STOP issued; the engine quiesced normally. - Ok(()) => dma.commit(), - // Timeout: `dma` drops here, soft-resetting the live engine. - Err(e) => return Err(e), - } + // Arm the DMA engine (i2cm1c length + i2cm30 base addr) and run the + // transaction; the guard tears the engine down on any error path. + ArmedDma::arm_tx(self, phy_addr, chunk_len).run(cmd)?; - let status = self.regs().i2cm14().read().bits(); - if status & constants::AST_I2CM_PKT_ERROR != 0 { - if status & constants::AST_I2CM_TX_NAK != 0 { + let status = I2cMasterStatus::read(&self.mmio.i2c); + if status.has(I2cStat::PktError) { + if status.has(I2cStat::TxNak) { return Err(I2cError::NoAcknowledge); } return Err(I2cError::Abnormal); @@ -578,37 +565,25 @@ impl Ast1060I2c<'_, Y> { dma_buf.as_ptr() as u32 }; - // Arm the DMA engine (i2cm1c length + i2cm34 base addr). The guard - // tears the engine down automatically if we return before commit. - let dma = ArmedDma::arm_rx(self.mmio(), phy_addr, chunk_len); - - self.clear_interrupts(0xffff_ffff); - self.completion = false; - // Build command - let mut cmd = constants::AST_I2CM_PKT_EN - | constants::AST_I2CM_RX_CMD - | constants::AST_I2CM_RX_DMA_EN; + let mut cmd = I2cMasterCommand::packet() + .with(I2cCmd::Rx) + .with(I2cCmd::RxDma); if is_first { - cmd |= constants::ast_i2cm_pkt_addr(addr) | constants::AST_I2CM_START_CMD; + cmd = cmd.address(addr).with(I2cCmd::Start); } if is_last { - cmd |= constants::AST_I2CM_RX_CMD_LAST | constants::AST_I2CM_STOP_CMD; + cmd = cmd.with(I2cCmd::RxLast).with(I2cCmd::Stop); } - self.regs().i2cm18().write(|w| unsafe { w.bits(cmd) }); - - match self.wait_completion(constants::DEFAULT_TIMEOUT_US) { - // STOP issued; the engine quiesced normally. - Ok(()) => dma.commit(), - // Timeout: `dma` drops here, soft-resetting the live engine. - Err(e) => return Err(e), - } + // Arm the DMA engine (i2cm1c length + i2cm34 base addr) and run the + // transaction; the guard tears the engine down on any error path. + ArmedDma::arm_rx(self, phy_addr, chunk_len).run(cmd)?; - let status = self.regs().i2cm14().read().bits(); - if status & constants::AST_I2CM_PKT_ERROR != 0 { - if status & constants::AST_I2CM_TX_NAK != 0 { + let status = I2cMasterStatus::read(&self.mmio.i2c); + if status.has(I2cStat::PktError) { + if status.has(I2cStat::TxNak) { return Err(I2cError::NoAcknowledge); } return Err(I2cError::Abnormal); diff --git a/target/ast10x0/peripherals/i2c/mod.rs b/target/ast10x0/peripherals/i2c/mod.rs index a81bcd916..9f7af8457 100644 --- a/target/ast10x0/peripherals/i2c/mod.rs +++ b/target/ast10x0/peripherals/i2c/mod.rs @@ -68,6 +68,7 @@ mod master; mod recovery; mod registers; mod slave; +mod subsystem; mod timing; mod transfer; mod types; @@ -79,6 +80,7 @@ pub use error::I2cError; pub use global::init_i2c_global; pub use registers::Ast1060I2cRegisters; pub use slave::{SlaveBuffer, SlaveConfig, SlaveEvent}; +pub use subsystem::bringup; pub use types::*; // Re-export HAL implementations for external use diff --git a/target/ast10x0/peripherals/i2c/recovery.rs b/target/ast10x0/peripherals/i2c/recovery.rs index ca4797aab..0759e636e 100644 --- a/target/ast10x0/peripherals/i2c/recovery.rs +++ b/target/ast10x0/peripherals/i2c/recovery.rs @@ -3,46 +3,45 @@ //! Bus recovery implementation +use super::constants::{I2cMasterCommand, I2cMasterStatus, I2cStat}; use super::{constants, controller::Ast1060I2c, error::I2cError}; impl Ast1060I2c<'_, Y> { /// Recover the I2C bus from stuck condition pub fn recover_bus(&mut self) -> Result<(), I2cError> { // Disable master and slave functionality - self.regs() - .i2cc00() - .modify(|_, w| w.enbl_master_fn().clear_bit().enbl_slave_fn().clear_bit()); + let v = self.mmio.i2c.read_reg(constants::I2CC00); + self.mmio.i2c.write_reg( + constants::I2CC00, + v & !(constants::AST_I2CC_MASTER_EN | constants::AST_I2CC_SLAVE_EN), + ); // Enable master functionality - self.regs() - .i2cc00() - .modify(|_, w| w.enbl_master_fn().set_bit()); + self.mmio.i2c.modify_field(constants::I2CC00, 0, 1, 1); // Clear all interrupts - self.clear_interrupts(0xffff_ffff); + self.clear_interrupts(I2cMasterStatus::all()); // Check SDA/SCL state before attempting recovery // Only recover if SDA is stuck low while SCL is high - let line_status = self.regs().i2cc08().read(); - if line_status.sampled_sdaline_state().bit() || !line_status.sampled_sclline_state().bit() { + let line_status = self.mmio.i2c.read_reg(constants::I2CC08); + if (line_status >> 17) & 1 != 0 || (line_status >> 18) & 1 == 0 { // SDA is not stuck low, or SCL is also stuck - can't recover this way return Err(I2cError::BusRecoveryFailed); } // Issue bus recovery command via I2CM18 (command register) - self.regs() - .i2cm18() - .modify(|_, w| w.enbl_bus_recover_cmd().set_bit()); + I2cMasterCommand::recover(&self.mmio.i2c); // Wait for recovery completion let mut timeout = 100_000; // 100ms while timeout > 0 { - let status = self.regs().i2cm14().read().bits(); + let status = I2cMasterStatus::read(&self.mmio.i2c); - if status & constants::AST_I2CM_BUS_RECOVER != 0 { - self.clear_interrupts(constants::AST_I2CM_BUS_RECOVER); + if status.has(I2cStat::BusRecover) { + self.clear_interrupts(I2cMasterStatus::flag(I2cStat::BusRecover)); - if status & constants::AST_I2CM_BUS_RECOVER_FAIL != 0 { + if status.has(I2cStat::BusRecoverFail) { return Err(I2cError::BusRecoveryFailed); } @@ -58,11 +57,11 @@ impl Ast1060I2c<'_, Y> { /// Check if bus recovery is needed #[must_use] pub fn needs_recovery(&self) -> bool { - let status = self.regs().i2cm14().read().bits(); + let status = I2cMasterStatus::read(&self.mmio.i2c); // Check for stuck conditions - (status & constants::AST_I2CM_SCL_LOW_TO != 0) - || (status & constants::AST_I2CM_SDA_DL_TO != 0) - || (status & constants::AST_I2CM_ABNORMAL != 0) + status.has(I2cStat::SclLowTo) + || status.has(I2cStat::SdaDlTo) + || status.has(I2cStat::Abnormal) } } diff --git a/target/ast10x0/peripherals/i2c/registers.rs b/target/ast10x0/peripherals/i2c/registers.rs index 09db9a0cb..77ff3196d 100644 --- a/target/ast10x0/peripherals/i2c/registers.rs +++ b/target/ast10x0/peripherals/i2c/registers.rs @@ -1,68 +1,47 @@ // Licensed under the Apache-2.0 license // SPDX-License-Identifier: Apache-2.0 -//! Confined-`unsafe` MMIO façade for the AST1060 I2C controller. -//! -//! Sibling of `target/ast10x0/peripherals/hace/registers.rs` — the catalog -//! reference for the *Confined-`unsafe` MMIO Façade* pattern. All `unsafe` -//! required to touch the I2C and I2CBUFF register blocks is confined here: -//! one `unsafe fn new` (the entire perimeter, discharged once by the caller) -//! and one private deref per block (`i2c()`, `buff()`). The driver state -//! machine (`controller`/`master`/`slave`/…) reaches hardware **only** through -//! these two safe accessors, so no driver code constructs a raw register -//! pointer. +//! Confined-`unsafe` MMIO façade for the AST1060 I2C controller: two macro-generated `Mmio` +//! appliers (I2C + I2CBUFF). Drivers call the generic ops with offset constants; no hand-written `unsafe`. -use core::marker::PhantomData; +use super::{Ast1060I2c, I2cConfig, I2cError}; +use crate::Mmio; +use openprot_hal::i2c::{i2c_mmios, I2cBlock, I2cBuffBlock, I2cController, I2cScl, I2cSda}; +use openprot_hal::resource::Routes; -use ast1060_pac::{i2c::RegisterBlock, i2cbuff::RegisterBlock as BuffRegisterBlock}; +fn spin(_ns: u32) { + core::hint::spin_loop(); +} + +/// The controller-open seam lives with the driver: bring up the registers (pins are already muxed by +/// the bus constructor), then hand back the ready driver. Open-once is the owning `I2cBus`'s `self`. +impl I2cController for Ast1060I2cRegisters { + type Config = I2cConfig; + type Ready = Ast1060I2c<'static, fn(u32)>; + type Error = I2cError; + + fn open(self, config: &I2cConfig) -> Result { + Ast1060I2c::new(self, config, spin as fn(u32)) + } +} -/// Safe façade over one AST1060 controller's `(I2C, I2CBUFF)` register pair. +/// Safe façade over one controller's `(I2C, I2CBUFF)` register pair — two confined MMIO appliers. +/// Both `Mmio`s already impl `RegBlock`, so drivers touch them directly (`.i2c`/`.buff`), no forwarders. /// -/// `Copy` and pointer-only by design (per the pattern): it *confines* -/// `unsafe` and *restricts threading*; it does **not** enforce exclusive -/// access — that is delegated to the gate's caller and to the owning -/// `Ast1060I2c` (one instance per bus, every op an `&mut` borrow). +/// `Copy`, deliberately: the two appliers are stateless base pointers, and exclusivity of the +/// controller is enforced upstream by the bus owning both (non-`Copy`, mint-once) pin tokens. The +/// per-op driver in the backend re-derives a transient view from this façade under `&mut self`. #[derive(Copy, Clone)] pub struct Ast1060I2cRegisters { - i2c: *mut RegisterBlock, - buff: *mut BuffRegisterBlock, - /// `*mut` ⇒ `!Send`/`!Sync`: the register pointers cannot be shared - /// across threads without explicit synchronization. - _not_send: PhantomData<*mut ()>, + pub(crate) i2c: Mmio, + pub(crate) buff: Mmio, } impl Ast1060I2cRegisters { - /// The **entire** `unsafe` perimeter for AST1060 I2C MMIO — discharged - /// exactly once, here, by the caller. - /// - /// # Safety - /// - /// - `i2c` and `buff` are valid, non-null pointers to the I2C and - /// I2CBUFF register blocks of the **same** controller, and remain - /// valid for the lifetime of every `Ast1060I2c` built from this value. - /// - Access to the controller is serialized by the caller (the i2c - /// server owns one instance per bus; all ops are `&mut`). + /// Fabricate the façade from the bus's two pin tokens; the HAL helper const-asserts one controller and mints its two bases. #[must_use] - pub const unsafe fn new(i2c: *const RegisterBlock, buff: *const BuffRegisterBlock) -> Self { - Self { - i2c: i2c as *mut RegisterBlock, - buff: buff as *mut BuffRegisterBlock, - _not_send: PhantomData, - } - } - - /// Sole `unsafe` deref of the I2C block; justified by `new`'s invariant. - #[inline] - pub(crate) fn i2c(&self) -> &RegisterBlock { - // SAFETY: `new` guarantees a valid pointer for this value's lifetime; - // access is serialized by the owning `Ast1060I2c` (`&mut` per op). - unsafe { &*self.i2c } - } - - /// Sole `unsafe` deref of the I2CBUFF block; same justification as `i2c`. - #[inline] - pub(crate) fn buff(&self) -> &BuffRegisterBlock { - // SAFETY: see `i2c`. - unsafe { &*self.buff } + pub const fn from_pins, Sda: Routes>(scl: &Scl, sda: &Sda) -> Self { + let (i2c, buff) = i2c_mmios(scl, sda); + Self { i2c, buff } } } diff --git a/target/ast10x0/peripherals/i2c/slave.rs b/target/ast10x0/peripherals/i2c/slave.rs index 8b118e8bc..7dc42cffe 100644 --- a/target/ast10x0/peripherals/i2c/slave.rs +++ b/target/ast10x0/peripherals/i2c/slave.rs @@ -8,6 +8,7 @@ use super::I2cXferMode; +use super::constants::I2cMasterStatus; use super::{constants, controller::Ast1060I2c, error::I2cError}; /// Hardware buffer size (32 bytes / 8 DWORDs) @@ -125,16 +126,12 @@ impl Ast1060I2c<'_, Y> { #[inline] fn slave_rx_len(&self) -> usize { if self.xfer_mode == I2cXferMode::DmaMode { - self.regs().i2cs4c().read().dmarx_actual_len_byte().bits() as usize + ((self.mmio.i2c.read_reg(constants::I2CS4C) >> 16) & 0x1fff) as usize } else { // Hardware includes the I2C address byte in the buffer count (packet mode, // I2CC00 bit 20). Report the full count including that byte, consistent // with what slave_read returns. - self.regs() - .i2cc0c() - .read() - .actual_rxd_pool_buffer_size() - .bits() as usize + ((self.mmio.i2c.read_reg(constants::I2CC0C) >> 24) & 0x3f) as usize } } @@ -144,29 +141,27 @@ impl Ast1060I2c<'_, Y> { if let Some(dma_buf) = self.slave_dma_buf.as_deref_mut() { let dma_addr = dma_buf.as_mut_ptr() as u32; let dma_len = u16::try_from(dma_buf.len().min(4096) - 1).unwrap_or(u16::MAX); - unsafe { - self.regs().i2cs4c().write(|w| w.bits(0)); - self.regs().i2cs38().write(|w| w.bits(dma_addr)); - self.regs().i2cs3c().write(|w| w.bits(dma_addr)); - self.regs().i2cs2c().write(|w| { - w.dmarx_buf_len_byte() - .bits(dma_len) - .dmarx_buf_len_wr_enbl_for_cur_cmd() - .set_bit() - }); - } + self.mmio.i2c.write_reg(constants::I2CS4C, 0); + self.mmio.i2c.write_reg(constants::I2CS38, dma_addr); + self.mmio.i2c.write_reg(constants::I2CS3C, dma_addr); + self.mmio.i2c.write_reg( + constants::I2CS2C, + ((u32::from(dma_len) & 0xfff) << 16) | (1 << 31), + ); *cmd |= AST_I2CS_RX_DMA_EN; } else { *cmd |= constants::AST_I2CS_RX_BUFF_EN; - self.regs().i2cc0c().write(|w| unsafe { - w.rx_pool_buffer_size().bits(constants::I2C_BUF_SIZE - 1) - }); + self.mmio.i2c.write_reg( + constants::I2CC0C, + (u32::from(constants::I2C_BUF_SIZE - 1) & 0x1f) << 16, + ); } } else if self.xfer_mode == I2cXferMode::BufferMode { *cmd |= constants::AST_I2CS_RX_BUFF_EN; - self.regs() - .i2cc0c() - .write(|w| unsafe { w.rx_pool_buffer_size().bits(constants::I2C_BUF_SIZE - 1) }); + self.mmio.i2c.write_reg( + constants::I2CC0C, + (u32::from(constants::I2C_BUF_SIZE - 1) & 0x1f) << 16, + ); } else { *cmd &= !constants::AST_I2CS_PKT_MODE_EN; } @@ -177,18 +172,14 @@ impl Ast1060I2c<'_, Y> { // Disable master mode while the slave registers are programmed so the // shared controller is quiescent during setup; its prior state is // restored at the end so slave-only callers keep master off. - let master_was_enabled = self.regs().i2cc00().read().enbl_master_fn().bit(); - self.regs() - .i2cc00() - .modify(|_, w| w.enbl_master_fn().clear_bit()); + let master_was_enabled = self.mmio.i2c.read_bit(constants::I2CC00, 0); + self.mmio.i2c.modify_field(constants::I2CC00, 0, 1, 0); // Set slave address - self.regs().i2cs40().write(|w| unsafe { - w.slave_dev_addr1() - .bits(config.address) - .enbl_slave_dev_addr1only_for_new_reg_mode() - .bit(true) - }); + self.mmio.i2c.write_reg( + constants::I2CS40, + (u32::from(config.address) & 0x7f) | (1 << 7), + ); // Clear slave interrupts self.clear_slave_interrupts(); @@ -196,11 +187,11 @@ impl Ast1060I2c<'_, Y> { // Enable slave mode and save address byte in packet mode (I2CC00 bit 20) // This makes the hardware include the destination address byte in the receive buffer // which is required for MCTP-over-SMBus (DSP0237) packet format. - self.regs().i2cc00().modify(|r, w| unsafe { - w.bits( - r.bits() | constants::AST_I2CC_SLAVE_EN | constants::AST_I2CC_SLAVE_PKT_SAVE_ADDR, - ) - }); + let v = self.mmio.i2c.read_reg(constants::I2CC00); + self.mmio.i2c.write_reg( + constants::I2CC00, + v | constants::AST_I2CC_SLAVE_EN | constants::AST_I2CC_SLAVE_PKT_SAVE_ADDR, + ); // Configure slave mode let mut cmd = 0u32; @@ -212,9 +203,10 @@ impl Ast1060I2c<'_, Y> { if self.xfer_mode == I2cXferMode::BufferMode { cmd |= constants::AST_I2CS_RX_BUFF_EN; - self.regs() - .i2cc0c() - .write(|w| unsafe { w.rx_pool_buffer_size().bits(constants::I2C_BUF_SIZE - 1) }); + self.mmio.i2c.write_reg( + constants::I2CC0C, + (u32::from(constants::I2C_BUF_SIZE - 1) & 0x1f) << 16, + ); } else if self.xfer_mode == I2cXferMode::DmaMode { if let Some(dma_buf) = self.slave_dma_buf.as_deref_mut() { // Arm slave DMA: point hardware at the non-cached buffer and enable RX_DMA. @@ -223,32 +215,27 @@ impl Ast1060I2c<'_, Y> { // i2cs2c sets the DMA receive length and enables the length register. let dma_addr = dma_buf.as_mut_ptr() as u32; let dma_len = u16::try_from(dma_buf.len().min(4096) - 1).unwrap_or(u16::MAX); - unsafe { - self.regs().i2cs38().write(|w| w.bits(dma_addr)); - self.regs().i2cs3c().write(|w| w.bits(dma_addr)); - self.regs().i2cs2c().write(|w| { - w.dmarx_buf_len_byte() - .bits(dma_len) - .dmarx_buf_len_wr_enbl_for_cur_cmd() - .set_bit() - }); - } + self.mmio.i2c.write_reg(constants::I2CS38, dma_addr); + self.mmio.i2c.write_reg(constants::I2CS3C, dma_addr); + self.mmio.i2c.write_reg( + constants::I2CS2C, + ((u32::from(dma_len) & 0xfff) << 16) | (1 << 31), + ); cmd |= AST_I2CS_RX_DMA_EN; } else { // No DMA buffer provided — fall back to buffer mode. cmd |= constants::AST_I2CS_RX_BUFF_EN; - self.regs().i2cc0c().write(|w| unsafe { - w.rx_pool_buffer_size().bits(constants::I2C_BUF_SIZE - 1) - }); + self.mmio.i2c.write_reg( + constants::I2CC0C, + (u32::from(constants::I2C_BUF_SIZE - 1) & 0x1f) << 16, + ); } } else { cmd &= !constants::AST_I2CS_PKT_MODE_EN; } // Set slave command register - unsafe { - self.regs().i2cs28().write(|w| w.bits(cmd)); - } + self.mmio.i2c.write_reg(constants::I2CS28, cmd); // Enable slave interrupts self.enable_slave_interrupts(); @@ -256,9 +243,7 @@ impl Ast1060I2c<'_, Y> { // Restore master mode to its prior state: dual master+slave callers // (e.g. MCTP) get it back on; slave-only callers keep it off. if master_was_enabled { - self.regs() - .i2cc00() - .modify(|_, w| w.enbl_master_fn().set_bit()); + self.mmio.i2c.modify_field(constants::I2CC00, 0, 1, 1); } Ok(()) @@ -274,17 +259,13 @@ impl Ast1060I2c<'_, Y> { | constants::AST_I2CM_TX_ACK; } - unsafe { - self.regs().i2cs20().write(|w| w.bits(mask)); - } + self.mmio.i2c.write_reg(constants::I2CS20, mask); } /// Clear slave mode interrupts fn clear_slave_interrupts(&mut self) { - unsafe { - self.regs().i2cs24().write(|w| w.bits(0xFFFF_FFFF)); - let _ = self.regs().i2cs24().read().bits(); - } + self.mmio.i2c.write_reg(constants::I2CS24, 0xFFFF_FFFF); + let _ = self.mmio.i2c.read_reg(constants::I2CS24); } /// Enable slave mode (re-enable after disable) @@ -293,9 +274,7 @@ impl Ast1060I2c<'_, Y> { /// Use `configure_slave()` for initial setup, this for re-enabling after `disable_slave()`. pub fn enable_slave(&mut self) { // Enable slave mode - self.regs() - .i2cc00() - .modify(|_, w| w.enbl_slave_fn().set_bit()); + self.mmio.i2c.modify_field(constants::I2CC00, 1, 1, 1); // Enable slave interrupts self.enable_slave_interrupts(); @@ -304,23 +283,19 @@ impl Ast1060I2c<'_, Y> { /// Disable slave mode pub fn disable_slave(&mut self) { // Disable interrupts - unsafe { - self.regs().i2cs20().write(|w| w.bits(0)); - } + self.mmio.i2c.write_reg(constants::I2CS20, 0); // Clear interrupts self.clear_slave_interrupts(); // Disable slave mode - self.regs() - .i2cc00() - .modify(|_, w| w.enbl_slave_fn().clear_bit()); + self.mmio.i2c.modify_field(constants::I2CC00, 1, 1, 0); } /// Check if slave has received data #[must_use] pub fn slave_has_data(&self) -> bool { - let status = self.regs().i2cs24().read().bits(); + let status = self.mmio.i2c.read_reg(constants::I2CS24); (status & constants::AST_I2CS_RX_DONE) != 0 } @@ -332,12 +307,7 @@ impl Ast1060I2c<'_, Y> { // address byte at buffer offset 0. Include it in the returned data; // callers that need the full SMBus frame (e.g. MctpI2cEncap::decode) // depend on it being present. - let raw = self - .regs() - .i2cc0c() - .read() - .actual_rxd_pool_buffer_size() - .bits() as usize; + let raw = ((self.mmio.i2c.read_reg(constants::I2CC0C) >> 24) & 0x3f) as usize; let to_read = raw.min(buffer.len()).min(BUFFER_SIZE); let mut tmp = [0u8; BUFFER_SIZE]; @@ -347,16 +317,14 @@ impl Ast1060I2c<'_, Y> { // Re-enable RX buffer let mut cmd = constants::AST_I2CS_ACTIVE_ALL | constants::AST_I2CS_PKT_MODE_EN; cmd |= constants::AST_I2CS_RX_BUFF_EN; - unsafe { - self.regs().i2cs28().write(|w| w.bits(cmd)); - } + self.mmio.i2c.write_reg(constants::I2CS28, cmd); Ok(to_read) } else if self.xfer_mode == I2cXferMode::DmaMode { // DMA mode: the hardware has already DMA'd into `self.dma_buf`. // AST_I2CC_SLAVE_PKT_SAVE_ADDR deposits the address byte at dma_buf[0]; // include it in the returned data (matches buffer-mode treatment above). - let hw_len = self.regs().i2cs4c().read().dmarx_actual_len_byte().bits() as usize; + let hw_len = ((self.mmio.i2c.read_reg(constants::I2CS4C) >> 16) & 0x1fff) as usize; let to_read = hw_len.min(buffer.len()); if let Some(dma_buf) = self.slave_dma_buf.as_deref() { @@ -372,35 +340,29 @@ impl Ast1060I2c<'_, Y> { if let Some(dma_buf) = self.slave_dma_buf.as_deref_mut() { let dma_addr = dma_buf.as_mut_ptr() as u32; let dma_len = u16::try_from(dma_buf.len().min(4096) - 1).unwrap_or(u16::MAX); - unsafe { - self.regs().i2cs4c().write(|w| w.bits(0)); - self.regs().i2cs38().write(|w| w.bits(dma_addr)); - self.regs().i2cs3c().write(|w| w.bits(dma_addr)); - self.regs().i2cs2c().write(|w| { - w.dmarx_buf_len_byte() - .bits(dma_len) - .dmarx_buf_len_wr_enbl_for_cur_cmd() - .set_bit() - }); - } + self.mmio.i2c.write_reg(constants::I2CS4C, 0); + self.mmio.i2c.write_reg(constants::I2CS38, dma_addr); + self.mmio.i2c.write_reg(constants::I2CS3C, dma_addr); + self.mmio.i2c.write_reg( + constants::I2CS2C, + ((u32::from(dma_len) & 0xfff) << 16) | (1 << 31), + ); cmd |= AST_I2CS_RX_DMA_EN; } else { cmd |= constants::AST_I2CS_RX_BUFF_EN; } - unsafe { - self.regs().i2cs28().write(|w| w.bits(cmd)); - } + self.mmio.i2c.write_reg(constants::I2CS28, cmd); Ok(to_read) } else { // byte mode - let byte = self.regs().i2cc08().read().rx_byte_buffer().bits(); + let byte = ((self.mmio.i2c.read_reg(constants::I2CC08) >> 8) & 0xff) as u8; if let Some(slot) = buffer.get_mut(0) { *slot = byte; } let cmd = constants::AST_I2CS_ACTIVE_ALL; - self.regs().i2cs28().write(|w| unsafe { w.bits(cmd) }); + self.mmio.i2c.write_reg(constants::I2CS28, cmd); self.clear_slave_interrupts(); Ok(1) @@ -421,16 +383,14 @@ impl Ast1060I2c<'_, Y> { // Set transfer length #[allow(clippy::cast_possible_truncation)] - self.regs() - .i2cc0c() - .write(|w| unsafe { w.tx_data_byte_count().bits((to_write - 1) as u8) }); + self.mmio + .i2c + .write_reg(constants::I2CC0C, ((to_write as u32 - 1) & 0x1f) << 8); // Arm TX and keep RX armed in one atomic i2cs28 write. let mut cmd = constants::AST_I2CS_ACTIVE_ALL | constants::AST_I2CS_PKT_MODE_EN; cmd |= constants::AST_I2CS_TX_BUFF_EN | constants::AST_I2CS_RX_BUFF_EN; - unsafe { - self.regs().i2cs28().write(|w| w.bits(cmd)); - } + self.mmio.i2c.write_reg(constants::I2CS28, cmd); Ok(to_write) } else if self.xfer_mode == I2cXferMode::DmaMode { // Slave TX always uses the 32-byte hardware FIFO, even in DMA mode. @@ -440,27 +400,23 @@ impl Ast1060I2c<'_, Y> { let to_write = data.len().min(BUFFER_SIZE); self.copy_to_buffer(&data[..to_write])?; #[allow(clippy::cast_possible_truncation)] - self.regs() - .i2cc0c() - .write(|w| unsafe { w.tx_data_byte_count().bits((to_write - 1) as u8) }); + self.mmio + .i2c + .write_reg(constants::I2CC0C, ((to_write as u32 - 1) & 0x1f) << 8); // Arm TX via FIFO and keep RX DMA armed in one atomic i2cs28 write. let mut cmd = constants::AST_I2CS_ACTIVE_ALL | constants::AST_I2CS_PKT_MODE_EN; cmd |= constants::AST_I2CS_TX_BUFF_EN | AST_I2CS_RX_DMA_EN; - unsafe { - self.regs().i2cs28().write(|w| w.bits(cmd)); - } + self.mmio.i2c.write_reg(constants::I2CS28, cmd); Ok(to_write) } else { // byte mode let cmd = constants::AST_I2CS_ACTIVE_ALL | constants::AST_I2CS_TX_CMD; - unsafe { - self.regs() - .i2cc08() - .write(|w| w.tx_byte_buffer().bits(data[0])); - self.regs().i2cs28().write(|w| w.bits(cmd)); - } + self.mmio + .i2c + .write_reg(constants::I2CC08, u32::from(data[0])); + self.mmio.i2c.write_reg(constants::I2CS28, cmd); self.clear_slave_interrupts(); Ok(1) @@ -470,16 +426,14 @@ impl Ast1060I2c<'_, Y> { /// Handle slave mode interrupt #[allow(clippy::too_many_lines)] pub fn handle_slave_interrupt(&mut self) -> Option { - let status = self.regs().i2cs24().read().bits(); + let status = self.mmio.i2c.read_reg(constants::I2CS24); if status == 0 { // Master status register i2cm14 retains bits after a master operation // and keeps the shared IRQ line asserted. Clear it here to stop the storm. - let m14 = self.regs().i2cm14().read().bits(); - if m14 != 0 { - unsafe { - self.regs().i2cm14().write(|w| w.bits(m14)); - } + let m14 = I2cMasterStatus::read(&self.mmio.i2c); + if m14.raw() != 0 { + m14.clear(&self.mmio.i2c); } return None; } @@ -492,11 +446,9 @@ impl Ast1060I2c<'_, Y> { if (status & constants::AST_I2CS_PKT_DONE) != 0 { let mut cmd: u32 = constants::AST_I2CS_ACTIVE_ALL | constants::AST_I2CS_PKT_MODE_EN; - unsafe { - self.regs() - .i2cs24() - .write(|w| w.bits(constants::AST_I2CS_PKT_DONE)); - } + self.mmio + .i2c + .write_reg(constants::I2CS24, constants::AST_I2CS_PKT_DONE); let sts = status & (!(constants::AST_I2CS_PKT_DONE | constants::AST_I2CS_PKT_ERROR)); if sts == constants::AST_I2CS_SLAVE_MATCH || sts == constants::AST_I2CS_SLAVE_MATCH | constants::AST_I2CS_RX_DONE @@ -511,18 +463,14 @@ impl Ast1060I2c<'_, Y> { { // S: Sw|D self.arm_slave_receive(&mut cmd); - unsafe { - self.regs().i2cs28().write(|w| w.bits(cmd)); - } + self.mmio.i2c.write_reg(constants::I2CS28, cmd); return Some(SlaveEvent::DataReceived { len: self.slave_rx_len(), }); } else if sts == constants::AST_I2CS_SLAVE_MATCH | constants::AST_I2CS_STOP { // S: Sw|P self.arm_slave_receive(&mut cmd); - unsafe { - self.regs().i2cs28().write(|w| w.bits(cmd)); - } + self.mmio.i2c.write_reg(constants::I2CS28, cmd); return Some(SlaveEvent::Stop); } else if sts == constants::AST_I2CS_RX_DONE | constants::AST_I2CS_STOP || sts == constants::AST_I2CS_RX_DONE | constants::AST_I2CS_WAIT_RX_DMA @@ -562,19 +510,18 @@ impl Ast1060I2c<'_, Y> { // S: rx_done | wait_tx return Some(SlaveEvent::DataReceivedAndSent { rx_len: self.slave_rx_len(), - tx_len: usize::from( - self.regs().i2cc0c().read().tx_data_byte_count().bits() + 1, - ), + tx_len: (((self.mmio.i2c.read_reg(constants::I2CC0C) >> 8) & 0x1f) + 1) + as usize, }); } else if sts == constants::AST_I2CS_SLAVE_MATCH | constants::AST_I2CS_WAIT_TX_DMA { // S: Sw | wait_tx return Some(SlaveEvent::DataSent { - len: usize::from(self.regs().i2cc0c().read().tx_data_byte_count().bits() + 1), + len: (((self.mmio.i2c.read_reg(constants::I2CC0C) >> 8) & 0x1f) + 1) as usize, }); } else if sts == constants::AST_I2CS_WAIT_TX_DMA { // S: wait_tx return Some(SlaveEvent::DataSent { - len: usize::from(self.regs().i2cc0c().read().tx_data_byte_count().bits() + 1), + len: (((self.mmio.i2c.read_reg(constants::I2CC0C) >> 8) & 0x1f) + 1) as usize, }); } else if sts == constants::AST_I2CS_TX_NAK | constants::AST_I2CS_STOP || sts == constants::AST_I2CS_STOP @@ -585,9 +532,7 @@ impl Ast1060I2c<'_, Y> { { // S: (Sr) (TX_NAK)|P — master read completed with NAK then STOP self.arm_slave_receive(&mut cmd); - unsafe { - self.regs().i2cs28().write(|w| w.bits(cmd)); - } + self.mmio.i2c.write_reg(constants::I2CS28, cmd); return Some(SlaveEvent::Stop); } else { // TODO packet slave sts @@ -602,10 +547,9 @@ impl Ast1060I2c<'_, Y> { | constants::AST_I2CS_WAIT_RX_DMA { // S: Sw|D - let _byte_data = self.regs().i2cc08().read().rx_byte_buffer().bits(); - self.regs().i2cs28().write(|w| unsafe { w.bits(cmd) }); - self.regs().i2cs24().write(|w| unsafe { w.bits(status) }); - self.regs().i2cs24().read().bits(); + let _byte_data = ((self.mmio.i2c.read_reg(constants::I2CC08) >> 8) & 0xff) as u8; + self.mmio.i2c.write_reg(constants::I2CS28, cmd); + self.mmio.i2c.write_reg(constants::I2CS24, status); return Some(SlaveEvent::WriteRequest); } else if status == constants::AST_I2CS_SLAVE_MATCH @@ -620,9 +564,9 @@ impl Ast1060I2c<'_, Y> { | constants::AST_I2CS_STOP { // S: Sw|D|P - let _byte_data = self.regs().i2cc08().read().rx_byte_buffer().bits(); - self.regs().i2cs28().write(|w| unsafe { w.bits(cmd) }); - self.regs().i2cs24().write(|w| unsafe { w.bits(status) }); + let _byte_data = ((self.mmio.i2c.read_reg(constants::I2CC08) >> 8) & 0xff) as u8; + self.mmio.i2c.write_reg(constants::I2CS28, cmd); + self.mmio.i2c.write_reg(constants::I2CS24, status); return Some(SlaveEvent::WriteRequest); } else if status == constants::AST_I2CS_RX_DONE | constants::AST_I2CS_WAIT_RX_DMA { // S: rD @@ -634,7 +578,7 @@ impl Ast1060I2c<'_, Y> { { // S: Sr|D // received one byte - let _byte_data = self.regs().i2cc08().read().rx_byte_buffer().bits(); + let _byte_data = ((self.mmio.i2c.read_reg(constants::I2CC08) >> 8) & 0xff) as u8; return Some(SlaveEvent::DataSent { len: 1 }); } else if status == constants::AST_I2CS_TX_ACK | constants::AST_I2CS_WAIT_TX_DMA { // S: tD @@ -652,8 +596,8 @@ impl Ast1060I2c<'_, Y> { | constants::AST_I2CS_TX_NAK { // S: P - self.regs().i2cs28().write(|w| unsafe { w.bits(cmd) }); - self.regs().i2cs24().write(|w| unsafe { w.bits(status) }); + self.mmio.i2c.write_reg(constants::I2CS28, cmd); + self.mmio.i2c.write_reg(constants::I2CS24, status); return Some(SlaveEvent::Stop); } // TODO byte slave sts diff --git a/target/ast10x0/peripherals/i2c/subsystem.rs b/target/ast10x0/peripherals/i2c/subsystem.rs new file mode 100644 index 000000000..972f96a51 --- /dev/null +++ b/target/ast10x0/peripherals/i2c/subsystem.rs @@ -0,0 +1,24 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Shared I2C subsystem bring-up: the one home for the clock/reset/global sequence and the I2C SCU +//! bit layout. It runs once for the whole subsystem — the block reset clobbers every controller. + +use crate::scu::{ClockRegisterHalf, ScuRegisterHalf, ScuRegisters}; + +/// Shared I2C clock enable — Group 0 (lower clock-stop half), bit 2. +const I2C_CLOCK_BIT: u32 = 1 << 2; +/// Shared I2C block reset — upper reset-control half, bit 2. +const I2C_RESET_BIT: u32 = 1 << 2; + +/// Bring up the shared I2C subsystem (ungate clock, cycle block reset, configure globals), consuming +/// the caller's already-unlocked SCU handle — the authority — so no second unlock is needed. +pub fn bringup(scu: ScuRegisters, mut delay_us: impl FnMut(u32)) { + scu.ungate_clock_mask(ClockRegisterHalf::Lower, I2C_CLOCK_BIT); + scu.assert_reset_mask(ScuRegisterHalf::Upper, I2C_RESET_BIT); + delay_us(1000); + scu.deassert_reset_mask(ScuRegisterHalf::Upper, I2C_RESET_BIT); + delay_us(1000); + // SAFETY: clock is ungated and reset deasserted above — the precondition for global init. + unsafe { super::global::init_i2c_global() }; +} diff --git a/target/ast10x0/peripherals/i2c/timing.rs b/target/ast10x0/peripherals/i2c/timing.rs index ddcc7893c..afc2a7032 100644 --- a/target/ast10x0/peripherals/i2c/timing.rs +++ b/target/ast10x0/peripherals/i2c/timing.rs @@ -44,9 +44,10 @@ //! - `base_clk2` (0x08): 50M / ((8+2)/2) = 10 `MHz` → 400 kHz with div=25 //! - `base_clk3` (0x22): 50M / ((34+2)/2) = 2.77 `MHz` → 100 kHz with div=28 +use super::constants; use super::error::I2cError; use super::types::{ClockConfig, I2cConfig, I2cSpeed}; -use ast1060_pac::i2c::RegisterBlock; +use crate::Mmio; use core::cmp::min; /// Maximum divider ratio per base clock @@ -72,7 +73,10 @@ const SPEED_FAST_PLUS: u32 = 1_000_000; /// /// * `Ok(())` on successful configuration /// * `Err(I2cError::Invalid)` if timing cannot be achieved -pub fn configure_timing(regs: &RegisterBlock, config: &I2cConfig) -> Result<(), I2cError> { +pub fn configure_timing( + regs: &Mmio, + config: &I2cConfig, +) -> Result<(), I2cError> { let clocks = &config.clock_config; // Step 1: Get target speed @@ -103,20 +107,13 @@ pub fn configure_timing(regs: &RegisterBlock, config: &I2cConfig) -> Result<(), // Step 5: Write AC timing register with all fields in a single write // This avoids corrupting fields with multiple separate writes - regs.i2cc04().write(|w| unsafe { - w.base_clk_divisor_tbase_clk() - .bits((div & 0xf) as u8) - .cycles_of_master_sclclklow_pulse_width_tcklow() - .bits(scl_low) - .cycles_of_master_sclclkhigh_pulse_width_tckhigh() - .bits(scl_high) - .cycles_of_master_sclclkhigh_minimum_pulse_width_tckhigh_min() - .bits(scl_high_min) - .timeout_base_clk_divisor_tout_base_clk() - .bits(timeout_divisor) - .timeout_timer() - .bits(timeout_timer) - }); + let val = (div & 0xf) + | ((u32::from(timeout_divisor) & 0x3) << 8) + | ((u32::from(scl_low) & 0xf) << 12) + | ((u32::from(scl_high) & 0xf) << 16) + | ((u32::from(scl_high_min) & 0xf) << 20) + | ((u32::from(timeout_timer) & 0x1f) << 24); + regs.write_reg(constants::I2CC04, val); Ok(()) } diff --git a/target/ast10x0/peripherals/i2c/transfer.rs b/target/ast10x0/peripherals/i2c/transfer.rs index 8694d973b..7f8fcfdef 100644 --- a/target/ast10x0/peripherals/i2c/transfer.rs +++ b/target/ast10x0/peripherals/i2c/transfer.rs @@ -7,6 +7,7 @@ //! are kept for potential future use or testing. The main byte/buffer mode logic //! is now in master.rs with inline command building for better control. +use super::constants::{I2cCmd, I2cMasterCommand, I2cMasterStatus}; use super::{constants, controller::Ast1060I2c, error::I2cError, types::I2cXferMode}; #[allow(dead_code)] @@ -34,7 +35,7 @@ impl Ast1060I2c<'_, Y> { self.completion = false; // Clear any previous status - self.clear_interrupts(0xffff_ffff); + self.clear_interrupts(I2cMasterStatus::all()); match self.xfer_mode { I2cXferMode::ByteMode => { @@ -53,28 +54,24 @@ impl Ast1060I2c<'_, Y> { /// Command register is i2cm18, data register is i2cc08. fn start_byte_mode(&mut self, addr: u8, is_read: bool, len: usize) { // Build command: packet mode + address + start - let mut cmd = constants::AST_I2CM_PKT_EN - | constants::ast_i2cm_pkt_addr(addr) - | constants::AST_I2CM_START_CMD; + let mut cmd = I2cMasterCommand::packet().address(addr).with(I2cCmd::Start); if is_read { - cmd |= constants::AST_I2CM_RX_CMD; + cmd = cmd.with(I2cCmd::Rx); // For last byte (or single byte), send NACK and STOP if len == 1 { - cmd |= constants::AST_I2CM_RX_CMD_LAST | constants::AST_I2CM_STOP_CMD; + cmd = cmd.with(I2cCmd::RxLast).with(I2cCmd::Stop); } } else { - cmd |= constants::AST_I2CM_TX_CMD; + cmd = cmd.with(I2cCmd::Tx); // For last byte (or single byte), send STOP if len == 1 { - cmd |= constants::AST_I2CM_STOP_CMD; + cmd = cmd.with(I2cCmd::Stop); } } // Issue command to i2cm18 (Master Command Register) - unsafe { - self.regs().i2cm18().write(|w| w.bits(cmd)); - } + cmd.issue(&self.mmio.i2c); } /// Start transfer in buffer mode (up to 32 bytes) @@ -90,36 +87,33 @@ impl Ast1060I2c<'_, Y> { #[allow(clippy::cast_possible_truncation)] if is_read { // Set RX buffer size (len - 1) - self.regs() - .i2cc0c() - .modify(|_, w| unsafe { w.rx_pool_buffer_size().bits((len - 1) as u8) }); + self.mmio + .i2c + .modify_field(constants::I2CC0C, 16, 0x1f, (len - 1) as u32); } else { // Set TX byte count (len - 1) - self.regs() - .i2cc0c() - .modify(|_, w| unsafe { w.tx_data_byte_count().bits((len - 1) as u8) }); + self.mmio + .i2c + .modify_field(constants::I2CC0C, 8, 0x1f, (len - 1) as u32); } // Build command: PKT_EN + address + START + TX/RX + BUFF_EN + STOP - let mut cmd = constants::AST_I2CM_PKT_EN - | constants::ast_i2cm_pkt_addr(addr) - | constants::AST_I2CM_START_CMD; + let mut cmd = I2cMasterCommand::packet().address(addr).with(I2cCmd::Start); if is_read { - cmd |= constants::AST_I2CM_RX_CMD - | constants::AST_I2CM_RX_BUFF_EN - | constants::AST_I2CM_RX_CMD_LAST; + cmd = cmd + .with(I2cCmd::Rx) + .with(I2cCmd::RxBuff) + .with(I2cCmd::RxLast); } else { - cmd |= constants::AST_I2CM_TX_CMD | constants::AST_I2CM_TX_BUFF_EN; + cmd = cmd.with(I2cCmd::Tx).with(I2cCmd::TxBuff); } // Add stop for last chunk - cmd |= constants::AST_I2CM_STOP_CMD; + cmd = cmd.with(I2cCmd::Stop); // Issue command to i2cm18 (Master Command Register) - single write - unsafe { - self.regs().i2cm18().write(|w| w.bits(cmd)); - } + cmd.issue(&self.mmio.i2c); Ok(()) } @@ -130,7 +124,6 @@ impl Ast1060I2c<'_, Y> { return Err(I2cError::Invalid); } - let buff_regs = self.buff_regs(); let mut idx = 0; while idx < data.len() { @@ -148,9 +141,7 @@ impl Ast1060I2c<'_, Y> { } // Write to buffer register array (AST1060 has 8 DWORDs = 32 bytes) - unsafe { - buff_regs.buff(dword_idx).write(|w| w.bits(dword)); - } + self.mmio.buff.write_reg((dword_idx as u32) * 4, dword); idx += 4; } @@ -164,7 +155,6 @@ impl Ast1060I2c<'_, Y> { return Err(I2cError::Invalid); } - let buff_regs = self.buff_regs(); let mut idx = 0; while idx < data.len() { @@ -174,7 +164,7 @@ impl Ast1060I2c<'_, Y> { } // Read from buffer register array - let dword = buff_regs.buff(dword_idx).read().bits(); + let dword = self.mmio.buff.read_reg((dword_idx as u32) * 4); // Extract bytes from DWORD (little-endian) for byte_pos in 0..4 { diff --git a/target/ast10x0/peripherals/lib.rs b/target/ast10x0/peripherals/lib.rs index f7b1bc764..5899605c3 100644 --- a/target/ast10x0/peripherals/lib.rs +++ b/target/ast10x0/peripherals/lib.rs @@ -2,7 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 #![no_std] +#![feature(associated_type_defaults)] +#![feature(adt_const_params)] +/// The HAL's confined MMIO applier, re-exported so `crate::Mmio` resolves target-wide. +pub use openprot_hal::field_mux::Mmio; + +pub mod aperture; pub mod gpio; pub mod hace; pub mod i2c; @@ -13,3 +19,6 @@ pub mod sgpiom; pub mod smc; pub mod spimonitor; pub mod uart; + +/// The chip's pin universe, created once at boot — re-exported so apps need no `scu` import for pins. +pub use scu::{create_pins, PinTokens}; diff --git a/target/ast10x0/peripherals/scu/mod.rs b/target/ast10x0/peripherals/scu/mod.rs index bd5cdcf02..cd0fb363b 100644 --- a/target/ast10x0/peripherals/scu/mod.rs +++ b/target/ast10x0/peripherals/scu/mod.rs @@ -6,13 +6,17 @@ pub mod cache; pub mod clock; pub mod pinctrl; +pub mod pinmux; +pub mod pins; pub mod registers; pub mod reset; pub mod routing; pub mod status; pub mod types; -pub use pinctrl::PinctrlPin; +pub use openprot_hal::resource::FieldWrite; +pub use pinmux::{apply_mux, route, PinctrlPin}; +pub use pins::{create_pins, scu414_30, scu414_31, scu418_0, scu418_1, PinTokens, I2C_CTRL}; pub use registers::ScuRegisters; pub use routing::SpimGpioOriVal; pub use types::{ diff --git a/target/ast10x0/peripherals/scu/pinctrl.rs b/target/ast10x0/peripherals/scu/pinctrl.rs index 8e0590062..e98cfbb33 100644 --- a/target/ast10x0/peripherals/scu/pinctrl.rs +++ b/target/ast10x0/peripherals/scu/pinctrl.rs @@ -1,25 +1,17 @@ // Licensed under the Apache-2.0 license // SPDX-License-Identifier: Apache-2.0 +//! DEPRECATED: legacy runtime-match pin muxing; new peripherals use `pins!`/`Routes::DATA` + `apply_mux`. +//! //! SCU Pin Control (Pinctrl) for multi-function pin configuration. //! //! Provides register-level access to configure AST1060 pins for different //! functions (I2C, I3C, GPIO, etc.) via SCU multiplex registers. +use super::pinmux::PinctrlPin; use super::ScuRegisters; use paste::paste; -/// Describes a single pin configuration operation. -#[derive(Clone, Copy, Debug)] -pub struct PinctrlPin { - /// SCU register offset (0x410, 0x414, 0x690, etc.) - pub offset: u32, - /// Bit position within the register (0-31) - pub bit: u32, - /// true = clear bit, false = set bit - pub clear: bool, -} - /// Macro to generate paired pin constants for set/clear operations. macro_rules! gen_pin_pairs { ($reg_name:ident, $offset:expr, $bit:expr) => { diff --git a/target/ast10x0/peripherals/scu/pinmux.rs b/target/ast10x0/peripherals/scu/pinmux.rs new file mode 100644 index 000000000..63bddd945 --- /dev/null +++ b/target/ast10x0/peripherals/scu/pinmux.rs @@ -0,0 +1,49 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! SCU routing: `apply_mux` flushes the boot pin-mux (each pin's authored route) in one panic-free pass. + +use super::pins::ScuBlock; +use super::registers::unlock_scu_writes; +use crate::Mmio; +use openprot_hal::field_mux::MuxRoutes; +use openprot_hal::resource::FieldWrite; + +/// DEPRECATED: legacy per-pin mux datum for `apply_pinctrl_group`; superseded by `FieldWrite` + `RegBatch`. +/// Describes a single pin mux operation: which SCU register bit to set (or clear). +#[derive(Clone, Copy, Debug)] +pub struct PinctrlPin { + /// SCU register offset (0x410, 0x414, 0x690, etc.) + pub offset: u32, + /// Bit position within the register (0-31) + pub bit: u32, + /// true = clear bit, false = set bit + pub clear: bool, +} + +impl PinctrlPin { + /// Route a pin by setting its mux bit: the fact a `pins!` row states inline. + #[must_use] + pub const fn new(offset: u32, bit: u32) -> Self { + Self { + offset, + bit, + clear: false, + } + } +} + +/// Flush the compile-time-coalesced pin-mux to the SCU in one panic-free pass — one RMW per distinct register. +pub fn apply_mux(mux: &[FieldWrite]) { + let scu = Mmio::::block(); + unlock_scu_writes(&scu); + openprot_hal::field_mux::apply(&scu, mux); +} + +/// Route the whole board in one call: hand *every* pin handle as a single tuple so all routes fold to one RMW per register at compile time — call this exactly once per board. +pub fn route(_handle: &H) { + let scu = Mmio::::block(); + unlock_scu_writes(&scu); + // HACK: full MAX_REGS-wide COALESCED lands in rodata; exact-N trim dropped to shed generic_const_exprs. + openprot_hal::field_mux::apply(&scu, const { &H::COALESCED }.as_slice()); +} diff --git a/target/ast10x0/peripherals/scu/pins.rs b/target/ast10x0/peripherals/scu/pins.rs new file mode 100644 index 000000000..f8dd1accc --- /dev/null +++ b/target/ast10x0/peripherals/scu/pins.rs @@ -0,0 +1,77 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The AST1060 pin universe: one owned ZST token per pad, with its capability role impls. +//! A SoC fact (same across all AST1060 boards), so it lives here, not in a board. + +use crate::gpio::{ABCD, EFGH, IJKL}; +use ast1060_pac::{I2c, I2c1, I2c2, I2c3, I2cbuff, I2cbuff1, I2cbuff2, I2cbuff3}; +use openprot_hal::field_mux::Block; +use openprot_hal::gpio::{Gpio, GpioData}; +use openprot_hal::i2c::{I2cCtrlRegs, I2cData, I2cScl, I2cSda}; + +/// Block-identity marker for the AST10x0 SCU singleton register block (see `Mmio` in `field_mux`). +pub struct ScuBlock; + +// SAFETY: `Scu::ptr()` is the valid, aligned, `'static` SCU base, usable for `u32` MMIO at every offset its driver touches. +unsafe impl Block for ScuBlock { + const BASE: *const u8 = ast1060_pac::Scu::ptr().cast(); +} + +/// Recover a peripheral's base address as an integer. svd2rust already carries it as the `usize` +/// const-generic parameter of [`Periph`], but only ever surfaces it pre-cast to a pointer, and a +/// const pointer-to-integer cast is rejected. This re-exposes the parameter itself. +pub trait PeriphAddr { + /// The peripheral's base address, straight from the SVD. + const ADDR: usize; +} + +impl PeriphAddr for ast1060_pac::generic::Periph { + const ADDR: usize = A; +} + +/// The GPIO register block base, as an integer a grant check can compare against. +pub(crate) const GPIO_BASE: usize = ::ADDR; + +/// Every I2C controller the AST1060 exposes (0..=13) — the single source of truth for controller +/// register bases. Pins reference a row; the userspace server indexes it by bus number. +pub const I2C_CTRL: &[I2cCtrlRegs] = &[ + I2cCtrlRegs { + id: 0, + i2c: I2c::ptr() as *const (), + buff: I2cbuff::ptr() as *const (), + }, + I2cCtrlRegs { + id: 1, + i2c: I2c1::ptr() as *const (), + buff: I2cbuff1::ptr() as *const (), + }, + I2cCtrlRegs { + id: 2, + i2c: I2c2::ptr() as *const (), + buff: I2cbuff2::ptr() as *const (), + }, + I2cCtrlRegs { + id: 3, + i2c: I2c3::ptr() as *const (), + buff: I2cbuff3::ptr() as *const (), + }, +]; + +openprot_hal::pins! { + scu414_28 { Gpio: &[clear(0x414, 28), clear(0x4b4, 28), clear(0x694, 28)] => GpioData { bit: 28, map: &EFGH } }, + scu414_29 { Gpio: &[clear(0x414, 29), clear(0x4b4, 29), clear(0x694, 29)] => GpioData { bit: 29, map: &EFGH } }, + scu414_30 { I2cScl: &[set(0x414, 30)] => I2cData { ctrl: I2C_CTRL[1] }, Gpio: &[clear(0x414, 30)] => GpioData { bit: 30, map: &EFGH } }, + scu414_31 { I2cSda: &[set(0x414, 31)] => I2cData { ctrl: I2C_CTRL[1] }, Gpio: &[clear(0x414, 31)] => GpioData { bit: 31, map: &EFGH } }, + scu418_0 { I2cScl: &[set(0x418, 0)] => I2cData { ctrl: I2C_CTRL[2] }, Gpio: &[clear(0x418, 0)] => GpioData { bit: 0, map: &IJKL } }, + scu418_1 { I2cSda: &[set(0x418, 1)] => I2cData { ctrl: I2C_CTRL[2] }, Gpio: &[clear(0x418, 1)] => GpioData { bit: 1, map: &IJKL } }, + + scu410_0 { Gpio: &[clear(0x410, 0), clear(0x4b0, 0), clear(0x690, 0)] => GpioData { bit: 0, map: &ABCD } }, + scu410_1 { Gpio: &[clear(0x410, 1), clear(0x4b0, 1), clear(0x690, 1)] => GpioData { bit: 1, map: &ABCD } }, + scu410_2 { Gpio: &[clear(0x410, 2), clear(0x4b0, 2), clear(0x690, 2)] => GpioData { bit: 2, map: &ABCD } }, + scu410_3 { Gpio: &[clear(0x410, 3), clear(0x4b0, 3), clear(0x690, 3)] => GpioData { bit: 3, map: &ABCD } }, + scu410_4 { Gpio: &[clear(0x410, 4), clear(0x4b0, 4), clear(0x690, 4)] => GpioData { bit: 4, map: &ABCD } }, + scu410_5 { Gpio: &[clear(0x410, 5), clear(0x4b0, 5), clear(0x690, 5)] => GpioData { bit: 5, map: &ABCD } }, + scu410_6 { Gpio: &[clear(0x410, 6), clear(0x4b0, 6), clear(0x690, 6)] => GpioData { bit: 6, map: &ABCD } }, + scu410_7 { Gpio: &[clear(0x410, 7), clear(0x4b0, 7), clear(0x690, 7)] => GpioData { bit: 7, map: &ABCD } }, +} diff --git a/target/ast10x0/peripherals/scu/registers.rs b/target/ast10x0/peripherals/scu/registers.rs index b5e6a8b04..d450da796 100644 --- a/target/ast10x0/peripherals/scu/registers.rs +++ b/target/ast10x0/peripherals/scu/registers.rs @@ -3,12 +3,28 @@ //! AST10x0 SCU low-level register access. +use super::pins::ScuBlock; use ast1060_pac as device; use core::marker::PhantomData; const SCU_UNLOCK_KEY: u32 = 0x1688_A8A8; -/// Safe wrapper around the AST10x0 SCU register block. +/// Write-enable the SCU's protected registers, through the confined `Mmio` accessor. The key stays +/// private here; the pin-mux route path calls this before applying a pin's coalesced mux writes. +pub(crate) fn unlock_scu_writes(mmio: &crate::Mmio) { + mmio.write_reg(0x000, SCU_UNLOCK_KEY); +} + +/// Safe accessor for the AST10x0 SCU register block — the shared clock/reset/pin-mux authority. +/// +/// The SCU is a stateless, re-entrant control block: this handle is just a fixed MMIO pointer, +/// and every operation is a register read/write via a safe `&self` method. Its meaningful +/// invariant is *provenance* (past the boot gate), not exclusive ownership — so it is `Copy`. +/// Mint it once through the sole `unsafe` constructor ([`ScuRegisters::new_global_unlocked`]) at +/// boot and copy that handle into every capability that needs SCU access; the copy is the shared +/// authority. Holding one is proof the boot gate ran, which is what lets the register methods be +/// safe. +#[derive(Clone, Copy)] pub struct ScuRegisters { base: *const device::scu::RegisterBlock, /// Prevent `Send` and `Sync`. @@ -74,3 +90,14 @@ impl ScuRegisters { .write(|w| unsafe { w.bits(SCU_UNLOCK_KEY) }); } } + +/// Offset-addressed access for the coalesced mux applier — one RMW per touched SCU register via the `ScuBlock` singleton applier. +impl openprot_hal::field_mux::RegBlock for ScuRegisters { + fn read_reg(&self, offset: u32) -> u32 { + crate::Mmio::::block().read_reg(offset) + } + + fn write_reg(&self, offset: u32, val: u32) { + crate::Mmio::::block().write_reg(offset, val) + } +} diff --git a/target/ast10x0/peripherals/smc/controller.rs b/target/ast10x0/peripherals/smc/controller.rs index 545b02809..36e00e1d3 100644 --- a/target/ast10x0/peripherals/smc/controller.rs +++ b/target/ast10x0/peripherals/smc/controller.rs @@ -7,14 +7,16 @@ use core::cell::UnsafeCell; use core::marker::PhantomData; use crate::smc::helpers::{ - encode_fmc_segment, encode_spi_segment, flash_capacity_bytes, get_mid_point_of_longest_one, - spi_calibration_enable, spi_freq_div, total_capacity_bytes, validate_dma_read, - validate_mapped_range, SPI_CTRL_FREQ_MASK, SPI_DMA_CALC_CKSUM, SPI_DMA_CALIB_MODE, - SPI_DMA_ENABLE, SPI_DMA_RAM_MAP_BASE, + encode_fmc_segment, encode_spi_segment, get_mid_point_of_longest_one, spi_calibration_enable, + spi_freq_div, validate_dma_read, validate_mapped_range, SMC_WINDOW_SIZE_BYTES, + SPI_CTRL_FREQ_MASK, SPI_DMA_CALC_CKSUM, SPI_DMA_CALIB_MODE, SPI_DMA_ENABLE, + SPI_DMA_RAM_MAP_BASE, }; use crate::smc::interrupts::{SmcInterrupt, SmcInterruptDecoder}; use crate::smc::registers::SmcRegisters; use crate::smc::types::*; +use util_region::{covers, Mmap, Region}; +use util_sfdp::{decode_geometry, FlashGeometry}; /// Internal controller state #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -74,395 +76,307 @@ const fn spi_nor_addr_width_reg(current: u32, cs: ChipSelect, use_4b: bool) -> u } } +/// How a chip select's flash geometry is resolved at init. +/// +/// [`Smc::init`] resolves each present CS through the [`SmcInstance`] marker's +/// associated source type. Because an associated type is only code-generated +/// when a marker names it, a build whose markers are all fixed-geometry sources +/// never instantiates the [`Discover`] path, so the SFDP decode code below is +/// never generated. +pub trait GeometrySource { + /// Produce the flash geometry for `cs`. + /// + /// `baseline_ctrl` is the CS control-register value to derive user-mode + /// transfers from (used only by [`Discover`]). + fn resolve( + regs: &SmcRegisters, + cs: ChipSelect, + window_base: usize, + baseline_ctrl: u32, + ) -> Result; + + /// Geometry to report to callers: the SFDP-discovered value for + /// [`Discover`], the const `G` for [`Pinned`] (folded at compile time). + fn geometry(discovered: &FlashGeometry) -> FlashGeometry { + *discovered + } +} + +impl GeometrySource for Discover { + fn resolve( + regs: &SmcRegisters, + cs: ChipSelect, + window_base: usize, + baseline_ctrl: u32, + ) -> Result { + // NOTE: fixed 256-byte SFDP read. A device whose BFP table extends past + // offset 256 will fail decode (DeviceNotSupported); grow this if needed. + let mut image = [0u8; 256]; + transceive_user_raw( + regs, + cs, + window_base, + baseline_ctrl, + &[0x5A], + &[0, 0, 0, 0], + &mut image, + TransferMode::Mode111, + ); + decode_geometry(&image).map_err(|_| SmcError::DeviceNotSupported) + } +} + +/// Geometry-source marker carrying a fixed geometry as a const parameter. +/// +/// Use this instead of [`Discover`] for production buils when the wired flash +/// is sure not to change Its `resolve` just returns `G`, so a build that names +/// only `Pinned` never generates the SFDP decode path. +pub struct Pinned; + +impl GeometrySource for Pinned { + fn resolve( + _regs: &SmcRegisters, + _cs: ChipSelect, + _window_base: usize, + _baseline_ctrl: u32, + ) -> Result { + Ok(G) + } + + fn geometry(_discovered: &FlashGeometry) -> FlashGeometry { + G + } +} + /// Type-state marker: controller is constructed but not initialized. pub struct Uninitialized; /// Type-state marker: controller has completed hardware initialization. pub struct Ready; -/// Generic Static Memory Controller (SMC) +/// Lifecycle marker for the controller's init state. Empty: config is carried +/// as a compile-time property of the `SmcInstance` type parameter, not stored. +pub trait SmcMode {} + +impl SmcMode for Uninitialized {} + +impl SmcMode for Ready {} + +/// Compile-time-computed controller layout: memory-map config word, per-CS +/// aperture share, window bases, and encoded segment words. Computed inline in +/// the `const` block at the top of `Smc::init` from an [`SmcInstance`]'s const +/// config; an invalid config `panic!`s, turning it into a build error at the +/// instantiation site. +struct SmcLayout { + conf: u32, + region_size: usize, + window_base: [usize; 2], + cs0_present: bool, + cs1_present: bool, + cs0_segment: u32, + cs1_segment: u32, +} + +/// Per-CS state resolved once during [`Smc::init`] +#[derive(Clone, Copy)] +struct ResolvedCs { + geometry: FlashGeometry, + normal_read_ctrl: u32, + window_base: usize, +} + +/// Derive the full controller layout from its static config. Splits the +/// 256 MiB aperture evenly across present chip selects for now. /// -/// The `Mode` type parameter enforces init ordering at compile time. -pub struct Smc { +/// The single source of the decode windows: [`Smc::new`] checks the mappings +/// against it and [`Smc::init`] programs the segment registers from it, so the +/// two cannot drift apart. +const fn layout_for(ctrl: SmcController, cfg: SmcConfig) -> SmcLayout { + let cs0_present = cfg.cs0.is_some(); + let cs1_present = cfg.cs1.is_some(); + let present = cs0_present as usize + cs1_present as usize; + if present == 0 { + panic!("SMC config must configure at least one chip select"); + } + let region_size = SMC_WINDOW_SIZE_BYTES / present; + let cs0_size = if cs0_present { region_size } else { 0 }; + let base = ctrl.flash_window_address(); + let window_base = [base, base + cs0_size]; + + let mut conf = 0u32; + if cs0_present { + conf |= 1 << 16; // CONF_ENABLE_W0 + conf |= 0x2 << 0; // FLASH_TYPE_SPI + } + if cs1_present { + conf |= 1 << 17; // CONF_ENABLE_W1 + conf |= 0x2 << 2; // FLASH_TYPE_SPI + } + + let cs0_segment = if cs0_present { + match encode_segment_for(ctrl, 0, cs0_size) { + Ok(seg) => seg, + Err(_) => panic!("invalid CS0 segment for SMC config"), + } + } else { + 0 + }; + let cs1_segment = if cs1_present { + match encode_segment_for(ctrl, cs0_size, cs0_size + region_size) { + Ok(seg) => seg, + Err(_) => panic!("invalid CS1 segment for SMC config"), + } + } else { + 0 + }; + + SmcLayout { + conf, + region_size, + window_base, + cs0_present, + cs1_present, + cs0_segment, + cs1_segment, + } +} + +const fn encode_segment_for( + ctrl: SmcController, + start: usize, + end: usize, +) -> Result { + match ctrl { + SmcController::Fmc => encode_fmc_segment(start, end), + SmcController::Spi1 | SmcController::Spi2 => encode_spi_segment(start, end), + } +} + +/// Spin a fixed number of times to let a hardware register settle. +#[inline(never)] +fn loop_delay(spin_cnt: u32) { + for _ in 0..spin_cnt { + core::hint::spin_loop(); + } +} + +/// Generic Static Memory Controller (SMC). +/// +/// `I` names the wired controller and carries its config as compile-time consts +/// ([`SmcInstance`]); `Mode` enforces init ordering. Neither config nor +/// controller id is stored: both are read from `I`, and everything derived from +/// them is computed at compile time in `init`. +pub struct Smc { regs: SmcRegisters, - controller_id: SmcController, - config: SmcConfig, state: SmcState, - /// Per-CS normal-read control register values stored at init time. - /// Indexed by `ChipSelect as usize`. Restored unconditionally after every - /// user-mode transaction, matching aspeed-rust `deactivate_user()` behavior. - normal_read_ctrl: [u32; 2], - /// Per-CS AHB flash window base addresses. - /// CS0 starts at `controller_id.flash_window_address()`; - /// CS1 starts immediately after the CS0 segment. - flash_window_base: [usize; 2], + /// Geometry + calibration resolved at init; `None` until `Ready` (and for + /// any absent chip select). + cs0_resolved: Option, + cs1_resolved: Option, + _i: PhantomData I>, _mode: PhantomData Mode>, } /// Ergonomic alias for the uninitialized controller handle. -pub type UninitSmc = Smc; +pub type UninitSmc = Smc; /// Ergonomic alias for the initialized controller handle. -pub type ReadySmc = Smc; +pub type ReadySmc = Smc; -impl Smc { - /// Create a new SMC controller instance. +impl Smc { + /// Create a new SMC controller instance from the regions mapped to it. /// - /// # Safety - /// Caller must ensure: - /// - No other Smc instance exists for this hardware controller - /// - The controller's base address points to valid hardware - pub unsafe fn new(config: SmcConfig) -> Result { - if config.cs0.is_none() && config.cs1.is_none() { - return Err(SmcError::InvalidCapacity); + /// Takes all three by value: the register block plus the decode window of + /// each chip select. That is what makes this safe — the mappings come from + /// `system.json5`, each is minted once per process, and a second controller + /// over the same block would need tokens the caller no longer has. + /// + /// Each mapping only has to contain what is used, not match it exactly. A + /// process may map less than the full decode region, and both current + /// callers do; a kernel-only binary maps the whole address space. + pub fn new( + _region: Region, + _cs0_window: Region, + _cs1_window: Region, + ) -> Result + where + Cs0: Mmap, + Cs1: Mmap, + { + const { + assert!( + covers::( + I::CONTROLLER.base_address(), + core::mem::size_of::() + ), + "mapped region does not contain this controller's register block" + ); + let layout = layout_for(I::CONTROLLER, I::CONFIG); + if layout.cs0_present { + assert!( + covers::(layout.window_base[0], 1), + "CS0 mapping does not cover this controller's CS0 decode window" + ); + } + if layout.cs1_present { + assert!( + covers::(layout.window_base[1], 1), + "CS1 mapping does not cover this controller's CS1 decode window" + ); + } } - - let base = config.controller_id.base_address() as *const _; - // SAFETY: Caller ensures base address is valid and no other instance exists. + let base = I::CONTROLLER.base_address() as *const _; + // SAFETY: `region` is sole ownership of the granted register block, and + // the block is this controller's per the check above. let regs = unsafe { SmcRegisters::new(base) }; Ok(Self { regs, - controller_id: config.controller_id, - config, state: SmcState::Idle, - normal_read_ctrl: [0; 2], - flash_window_base: [0; 2], + cs0_resolved: None, + cs1_resolved: None, + _i: PhantomData, _mode: PhantomData, }) } /// Initialize hardware and transition to `Ready` mode. - pub fn init(self) -> Result, SmcError> { - // Phase 3: Topology-aware initialization - // - // The SmcTopology enum encodes the controller's role and master_idx: - // - BootSpi { master_idx }: Boot firmware path (typically FMC, master_idx=0) - // - HostSpi { master_idx }: Host BMC SPI path (typically SPI1, master_idx=0) - // - NormalSpi { master_idx }: Normal user SPI path (typically SPI2, master_idx=2) - // - // Topology gates behavior in setup_segments() and configure_timing(): - // The topology is consulted via self.config.topology. - - // 1. Configure flash types and write-enable per CS - let mut conf = 0u32; - if self.config.cs0.is_some() { - conf |= 1 << 16; // CONF_ENABLE_W0 - conf |= 0x2 << 0; // FLASH_TYPE_SPI - } - if self.config.cs1.is_some() { - conf |= 1 << 17; // CONF_ENABLE_W1 - conf |= 0x2 << 2; // FLASH_TYPE_SPI - } - self.regs.write_config(conf); + pub fn init(self) -> Result, SmcError> { + let layout = const { layout_for(I::CONTROLLER, I::CONFIG) }; - // 2. Set up segment addresses (memory mapping) - Self::setup_segments(&self)?; + // 1. Configure flash types and write-enable per CS. + self.regs.write_config(layout.conf); - // Snapshot per-CS normal-read control register values after all init writes. - // CS1 value is captured even if cs1 is None (safe: register read is harmless). - let cs0_normal_read = self.regs.read_cs0_ctrl(); - let cs1_normal_read = self.regs.read_cs1_ctrl(); - - // Compute per-CS AHB flash window base addresses. - let base = self.controller_id.flash_window_address(); - let cs0_size = flash_capacity_bytes(self.config.cs0).unwrap_or(0); - let flash_window_base = [base, base + cs0_size]; + // 2. Set up segment addresses (memory mapping). + if layout.cs0_present { + self.regs.write_cs0_segment(layout.cs0_segment); + } + if layout.cs1_present { + self.regs.write_cs1_segment(layout.cs1_segment); + } - Ok(Smc { + let mut smc = Smc:: { regs: self.regs, - controller_id: self.controller_id, - config: self.config, state: SmcState::Idle, - normal_read_ctrl: [cs0_normal_read, cs1_normal_read], - flash_window_base, + cs0_resolved: None, + cs1_resolved: None, + _i: PhantomData, _mode: PhantomData, - }) - } - fn encode_segment(&self, start: usize, end: usize) -> Result { - match self.config.controller_id { - SmcController::Fmc => encode_fmc_segment(start, end), - SmcController::Spi1 | SmcController::Spi2 => encode_spi_segment(start, end), - } - } + }; - fn setup_segments(&self) -> Result<(), SmcError> { - // Decode-range sizing is topology-aware. - // - // For BootSpi (FMC, master_idx=0): Full decode range from configured capacity. - // Used for boot firmware; exclusive access to flash; no shared-bus concerns. - // - // For HostSpi / NormalSpi when master_idx != 0: Potential shared-bus topology. - // When multiple masters multiplex a single SPI flash, decode ranges may need - // to be restricted. Phase 3+ may implement decode_range_reinit logic keyed - // on config.topology.master_idx() to prevent collisions. - // - // For now, all topologies use the full capacity from FlashConfig. - // Phase 3+: add conditional decode-range sizing based on topology + master_idx. - - let cs0_size = flash_capacity_bytes(self.config.cs0)?; - let cs1_size = flash_capacity_bytes(self.config.cs1)?; - total_capacity_bytes(self.config.cs0, self.config.cs1)?; - - if cs0_size > 0 { - let seg = self.encode_segment(0, cs0_size)?; - self.regs.write_cs0_segment(seg); + // 3. Resolve + calibrate each present chip select once. + if layout.cs0_present { + smc.cs0_resolved = Some(smc.resolve_cs::(ChipSelect::Cs0, &layout)?); } - - if cs1_size > 0 { - let seg = self.encode_segment(cs0_size, cs0_size + cs1_size)?; - self.regs.write_cs1_segment(seg); + if layout.cs1_present { + smc.cs1_resolved = Some(smc.resolve_cs::(ChipSelect::Cs1, &layout)?); } - Ok(()) + Ok(smc) } } -impl Smc { - fn flash_window_base(&self, cs: ChipSelect) -> usize { - match cs { - ChipSelect::Cs0 => self.flash_window_base[0], - ChipSelect::Cs1 => self.flash_window_base[1], - } - } - - fn normal_read_ctrl(&self, cs: ChipSelect) -> u32 { - match cs { - ChipSelect::Cs0 => self.normal_read_ctrl[0], - ChipSelect::Cs1 => self.normal_read_ctrl[1], - } - } - - fn set_normal_read_ctrl(&mut self, cs: ChipSelect, val: u32) { - match cs { - ChipSelect::Cs0 => self.normal_read_ctrl[0] = val, - ChipSelect::Cs1 => self.normal_read_ctrl[1] = val, - } - } - - /// Perform a programmed I/O read via memory window. - /// - /// Reads directly from the flash memory window. Hardware automatically - /// converts memory accesses to SPI transactions. - pub fn read(&self, cs: ChipSelect, offset: u32, buf: &mut [u8]) -> Result { - let cs_config = self.cs_config(cs)?; - let cs_capacity = flash_capacity_bytes(Some(cs_config))?; - let window = self.flash_window_base(cs) as *const u8; - let offset = validate_mapped_range(offset, buf.len(), cs_capacity)?; - let flash_ptr = window.wrapping_add(offset); - pw_log::debug!( - "read: offset0x{:08x}, size:0x{:08x}, flash ptr:0x{:08x}", - offset as u32, - buf.len() as u32, - flash_ptr as u32 - ); - // SAFETY: `flash_ptr` is derived from the controller's fixed MMIO flash - // window using `wrapping_add`, which avoids imposing Rust allocation - // provenance rules on the raw address arithmetic itself. The actual read - // below requires the requested `[offset, offset + buf.len())` range to be - // backed by the controller's mapped flash aperture, and `buf` provides a - // valid, writable destination that does not overlap this MMIO window. - unsafe { - core::ptr::copy_nonoverlapping(flash_ptr, buf.as_mut_ptr(), buf.len()); - } - - Ok(buf.len()) - } - #[inline(never)] - pub fn loop_delay(spin_cnt: u32) { - for _ in 0..spin_cnt { - core::hint::spin_loop(); - } - } - /// Initiate a DMA read operation (non-blocking). - pub fn dma_read( - &mut self, - cs: ChipSelect, - flash_offset: u32, - dram_addr: usize, - len: u32, - ) -> Result<(), SmcError> { - if self.state != SmcState::Idle { - return Err(SmcError::ControllerNotReady); - } - if !self.config.dma_enabled { - return Err(SmcError::DmaNotEnabled); - } - if cs == ChipSelect::Cs1 && self.config.cs1.is_none() { - return Err(SmcError::InvalidChipSelect); - } - self.regs.disable_dma(); - Self::loop_delay(0x1000); - - let cs_config = self.cs_config(cs)?; - let cs_capacity = flash_capacity_bytes(Some(cs_config))?; - pw_log::debug!( - "flash_offset: 0x{:08x}, cs_cap: 0x{:08x}", - flash_offset as u32, - cs_capacity as u32 - ); - - let validated = validate_dma_read( - flash_offset, - self.flash_window_base(cs), - cs_capacity, - dram_addr, - len, - )?; - pw_log::debug!( - "flash start: 0x{:08x}, cs_cap: 0x{:08x}, dram_addr: 0x{:08x} len: 0x{:08x} ", - validated.flash_start as u32, - cs_capacity as u32, - validated.dram_addr as u32, - validated.dma_len_reg as u32 - ); - - // Set CS0 control register to normal-read mode before programming DMA - // registers. The DMA engine reads the CSx control register to know which - // SPI command to issue; it must be in normal-read mode (not user mode) - // before the kick. Matches aspeed-rust fmccontroller.rs::read_dma - // ctrl construction: preserve frequency bits, set ASPEED_SPI_NORMAL_READ. - let ctrl_val = self.normal_read_ctrl(cs) | ASPEED_SPI_NORMAL_READ; - self.regs.write_cs_ctrl(cs, ctrl_val); - - // Acquire the DMA bus arbiter before programming any DMA registers. - // On SPI1/SPI2: writes SPI_DMA_GET_REQ_MAGIC and spins until DMAGrant - // (bit 30 of spi080) is set. On FMC: bits 20–31 are Reserved — the write - // is a no-op and the spin condition is immediately false. Safe to call - // unconditionally on all controllers, matching aspeed-rust's approach. - self.regs.acquire_dma_arbiter(); - pw_log::debug!("acquired dma bus arbiter"); - // Program DMA registers in the order used by aspeed-rust fmccontroller.rs::read_dma: - // fmc084 = flash side DMA address (R_DMA_FLASH_ADDR) - // = flash_window_base[cs] - SPI_DMA_FLASH_MAP_BASE + cs_offset - // (computed in validate_dma_read) - // fmc088 = DRAM/SRAM destination address (R_DMA_DRAM_ADDR) - // = physical_sram_addr + SPI_DMA_RAM_MAP_BASE - // fmc08c = transfer length - 1 (R_DMA_LEN) - self.regs.write_dma_flash_addr(validated.flash_start as u32); - self.regs - .write_dma_dram_addr(validated.dram_addr + SPI_DMA_RAM_MAP_BASE); - self.regs.write_dma_len(validated.dma_len_reg); - - // Enable the completion IRQ before kicking DMA. QEMU evaluates - // INTR_CTRL_DMA_EN exactly once at DMA-done time - // (`aspeed_smc_dma_done` in qemu/hw/ssi/aspeed_smc.c) and won't - // re-fire the IRQ if the bit is set after the fact; aspeed-rust - // arms the IRQ before starting DMA for the same reason - // (`spicontroller.rs::read_dma`). - if self.config.enable_interrupts { - pw_log::debug!("enable dma irq"); - self.regs.enable_dma_irq(); - } - - // Kick DMA via read-modify-write to preserve timing calibration - // bits (fmc080 bits 8-19), matching aspeed-rust fmccontroller.rs::read_dma. - pw_log::debug!("start dma read..."); - self.regs.kick_dma_read(); - self.state = SmcState::DmaInFlight; - Ok(()) - } - - /// Read raw DMA/interrupt status register bits (FMC008). - pub fn dma_status(&self) -> u32 { - self.regs.read_dma_status() - } - - /// Clear DMA-related status bits in the status register (FMC008). - /// - /// `clear_mask` is write-1-to-clear and should contain only relevant bits. - pub fn clear_dma_status(&self, clear_mask: u32) { - self.regs - .clear_dma_status(clear_mask & DMA_STATUS_RELEVANT_BITS); - } - - /// Decode status bits and transition controller state. - /// - /// Called by both `handle_dma_irq` (IRQ-driven) and `poll_dma_completion` - /// (polling). Assumes `status & DMA_STATUS_RELEVANT_BITS != 0`. - fn complete_dma(&mut self, status: u32) -> Result { - let relevant = status & DMA_STATUS_RELEVANT_BITS; - let dma_in_flight = self.state == SmcState::DmaInFlight; - let decoded = SmcInterruptDecoder::decode_with_context(status, dma_in_flight); - self.clear_dma_status(relevant); - - match decoded { - SmcInterrupt::DmaComplete => { - self.regs.disable_dma(); - self.state = SmcState::Idle; - Ok(decoded) - } - SmcInterrupt::DmaError => { - self.regs.disable_dma(); - self.state = SmcState::Idle; - Err(SmcError::DmaAborted) - } - SmcInterrupt::CommandAbort => { - self.state = SmcState::Faulted; - Err(SmcError::HardwareError) - } - SmcInterrupt::WriteProtected => { - self.state = SmcState::Faulted; - Err(SmcError::WriteProtected) - } - SmcInterrupt::Unknown => Err(SmcError::HardwareError), - } - } - - /// Decode and complete an in-flight DMA operation from an IRQ event. - /// - /// Returns the decoded interrupt cause when a completion/error event was - /// observed and processed. If no relevant status bits are set, returns - /// `SmcError::ControllerNotReady` to indicate no completion work was found. - pub fn handle_dma_irq(&mut self) -> Result { - self.regs.disable_dma_irq(); - let status = self.dma_status(); - pw_log::info!("SMC handle_dma_irq: status=0x{:08x}", status as u32); - if status & DMA_STATUS_RELEVANT_BITS == 0 { - return Err(SmcError::ControllerNotReady); - } - self.complete_dma(status) - } - - /// Poll for DMA completion without requiring an IRQ. - /// - /// Returns `Poll::Pending` while the transfer is still in progress. - /// Returns `Poll::Ready(Ok(()))` on success or `Poll::Ready(Err(SmcError))` - /// on failure. Returns `Poll::Ready(Err(SmcError::ControllerNotReady))` if - /// no DMA is in flight. - /// - /// Suitable for spin-poll loops in contexts where `enable_interrupts` is - /// false (e.g., QEMU tests without an IRQ handler): - /// ```ignore - /// loop { - /// match controller.poll_dma_completion() { - /// Poll::Ready(result) => break result, - /// Poll::Pending => {} - /// } - /// } - /// ``` - pub fn poll_dma_completion(&mut self) -> core::task::Poll> { - if self.state != SmcState::DmaInFlight { - return core::task::Poll::Ready(Err(SmcError::ControllerNotReady)); - } - let status = self.dma_status(); - if status & DMA_STATUS_RELEVANT_BITS == 0 { - return core::task::Poll::Pending; - } - core::task::Poll::Ready(self.complete_dma(status).map(|_| ())) - } - - pub fn poll_blocking_dma_completion(&self, timeout: u32) -> u32 { - let mut to = timeout; - - while (self.regs.read_dma_status() & DMA_STATUS_RELEVANT_BITS) == 0 { - if to == 0 { - return 0; - } - to -= 1; - } - return to; - } +impl Smc { /// Check if controller is ready for operations. pub fn is_ready(&self) -> bool { self.state == SmcState::Idle @@ -475,142 +389,138 @@ impl Smc { /// Get the controller identifier. pub fn controller_id(&self) -> SmcController { - self.controller_id + I::CONTROLLER } /// Get the configured master ID for this controller topology. pub fn master_idx(&self) -> u8 { - self.config.topology.master_idx() + I::CONFIG.topology.master_idx() } - /// Return configured total flash capacity for this controller in bytes. - pub fn capacity_bytes(&self) -> Result { - total_capacity_bytes(self.config.cs0, self.config.cs1) + /// Build a handle for CS0 from its init-resolved geometry and calibration. + /// + /// Returns `SmcError::InvalidChipSelect` if CS0 was not configured. + pub fn cs0(&mut self) -> Result, SmcError> { + self.build_cs(ChipSelect::Cs0) } - /// Return configured flash capacity in bytes for the given chip select. + /// Build a handle for CS1 from its init-resolved geometry and calibration. /// - /// Returns `SmcError::InvalidChipSelect` if the slot was not populated - /// at construction time. Used by the device facade to bounds-check - /// per-CS reads and to compute per-CS controller-window offsets. - pub fn cs_capacity_bytes(&self, cs: ChipSelect) -> Result { - crate::smc::helpers::cs_capacity_bytes(&self.config, cs) + /// Returns `SmcError::InvalidChipSelect` if CS1 was not configured. + pub fn cs1(&mut self) -> Result, SmcError> { + self.build_cs(ChipSelect::Cs1) } - /// Return the configured `FlashConfig` for the requested chip select. - /// - /// Returns `SmcError::InvalidChipSelect` if the slot was not populated at - /// construction time. Used by device-facade constructors to validate the - /// caller-supplied `FlashConfig` against the per-CS configuration the - /// controller was actually initialized with. - pub fn cs_config(&self, cs: ChipSelect) -> Result { - let slot = match cs { - ChipSelect::Cs0 => self.config.cs0, - ChipSelect::Cs1 => self.config.cs1, - }; - slot.ok_or(SmcError::InvalidChipSelect) + fn build_cs(&mut self, cs: ChipSelect) -> Result, SmcError> { + let resolved = match cs { + ChipSelect::Cs0 => self.cs0_resolved, + ChipSelect::Cs1 => self.cs1_resolved, + } + .ok_or(SmcError::InvalidChipSelect)?; + + Ok(Cs { + regs: &self.regs, + state: &mut self.state, + cs, + window_base: resolved.window_base, + normal_read_ctrl: resolved.normal_read_ctrl, + geometry: resolved.geometry, + controller_id: I::CONTROLLER, + master_idx: I::CONFIG.topology.master_idx(), + dma_enabled: I::CONFIG.dma_enabled, + enable_interrupts: I::CONFIG.enable_interrupts, + }) } - /// Execute a raw user-mode SPI transfer on CS0 for this controller. + /// Resolve a chip select's geometry and run calibration once, at init. /// - /// The `mode` parameter controls the IO width written to the CS control - /// register for each phase (cmd / addr+payload / rx), matching the - /// per-phase register update pattern used by aspeed-rust's - /// `spi_nor_transceive_user()`. - pub fn transceive_user( + /// Reads the reset-time CS control value as the SFDP baseline, resolves + /// geometry via `S` (pinned or SFDP discovery), rejects a device that + /// overflows its aperture share, then calibrates and returns the stored + /// per-CS state. + fn resolve_cs( &self, cs: ChipSelect, - cmd: &[u8], - tx_payload: &[u8], - rx: &mut [u8], - mode: TransferMode, - ) -> Result<(), SmcError> { - if self.state != SmcState::Idle { - return Err(SmcError::ControllerNotReady); - } - if cs == ChipSelect::Cs1 && self.config.cs1.is_none() { - return Err(SmcError::InvalidChipSelect); + layout: &SmcLayout, + ) -> Result { + let cfg = self.cs_config(cs)?; + let window_base = layout.window_base[cs as usize]; + // Reset-time CS control value; user-mode transfers (incl. SFDP) derive + // their frequency bits from this baseline. + let baseline_ctrl = self.regs.read_cs_ctrl(cs); + let geometry = S::resolve(&self.regs, cs, window_base, baseline_ctrl)?; + + if geometry.capacity_bytes as usize > layout.region_size { + return Err(SmcError::InvalidCapacity); } - // Derive user-mode base from the stored normal-read value: preserve - // frequency bits and replace mode type with ASPEED_SPI_USER. - let user_base = (self.normal_read_ctrl(cs) & !0x7) | ASPEED_SPI_USER; - let window = self.flash_window_base(cs) as *mut u32; + let normal_read_ctrl = self.calibrate_cs( + cs, + cfg.spi_clock_mhz, + geometry.capacity_bytes as usize, + window_base, + )?; - // Assert CS: inactive first, then active (matches aspeed-rust activate_user). - self.regs - .write_cs_ctrl(cs, user_base | ASPEED_SPI_USER_INACTIVE); - self.regs.write_cs_ctrl(cs, user_base); + Ok(ResolvedCs { + geometry, + normal_read_ctrl, + window_base, + }) + } - // SAFETY: user mode is active; the flash aperture is the hardware-defined - // byte-stream port for SPI command traffic while user mode is held. - unsafe { - // Command phase — always single-wire. - let cmd_ctrl = (user_base & SPI_CTRL_IO_MODE_MASK) | mode.cmd_io_bits(); - self.regs.write_cs_ctrl(cs, cmd_ctrl); - spi_write_data(window, cmd); - - // Address / TX payload phase. - let addr_ctrl = (user_base & SPI_CTRL_IO_MODE_MASK) | mode.addr_io_bits(); - self.regs.write_cs_ctrl(cs, addr_ctrl); - spi_write_data(window, tx_payload); - - // RX data phase. - let data_ctrl = (user_base & SPI_CTRL_IO_MODE_MASK) | mode.data_io_bits(); - self.regs.write_cs_ctrl(cs, data_ctrl); - spi_read_data(window as *const u32, rx); - } + /// Presence check: the configured `FlashConfig` for `cs`, or + /// `InvalidChipSelect` if the slot was not populated. + fn cs_config(&self, cs: ChipSelect) -> Result { + let slot = match cs { + ChipSelect::Cs0 => I::CONFIG.cs0, + ChipSelect::Cs1 => I::CONFIG.cs1, + }; + slot.ok_or(SmcError::InvalidChipSelect) + } - // Deassert CS, then restore the pre-computed normal-read configuration - // (matches aspeed-rust deactivate_user restoring cmd_mode[cs].normal_read). - self.regs - .write_cs_ctrl(cs, user_base | ASPEED_SPI_USER_INACTIVE); - self.regs.write_cs_ctrl(cs, self.normal_read_ctrl(cs)); - Ok(()) + fn poll_blocking_dma_completion(&self, timeout: u32) -> u32 { + let mut to = timeout; + + while (self.regs.read_dma_status() & DMA_STATUS_RELEVANT_BITS) == 0 { + if to == 0 { + return 0; + } + to -= 1; + } + return to; } - // - // MMIO access:: nor read init - // - //TODO: call from nordevice layer instead - pub fn spi_nor_read_init(&mut self, cs: ChipSelect) -> Result<(), SmcError> { + /// Program normal-read command/address width for `cs` and run (or skip) + /// timing calibration. Returns the final normal-read control value the + /// handle restores after each user-mode transfer. + fn calibrate_cs( + &self, + cs: ChipSelect, + spi_clock_mhz: u32, + capacity: usize, + window_base: usize, + ) -> Result { let mode: TransferMode = TransferMode::Mode114; let dummy: u32 = 0x1; - let cs_capacity = self.cs_capacity_bytes(cs)?; - let use_4b_addr = spi_nor_uses_4b_addr(cs_capacity); - let read_opcode = spi_nor_qread_cmd_for_capacity(cs_capacity); - //pw_log::info!("=== spi_read_init()==="); + let use_4b_addr = spi_nor_uses_4b_addr(capacity); + let read_opcode = spi_nor_qread_cmd_for_capacity(capacity); let read_cmd = mode.data_io_bits() | (read_opcode << 16) | (dummy << 6) | ASPEED_SPI_NORMAL_READ; self.regs.write_cs_ctrl(cs, read_cmd); let addr_width = spi_nor_addr_width_reg(self.regs.read_addr_width(), cs, use_4b_addr); self.regs.write_addr_width(addr_width); - self.set_normal_read_ctrl(cs, read_cmd); + if cs != ChipSelect::Cs0 { - // CS1 calibration can fault on boards where the secondary FMC flash - // is not ready for the calibration sweep. Keep CS1 on the same - // fixed timing path used after calibration and still program its - // normal-read command/address width above. - return self.configure_timing(cs, self.cs_config(cs)?.spi_clock_mhz); + // CS1 calibration can fault on boards where the secondary flash is + // not ready for the sweep. Keep CS1 on the fixed timing path and + // still program its normal-read command/address width above. + return self.configure_timing(cs, spi_clock_mhz); } - self.timing_calibration(cs) - } - - fn configure_timing(&mut self, cs: ChipSelect, spi_clock_mhz: u32) -> Result<(), SmcError> { - // Timing calibration is topology-aware. - // - // For BootSpi (FMC, master_idx=0): Full calibration sweep recommended. - // Boot firmware has exclusive access; full timing margin is priority. - // - // For HostSpi / NormalSpi when master_idx != 0: Shared-bus topology. - // When a secondary master shares the flash bus, calibration on CS1 may need - // to be skipped to avoid interfering with the primary master's calibration. - // Phase 3+: gate calibration logic on config.topology.master_idx(). - // - // For now, all topologies use a single divider lookup; no HCLK sweep. - // Phase 3+: add conditional calibration logic per topology and master_idx. - // pw_log::info!("=== configure_timing()==="); + self.timing_calibration(cs, spi_clock_mhz, window_base) + } + + fn configure_timing(&self, cs: ChipSelect, spi_clock_mhz: u32) -> Result { //TODO: need to get this from scu register let sysclk_mhz = 200u32; let encoded_div = spi_freq_div(sysclk_mhz, spi_clock_mhz)?; @@ -618,21 +528,23 @@ impl Smc { let reg = self.regs.read_cs_ctrl(cs); self.regs .write_cs_ctrl(cs, (reg & !SPI_CTRL_FREQ_MASK) | encoded_div); - self.set_normal_read_ctrl(cs, self.regs.read_cs_ctrl(cs)); - Ok(()) + Ok(self.regs.read_cs_ctrl(cs)) } - fn timing_calibration(&mut self, cs: ChipSelect) -> Result<(), SmcError> { - let cs_cfg = self.cs_config(cs)?; - + fn timing_calibration( + &self, + cs: ChipSelect, + spi_clock_mhz: u32, + window_base: usize, + ) -> Result { if self.regs.already_calibrated(cs) { pw_log::info!("already calibrated"); - return self.configure_timing(cs, cs_cfg.spi_clock_mhz); + return self.configure_timing(cs, spi_clock_mhz); } //SPI2 work around - if self.config.topology.master_idx() != 0 && cs != ChipSelect::Cs0 { - return self.configure_timing(cs, cs_cfg.spi_clock_mhz); + if I::CONFIG.topology.master_idx() != 0 && cs != ChipSelect::Cs0 { + return self.configure_timing(cs, spi_clock_mhz); } // TODO: add SPIM config /* @@ -643,7 +555,7 @@ impl Smc { self.regs.write_cs_ctrl(cs, ctrl_val); let check_buf = unsafe { &mut *CALIBRATION_SCRATCH.0.get() }; - let window = self.flash_window_base(cs) as *const u8; + let window = window_base as *const u8; // TODO: configure timing_calibration_start_offset beside be??? let timing_offset = 0x0; let flash_ptr = window.wrapping_add(timing_offset); @@ -652,23 +564,23 @@ impl Smc { } if !spi_calibration_enable(&check_buf[..])? { - return self.configure_timing(cs, cs_cfg.spi_clock_mhz); + return self.configure_timing(cs, spi_clock_mhz); } - let gold_checksum = self.spi_dma_checksum(cs, 0, 0); - self.run_timing_sweep(cs, cs_cfg, gold_checksum); + let gold_checksum = self.spi_dma_checksum(0, 0, window_base); + self.run_timing_sweep(cs, spi_clock_mhz, gold_checksum, window_base); - self.configure_timing(cs, cs_cfg.spi_clock_mhz) + self.configure_timing(cs, spi_clock_mhz) } - fn spi_dma_checksum(&mut self, cs: ChipSelect, div: u32, delay: u32) -> u32 { + fn spi_dma_checksum(&self, div: u32, delay: u32, window_base: usize) -> u32 { let timing_offset = 0x0; // Request DMA access self.regs.acquire_dma_arbiter(); // Set DMA flash start address - let flash_addr = self.flash_window_base(cs) + timing_offset; + let flash_addr = window_base + timing_offset; self.regs.write_dma_flash_addr(flash_addr as u32); // Set DMA length self.regs.write_dma_len(SPI_CALIB_LEN as u32); @@ -695,10 +607,16 @@ impl Smc { return checksum; } - fn run_timing_sweep(&mut self, cs: ChipSelect, cs_cfg: FlashConfig, gold_checksum: u32) { + fn run_timing_sweep( + &self, + cs: ChipSelect, + spi_clock_mhz: u32, + gold_checksum: u32, + window_base: usize, + ) { let hclk_masks = [7u32, 14, 6, 13]; let mut calib_res = [0u8; 6 * 17]; - let mut freq_to_use = cs_cfg.spi_clock_mhz; + let mut freq_to_use = spi_clock_mhz; let sysclk_div_table = [100u32, 66, 50, 40]; // 200 / [2, 3, 4, 5] for (i, &mask) in hclk_masks.iter().enumerate() { @@ -709,7 +627,7 @@ impl Smc { freq_to_use = freq; - self.spi_dma_checksum(cs, mask, 0); + self.spi_dma_checksum(mask, 0, window_base); calib_res.fill(0); @@ -717,7 +635,7 @@ impl Smc { for delay_ns in 0..=0xf { let reg_val = (1 << 3) | hcycle | (delay_ns << 4); - let checksum = self.spi_dma_checksum(cs, mask, reg_val); + let checksum = self.spi_dma_checksum(mask, reg_val, window_base); let pass = checksum == gold_checksum; let index = (hcycle * 17 + delay_ns) as usize; @@ -749,6 +667,280 @@ impl Smc { } // run_timing_sweep } +/// Per-chip-select handle vended by [`Smc::cs0`] / [`Smc::cs1`]. +/// +/// The chip select is baked into the handle, so reads and transfers take no +/// `ChipSelect` argument. The handle borrows the controller exclusively for its +/// lifetime: reads and transfers are `&self`, DMA is `&mut self`, so the +/// compiler enforces one operation on the controller at a time. +pub struct Cs<'a> { + /// Shared register access: MMIO writes go through `&self`, so a shared + /// borrow suffices. Kept disjoint from `state` so the handle can stay free + /// of the controller's `SmcInstance` type parameter. + regs: &'a SmcRegisters, + /// Exclusive borrow of the controller's operation state; this is what makes + /// the handle exclusive (only one `Cs` can exist at a time) and lets DMA + /// transitions mutate state without threading `Smc`. + state: &'a mut SmcState, + cs: ChipSelect, + window_base: usize, + normal_read_ctrl: u32, + geometry: FlashGeometry, + /// Copied from `I::CONTROLLER` / `I::CONFIG` at construction so the handle + /// needs no generic parameter. + controller_id: SmcController, + master_idx: u8, + dma_enabled: bool, + enable_interrupts: bool, +} + +impl Cs<'_> { + /// The chip select this handle drives. + pub fn chip_select(&self) -> ChipSelect { + self.cs + } + + /// Resolved flash geometry for this chip (SFDP-discovered or pinned). + pub fn geometry(&self) -> FlashGeometry { + self.geometry + } + + /// Flash capacity in bytes for this chip. + pub fn capacity_bytes(&self) -> usize { + self.geometry.capacity_bytes as usize + } + + /// The controller this chip is attached to. + pub fn controller_id(&self) -> SmcController { + self.controller_id + } + + /// The master index of the controller's topology (for SPIM mux routing). + pub fn master_idx(&self) -> u8 { + self.master_idx + } + + /// Perform a programmed I/O read via the memory window. + /// + /// Reads directly from the flash memory window. Hardware automatically + /// converts memory accesses to SPI transactions. + pub fn read(&self, offset: u32, buf: &mut [u8]) -> Result { + let offset = validate_mapped_range(offset, buf.len(), self.capacity_bytes())?; + let flash_ptr = (self.window_base as *const u8).wrapping_add(offset); + pw_log::debug!( + "read: offset0x{:08x}, size:0x{:08x}, flash ptr:0x{:08x}", + offset as u32, + buf.len() as u32, + flash_ptr as u32 + ); + // SAFETY: `flash_ptr` is derived from the controller's fixed MMIO flash + // window via `wrapping_add`; the validated `[offset, offset + buf.len())` + // range lies within this chip's mapped aperture, and `buf` is a valid, + // writable destination disjoint from the MMIO window. + unsafe { + core::ptr::copy_nonoverlapping(flash_ptr, buf.as_mut_ptr(), buf.len()); + } + Ok(buf.len()) + } + + /// Execute a raw user-mode SPI transfer on this chip. + /// + /// The `mode` parameter controls the IO width written to the CS control + /// register for each phase (cmd / addr+payload / rx). + pub fn transceive_user( + &self, + cmd: &[u8], + tx_payload: &[u8], + rx: &mut [u8], + mode: TransferMode, + ) -> Result<(), SmcError> { + if *self.state != SmcState::Idle { + return Err(SmcError::ControllerNotReady); + } + transceive_user_raw( + self.regs, + self.cs, + self.window_base, + self.normal_read_ctrl, + cmd, + tx_payload, + rx, + mode, + ); + Ok(()) + } + + /// Initiate a DMA read operation (non-blocking). + pub fn dma_read( + &mut self, + flash_offset: u32, + dram_addr: usize, + len: u32, + ) -> Result<(), SmcError> { + if *self.state != SmcState::Idle { + return Err(SmcError::ControllerNotReady); + } + if !self.dma_enabled { + return Err(SmcError::DmaNotEnabled); + } + self.regs.disable_dma(); + loop_delay(0x1000); + + let cs_capacity = self.capacity_bytes(); + let validated = + validate_dma_read(flash_offset, self.window_base, cs_capacity, dram_addr, len)?; + pw_log::debug!( + "flash start: 0x{:08x}, cs_cap: 0x{:08x}, dram_addr: 0x{:08x} len: 0x{:08x} ", + validated.flash_start as u32, + cs_capacity as u32, + validated.dram_addr as u32, + validated.dma_len_reg as u32 + ); + + // Set the CS control register to normal-read mode before programming DMA + // registers. The DMA engine reads the CSx control register to know which + // SPI command to issue; it must be in normal-read mode (not user mode) + // before the kick. Matches aspeed-rust fmccontroller.rs::read_dma. + let ctrl_val = self.normal_read_ctrl | ASPEED_SPI_NORMAL_READ; + self.regs.write_cs_ctrl(self.cs, ctrl_val); + + // Acquire the DMA bus arbiter before programming any DMA registers. + self.regs.acquire_dma_arbiter(); + self.regs.write_dma_flash_addr(validated.flash_start as u32); + self.regs + .write_dma_dram_addr(validated.dram_addr + SPI_DMA_RAM_MAP_BASE); + self.regs.write_dma_len(validated.dma_len_reg); + + // Arm the completion IRQ before kicking DMA (QEMU evaluates the enable + // once at DMA-done time and won't re-fire if set afterward). + if self.enable_interrupts { + self.regs.enable_dma_irq(); + } + + self.regs.kick_dma_read(); + *self.state = SmcState::DmaInFlight; + Ok(()) + } + + /// Poll for DMA completion without requiring an IRQ. + /// + /// Returns `Poll::Pending` while the transfer is still in progress, + /// `Poll::Ready(Ok(()))` on success, or `Poll::Ready(Err(..))` on failure / + /// when no DMA is in flight. + pub fn poll_dma_completion(&mut self) -> core::task::Poll> { + if *self.state != SmcState::DmaInFlight { + return core::task::Poll::Ready(Err(SmcError::ControllerNotReady)); + } + let status = self.dma_status(); + if status & DMA_STATUS_RELEVANT_BITS == 0 { + return core::task::Poll::Pending; + } + core::task::Poll::Ready(self.complete_dma(status).map(|_| ())) + } + + /// Decode and complete an in-flight DMA operation from an IRQ event. + pub fn handle_dma_irq(&mut self) -> Result { + self.regs.disable_dma_irq(); + let status = self.dma_status(); + pw_log::info!("SMC handle_dma_irq: status=0x{:08x}", status as u32); + if status & DMA_STATUS_RELEVANT_BITS == 0 { + return Err(SmcError::ControllerNotReady); + } + self.complete_dma(status) + } + + /// Read raw DMA/interrupt status register bits (FMC008). + pub fn dma_status(&self) -> u32 { + self.regs.read_dma_status() + } + + /// Clear DMA-related status bits (write-1-to-clear). + pub fn clear_dma_status(&self, clear_mask: u32) { + self.regs + .clear_dma_status(clear_mask & DMA_STATUS_RELEVANT_BITS); + } + + /// Decode status bits and transition controller state. + /// + /// Assumes `status & DMA_STATUS_RELEVANT_BITS != 0`. + fn complete_dma(&mut self, status: u32) -> Result { + let relevant = status & DMA_STATUS_RELEVANT_BITS; + let dma_in_flight = *self.state == SmcState::DmaInFlight; + let decoded = SmcInterruptDecoder::decode_with_context(status, dma_in_flight); + self.clear_dma_status(relevant); + + match decoded { + SmcInterrupt::DmaComplete => { + self.regs.disable_dma(); + *self.state = SmcState::Idle; + Ok(decoded) + } + SmcInterrupt::DmaError => { + self.regs.disable_dma(); + *self.state = SmcState::Idle; + Err(SmcError::DmaAborted) + } + SmcInterrupt::CommandAbort => { + *self.state = SmcState::Faulted; + Err(SmcError::HardwareError) + } + SmcInterrupt::WriteProtected => { + *self.state = SmcState::Faulted; + Err(SmcError::WriteProtected) + } + SmcInterrupt::Unknown => Err(SmcError::HardwareError), + } + } +} + +/// Raw user-mode SPI transfer (CS-assert → 3-phase → CS-restore) shared by +/// `Smc::transceive_user` and `init`'s SFDP read. Module-private and +/// guardless: assumes segments and the per-CS normal-read snapshot are set. +#[allow(clippy::too_many_arguments)] +fn transceive_user_raw( + regs: &SmcRegisters, + cs: ChipSelect, + window_base: usize, + normal_read_ctrl: u32, + cmd: &[u8], + tx_payload: &[u8], + rx: &mut [u8], + mode: TransferMode, +) { + // Derive user-mode base from the stored normal-read value: preserve + // frequency bits and replace mode type with ASPEED_SPI_USER. + let user_base = (normal_read_ctrl & !0x7) | ASPEED_SPI_USER; + let window = window_base as *mut u32; + + // Assert CS: inactive first, then active (matches aspeed-rust activate_user). + regs.write_cs_ctrl(cs, user_base | ASPEED_SPI_USER_INACTIVE); + regs.write_cs_ctrl(cs, user_base); + + // SAFETY: user mode is active; the flash aperture is the hardware-defined + // byte-stream port for SPI command traffic while user mode is held. + unsafe { + // Command phase — always single-wire. + let cmd_ctrl = (user_base & SPI_CTRL_IO_MODE_MASK) | mode.cmd_io_bits(); + regs.write_cs_ctrl(cs, cmd_ctrl); + spi_write_data(window, cmd); + + // Address / TX payload phase. + let addr_ctrl = (user_base & SPI_CTRL_IO_MODE_MASK) | mode.addr_io_bits(); + regs.write_cs_ctrl(cs, addr_ctrl); + spi_write_data(window, tx_payload); + + // RX data phase. + let data_ctrl = (user_base & SPI_CTRL_IO_MODE_MASK) | mode.data_io_bits(); + regs.write_cs_ctrl(cs, data_ctrl); + spi_read_data(window as *const u32, rx); + } + + // Deassert CS, then restore the pre-computed normal-read configuration + // (matches aspeed-rust deactivate_user restoring cmd_mode[cs].normal_read). + regs.write_cs_ctrl(cs, user_base | ASPEED_SPI_USER_INACTIVE); + regs.write_cs_ctrl(cs, normal_read_ctrl); +} + unsafe fn spi_read_data(ahb_addr: *const u32, read_arr: &mut [u8]) { let len = read_arr.len(); let (chunks, remainder) = read_arr.split_at_mut(len - len % 4); diff --git a/target/ast10x0/peripherals/smc/device/block_device.rs b/target/ast10x0/peripherals/smc/device/block_device.rs index e9112c215..cb6d31115 100644 --- a/target/ast10x0/peripherals/smc/device/block_device.rs +++ b/target/ast10x0/peripherals/smc/device/block_device.rs @@ -4,7 +4,7 @@ //! Contained block-device facade layered on top of `SpiNorFlash`. use crate::smc::device::flash::{JedecId, SpiNorFlash, SpiNorFlashDevice}; -use crate::smc::types::{FlashConfig, SmcError}; +use crate::smc::types::SmcError; /// Geometry and limits exposed by the block facade. #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -18,27 +18,16 @@ pub struct BlockDeviceInfo { /// Minimal block-oriented facade over a `SpiNorFlash` device. pub struct SpiNorBlockDevice<'a, 'b> { flash: &'a mut SpiNorFlash<'b>, - cfg: FlashConfig, } impl<'a, 'b> SpiNorBlockDevice<'a, 'b> { - /// Build a block facade from an existing `SpiNorFlash` plus known config. - pub fn from_flash(flash: &'a mut SpiNorFlash<'b>, cfg: FlashConfig) -> Result { - let expected = cfg_capacity_bytes(cfg)?; - let actual = SpiNorFlashDevice::capacity_bytes(flash)?; - if expected != actual { + /// Build a block facade from an existing `SpiNorFlash`. + pub fn from_flash(flash: &'a mut SpiNorFlash<'b>) -> Result { + let g = flash.geometry(); + if g.page_size == 0 || g.sector_size == 0 || g.block_size == 0 { return Err(SmcError::InvalidCapacity); } - if cfg.page_size == 0 || cfg.sector_size == 0 || cfg.block_size == 0 { - return Err(SmcError::InvalidCapacity); - } - Ok(Self { flash, cfg }) - } - - /// Build a block facade by mapping a JEDEC ID to a known flash profile. - pub fn from_jedec_id(flash: &'a mut SpiNorFlash<'b>, jedec: JedecId) -> Result { - let cfg = cfg_from_jedec(jedec)?; - Self::from_flash(flash, cfg) + Ok(Self { flash }) } /// Read bytes from the block device. @@ -51,7 +40,7 @@ impl<'a, 'b> SpiNorBlockDevice<'a, 'b> { if data.is_empty() { return Ok(0); } - let page = self.cfg.page_size as usize; + let page = self.flash.geometry().page_size as usize; if (address as usize) % page != 0 { return Err(SmcError::InvalidCapacity); } @@ -63,7 +52,7 @@ impl<'a, 'b> SpiNorBlockDevice<'a, 'b> { if length == 0 { return Ok(()); } - let sector = self.cfg.sector_size; + let sector = self.flash.geometry().sector_size; if !address.is_multiple_of(sector) || !length.is_multiple_of(sector) { return Err(SmcError::InvalidCapacity); } @@ -72,11 +61,12 @@ impl<'a, 'b> SpiNorBlockDevice<'a, 'b> { /// Return block-device geometry. pub fn info(&self) -> Result { + let g = self.flash.geometry(); Ok(BlockDeviceInfo { - capacity_bytes: cfg_capacity_bytes(self.cfg)?, - page_size: self.cfg.page_size as usize, - sector_size: self.cfg.sector_size as usize, - block_size: self.cfg.block_size as usize, + capacity_bytes: g.capacity_bytes as usize, + page_size: g.page_size as usize, + sector_size: g.sector_size as usize, + block_size: g.block_size as usize, }) } @@ -85,24 +75,3 @@ impl<'a, 'b> SpiNorBlockDevice<'a, 'b> { self.flash.jedec() } } - -fn cfg_capacity_bytes(cfg: FlashConfig) -> Result { - (cfg.capacity_mb as usize) - .checked_mul(1024 * 1024) - .ok_or(SmcError::InvalidCapacity) -} - -fn cfg_from_jedec(jedec: JedecId) -> Result { - match (jedec.manufacturer, jedec.memory_type, jedec.capacity_code) { - (0xEF, 0x40, 0x17) => Ok(FlashConfig::winbond_w25q64()), - (0xEF, 0x40, 0x18) => Ok(FlashConfig { - capacity_mb: 16, - page_size: 256, - sector_size: 4096, - block_size: 65536, - spi_clock_mhz: 25, - }), - (0xEF, 0x40, 0x19) => Ok(FlashConfig::winbond_w25q256()), - _ => Err(SmcError::DeviceNotSupported), - } -} diff --git a/target/ast10x0/peripherals/smc/device/flash.rs b/target/ast10x0/peripherals/smc/device/flash.rs index 3815cfef0..b725e1620 100644 --- a/target/ast10x0/peripherals/smc/device/flash.rs +++ b/target/ast10x0/peripherals/smc/device/flash.rs @@ -7,9 +7,9 @@ use core::ops::FnMut; use core::result::Result; use core::result::Result::{Err, Ok}; -use crate::smc::fmc::FmcReady; -use crate::smc::spi::SpiReady; -use crate::smc::types::{AddressWidth, ChipSelect, FlashConfig, SmcError, TransferMode}; +use crate::smc::controller::Cs; +use crate::smc::types::{AddressWidth, SmcError, TransferMode}; +use util_sfdp::FlashGeometry; /// Build a command byte array: opcode followed by address bytes selected by /// `width`. Returns a fixed-size buffer and the valid length. @@ -45,6 +45,21 @@ fn encode_addr_cmd(opcode: u8, offset: u32, width: AddressWidth) -> ([u8; 5], us } } +/// Validate a single page-program operation. +/// +/// SPI NOR page program wraps at page boundaries, so a write that crosses one +/// would silently corrupt the start of the page; reject it instead. Unaligned +/// starts *within* a page are legal. +fn validate_page_program_bounds(page_size: usize, offset: u32, len: usize) -> Result<(), SmcError> { + if page_size == 0 || len == 0 || len > page_size { + return Err(SmcError::InvalidCapacity); + } + if (offset as usize) % page_size + len > page_size { + return Err(SmcError::InvalidCapacity); + } + Ok(()) +} + /// Minimal SPI NOR flash device API. pub trait SpiNorFlashDevice { /// Read bytes from flash at `offset` into `buf`. @@ -176,11 +191,6 @@ fn poll_delay() { } } -enum FlashBackend<'a> { - Fmc(&'a FmcReady), - Spi(&'a SpiReady), -} - /// Decoded JEDEC identifier returned by `READ_ID` (`0x9F`). #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct JedecId { @@ -214,11 +224,10 @@ fn expect_jedec_match(actual: JedecId, expected: JedecId) -> Result { - backend: FlashBackend<'a>, + /// Per-chip handle; the chip select is baked in. + cs: Cs<'a>, // Validated metadata for Phase 3B alignment/policy checks. - cfg: FlashConfig, - /// Chip select this flash device sits on. - cs: ChipSelect, + cfg: FlashGeometry, /// IO mode used for all SPI command transactions (WREN, RDSR, PP, SE). /// Defaults to `Mode111` (single-wire cmd/addr/data). cmd_mode: TransferMode, @@ -229,46 +238,17 @@ pub struct SpiNorFlash<'a> { } impl<'a> SpiNorFlash<'a> { - /// Build a flash facade from an initialized FMC controller wrapper. - pub fn from_fmc(fmc: &'a mut FmcReady, cfg: FlashConfig) -> Result { - Self::from_fmc_cs(fmc, cfg, ChipSelect::Cs0) - } - - /// Build a flash facade from an initialized FMC controller wrapper with explicit CS. - pub fn from_fmc_cs( - fmc: &'a mut FmcReady, - cfg: FlashConfig, - cs: ChipSelect, - ) -> Result { + /// Build a flash facade from a per-chip [`Cs`] handle. + /// + /// The handle already carries the resolved flash geometry (pinned or + /// SFDP-discovered) and the chip select, so no `ChipSelect` argument is + /// needed here. + pub fn new(cs: Cs<'a>) -> Result { + let cfg = cs.geometry(); let addressing_policy = Self::default_addressing_for_cfg(cfg); - Self::validate_capacity_cfg(cfg, fmc.cs_config(cs)?)?; Ok(Self { - backend: FlashBackend::Fmc(fmc), - cfg, cs, - cmd_mode: TransferMode::Mode111, - addressing_policy, - command_profile: FlashCommandProfile::for_addressing(addressing_policy), - }) - } - - /// Build a flash facade from an initialized SPI1/SPI2 controller wrapper. - pub fn from_spi(spi: &'a mut SpiReady, cfg: FlashConfig) -> Result { - Self::from_spi_cs(spi, cfg, ChipSelect::Cs0) - } - - /// Build a flash facade from an initialized SPI1/SPI2 controller wrapper with explicit CS. - pub fn from_spi_cs( - spi: &'a mut SpiReady, - cfg: FlashConfig, - cs: ChipSelect, - ) -> Result { - let addressing_policy = Self::default_addressing_for_cfg(cfg); - Self::validate_capacity_cfg(cfg, spi.cs_config(cs)?)?; - Ok(Self { - backend: FlashBackend::Spi(spi), cfg, - cs, cmd_mode: TransferMode::Mode111, addressing_policy, command_profile: FlashCommandProfile::for_addressing(addressing_policy), @@ -383,21 +363,19 @@ impl<'a> SpiNorFlash<'a> { Ok(written) } - fn validate_capacity_cfg(cfg: FlashConfig, expected: FlashConfig) -> Result<(), SmcError> { - if cfg != expected { - return Err(SmcError::InvalidCapacity); - } - Ok(()) - } - - fn default_addressing_for_cfg(cfg: FlashConfig) -> FlashAddressingPolicy { - if cfg.capacity_mb > 16 { + fn default_addressing_for_cfg(cfg: FlashGeometry) -> FlashAddressingPolicy { + if cfg.capacity_bytes > 16 * 1024 * 1024 { FlashAddressingPolicy::FourByteCommands } else { FlashAddressingPolicy::ThreeByteOnly } } + /// Return the SFDP-discovered geometry for this device. + pub fn geometry(&self) -> FlashGeometry { + self.cfg + } + pub fn addr_width(&self) -> AddressWidth { self.addressing_policy.addr_width() } @@ -408,8 +386,8 @@ impl<'a> SpiNorFlash<'a> { /// Validate a device-local offset before handing it to the controller. /// - /// `FmcReady::read` / `SpiReady::read` already select the per-CS AHB - /// window from the chip-select argument, so offsets stay CS-local here. + /// The `Cs` handle already selects the per-CS AHB window, so offsets stay + /// CS-local here. fn device_to_controller_offset(&self, device_offset: u32) -> Result { let cs_cap = self.capacity_bytes()?; if (device_offset as usize) >= cs_cap { @@ -436,49 +414,28 @@ impl<'a> SpiNorFlash<'a> { } fn validate_page_program(&self, offset: u32, data: &[u8]) -> Result<(), SmcError> { - let page_size = self.cfg.page_size as usize; - if page_size == 0 || data.is_empty() || data.len() > page_size { - return Err(SmcError::InvalidCapacity); - } - if (offset as usize) % page_size != 0 { - return Err(SmcError::InvalidCapacity); - } + validate_page_program_bounds(self.cfg.page_size as usize, offset, data.len())?; self.validate_range(offset, data.len()) } fn issue_command(&mut self, cmd: &[u8], payload: &[u8]) -> Result<(), SmcError> { - let cs = self.cs; let mode = self.cmd_mode; - match &self.backend { - FlashBackend::Fmc(fmc) => fmc.transceive_user(cs, cmd, payload, &mut [], mode), - FlashBackend::Spi(spi) => spi.transceive_user(cs, cmd, payload, &mut [], mode), - } + self.cs.transceive_user(cmd, payload, &mut [], mode) } fn read_status_impl(&self) -> Result { - let cs = self.cs; let mode = self.cmd_mode; let opcode = self.command_profile().read_status; let mut status = [0u8; 1]; - match &self.backend { - FlashBackend::Fmc(fmc) => fmc.transceive_user(cs, &[opcode], &[], &mut status, mode)?, - FlashBackend::Spi(spi) => spi.transceive_user(cs, &[opcode], &[], &mut status, mode)?, - } + self.cs.transceive_user(&[opcode], &[], &mut status, mode)?; Ok(status[0]) } fn read_jedec_id_impl(&self) -> Result<[u8; 3], SmcError> { - let cs = self.cs; let mode = self.cmd_mode; let mut id = [0u8; 3]; - match &self.backend { - FlashBackend::Fmc(fmc) => { - fmc.transceive_user(cs, &[commands::READ_ID], &[], &mut id, mode)? - } - FlashBackend::Spi(spi) => { - spi.transceive_user(cs, &[commands::READ_ID], &[], &mut id, mode)? - } - } + self.cs + .transceive_user(&[commands::READ_ID], &[], &mut id, mode)?; Ok(id) } @@ -507,20 +464,13 @@ impl SpiNorFlashDevice for SpiNorFlash<'_> { // the controller-window address before issuing the segment-routed read. self.validate_range(offset, buf.len())?; let translated = self.device_to_controller_offset(offset)?; - let cs = self.cs; //TODO: need to add dma_read variant if buf.len() is above some threshold // and dma is enabled - match &self.backend { - FlashBackend::Fmc(fmc) => fmc.read(cs, translated, buf), - FlashBackend::Spi(spi) => spi.read(cs, translated, buf), - } + self.cs.read(translated, buf) } fn capacity_bytes(&self) -> Result { - match &self.backend { - FlashBackend::Fmc(fmc) => fmc.cs_capacity_bytes(self.cs), - FlashBackend::Spi(spi) => spi.cs_capacity_bytes(self.cs), - } + Ok(self.cs.capacity_bytes()) } fn erase_sector(&mut self, offset: u32) -> Result<(), SmcError> { @@ -566,7 +516,8 @@ mod tests { commands, compare_chunked, encode_addr_cmd, expect_jedec_match, FlashAddressingPolicy, FlashCommandProfile, JedecId, SpiNorFlash, }; - use crate::smc::types::{AddressWidth, FlashConfig, SmcError}; + use crate::smc::types::{AddressWidth, SmcError}; + use util_sfdp::FlashGeometry; #[test] fn encode_addr_cmd_none_emits_opcode_only() { @@ -612,23 +563,21 @@ mod tests { #[test] fn default_addressing_policy_derives_from_capacity() { assert_eq!( - SpiNorFlash::default_addressing_for_cfg(FlashConfig { - capacity_mb: 8, + SpiNorFlash::default_addressing_for_cfg(FlashGeometry { + capacity_bytes: 8 * 1024 * 1024, page_size: 256, sector_size: 4096, block_size: 65536, - spi_clock_mhz: 25, }), FlashAddressingPolicy::ThreeByteOnly ); assert_eq!( - SpiNorFlash::default_addressing_for_cfg(FlashConfig { - capacity_mb: 32, + SpiNorFlash::default_addressing_for_cfg(FlashGeometry { + capacity_bytes: 32 * 1024 * 1024, page_size: 256, sector_size: 4096, block_size: 65536, - spi_clock_mhz: 25, }), FlashAddressingPolicy::FourByteCommands ); @@ -695,4 +644,43 @@ mod tests { Err(SmcError::HardwareError) ); } + + #[test] + fn page_program_bounds_accepts_aligned_full_page() { + assert_eq!(super::validate_page_program_bounds(256, 0x100, 256), Ok(())); + } + + #[test] + fn page_program_bounds_accepts_unaligned_within_page() { + assert_eq!(super::validate_page_program_bounds(256, 0x105, 37), Ok(())); + assert_eq!(super::validate_page_program_bounds(256, 0x1ff, 1), Ok(())); + } + + #[test] + fn page_program_bounds_rejects_page_crossing() { + assert_eq!( + super::validate_page_program_bounds(256, 0x1ff, 2), + Err(SmcError::InvalidCapacity) + ); + assert_eq!( + super::validate_page_program_bounds(256, 0x10, 256), + Err(SmcError::InvalidCapacity) + ); + } + + #[test] + fn page_program_bounds_rejects_empty_and_oversized() { + assert_eq!( + super::validate_page_program_bounds(256, 0x100, 0), + Err(SmcError::InvalidCapacity) + ); + assert_eq!( + super::validate_page_program_bounds(256, 0x100, 257), + Err(SmcError::InvalidCapacity) + ); + assert_eq!( + super::validate_page_program_bounds(0, 0x100, 16), + Err(SmcError::InvalidCapacity) + ); + } } diff --git a/target/ast10x0/peripherals/smc/fmc.rs b/target/ast10x0/peripherals/smc/fmc.rs index bce687f5f..5d8a14929 100644 --- a/target/ast10x0/peripherals/smc/fmc.rs +++ b/target/ast10x0/peripherals/smc/fmc.rs @@ -16,77 +16,63 @@ //! //! See [`crate::smc`] module-level documentation for the full taxonomy. -use crate::smc::controller::{ReadySmc, UninitSmc}; -use crate::smc::interrupts::SmcInterrupt; -use crate::smc::types::{ - ChipSelect, FlashConfig, SmcConfig, SmcController, SmcError, TransferMode, -}; +use util_region::{Mmap, Region}; + +use crate::smc::controller::{Cs, ReadySmc, UninitSmc}; +use crate::smc::types::{SmcController, SmcError, SmcInstance}; /// FMC handle before hardware initialization. -pub struct FmcUninit { - inner: UninitSmc, +pub struct FmcUninit { + inner: UninitSmc, } /// FMC handle after hardware initialization. -pub struct FmcReady { - inner: ReadySmc, +/// +/// Per-chip operations (read, transfer, DMA) are reached through a [`Cs`] handle +/// vended by [`FmcReady::cs0`] / [`FmcReady::cs1`]; the chip select is baked into +/// that handle rather than passed on every call. +pub struct FmcReady { + inner: ReadySmc, } -impl FmcUninit { - /// Construct an uninitialized FMC controller. - /// - /// # Safety - /// Caller must ensure unique ownership of the FMC hardware block. - pub unsafe fn new(mut config: SmcConfig) -> Result { - config.controller_id = SmcController::Fmc; - // SAFETY: Caller upholds controller ownership requirements. - let inner = unsafe { UninitSmc::new(config)? }; +impl FmcUninit { + /// Construct an uninitialized FMC controller from the regions mapped to it. + pub fn new( + region: Region, + cs0_window: Region, + cs1_window: Region, + ) -> Result + where + Cs0: Mmap, + Cs1: Mmap, + { + const { + assert!( + matches!(I::CONTROLLER, SmcController::Fmc), + "FmcUninit requires an SmcInstance whose CONTROLLER is Fmc" + ); + } + let inner = UninitSmc::::new(region, cs0_window, cs1_window)?; Ok(Self { inner }) } /// Initialize FMC hardware and transition to ready state. - pub fn init(self) -> Result { + pub fn init(self) -> Result, SmcError> { Ok(FmcReady { inner: self.inner.init()?, }) } } -impl FmcReady { - /// Perform a programmed I/O read via the FMC flash window. - pub fn read(&self, cs: ChipSelect, offset: u32, buf: &mut [u8]) -> Result { - self.inner.read(cs, offset, buf) - } - - /// Initiate a DMA read operation. - pub fn dma_read( - &mut self, - cs: ChipSelect, - flash_offset: u32, - dram_addr: usize, - len: u32, - ) -> Result<(), SmcError> { - self.inner.dma_read(cs, flash_offset, dram_addr, len) - } - - /// Read raw DMA/interrupt status bits from FMC008. - pub fn dma_status(&self) -> u32 { - self.inner.dma_status() - } - - /// Clear DMA-related status bits in FMC008 (write-1-to-clear). - pub fn clear_dma_status(&self, clear_mask: u32) { - self.inner.clear_dma_status(clear_mask) - } - - /// Handle DMA completion/error from IRQ status and finalize controller state. - pub fn handle_dma_irq(&mut self) -> Result { - self.inner.handle_dma_irq() +impl FmcReady { + /// Build a handle for CS0 from its init-resolved geometry. + pub fn cs0(&mut self) -> Result, SmcError> { + self.inner.cs0() } - /// Poll for DMA completion without requiring an IRQ. See `Smc::poll_dma_completion`. - pub fn poll_dma_completion(&mut self) -> core::task::Poll> { - self.inner.poll_dma_completion() + /// Build a handle for CS1 from its init-resolved geometry. + pub fn cs1(&mut self) -> Result, SmcError> { + self.inner.cs1() } /// Check if FMC is ready for operations. @@ -94,65 +80,13 @@ impl FmcReady { self.inner.is_ready() } - /// Program memory-mapped SPI NOR read mode for the selected chip select. - pub fn spi_nor_read_init(&mut self, cs: ChipSelect) -> Result<(), SmcError> { - self.inner.spi_nor_read_init(cs) + /// Get the controller identifier. + pub fn controller_id(&self) -> SmcController { + self.inner.controller_id() } #[doc(hidden)] pub fn test_force_dma_in_flight(&mut self) { self.inner.test_force_dma_in_flight(); } - - /// Return configured flash capacity in bytes. - pub fn capacity_bytes(&self) -> Result { - self.inner.capacity_bytes() - } - - /// Return configured flash capacity in bytes for the given chip select. - pub fn cs_capacity_bytes(&self, cs: ChipSelect) -> Result { - self.inner.cs_capacity_bytes(cs) - } - - /// Return the configured `FlashConfig` for the requested chip select. - pub fn cs_config(&self, cs: ChipSelect) -> Result { - self.inner.cs_config(cs) - } - - /// Execute a raw user-mode SPI transfer on the selected FMC chip select. - /// - /// `cs` selects CS0 or CS1; `mode` controls the per-phase IO width. - /// Returns `SmcError::InvalidChipSelect` if CS1 is requested but not configured. - pub fn transceive_user( - &self, - cs: ChipSelect, - cmd: &[u8], - tx_payload: &[u8], - rx: &mut [u8], - mode: TransferMode, - ) -> Result<(), SmcError> { - self.inner.transceive_user(cs, cmd, tx_payload, rx, mode) - } - - /// Convenience wrapper: execute a user-mode transfer on CS0. - pub fn transceive_user_cs0( - &self, - cmd: &[u8], - tx_payload: &[u8], - rx: &mut [u8], - mode: TransferMode, - ) -> Result<(), SmcError> { - self.inner - .transceive_user(ChipSelect::Cs0, cmd, tx_payload, rx, mode) - } - - /// Access the underlying generic ready controller. - pub fn as_inner(&self) -> &ReadySmc { - &self.inner - } - - /// Mutable access to the underlying generic ready controller. - pub fn as_inner_mut(&mut self) -> &mut ReadySmc { - &mut self.inner - } } diff --git a/target/ast10x0/peripherals/smc/helpers.rs b/target/ast10x0/peripherals/smc/helpers.rs index 6328f0fc2..df1fd0849 100644 --- a/target/ast10x0/peripherals/smc/helpers.rs +++ b/target/ast10x0/peripherals/smc/helpers.rs @@ -5,12 +5,9 @@ use core::convert::TryFrom; -use crate::smc::types::ChipSelect; -use crate::smc::types::FlashConfig; -use crate::smc::types::SmcConfig; use crate::smc::types::SmcError; -const SMC_WINDOW_SIZE_BYTES: usize = 256 * 1024 * 1024; +pub(crate) const SMC_WINDOW_SIZE_BYTES: usize = 256 * 1024 * 1024; const DMA_MAX_TRANSFER_LENGTH: u32 = 0x20_0000; // 32MBytes pub(crate) const SPI_CTRL_FREQ_MASK: u32 = 0x0F00_0F00; @@ -64,41 +61,6 @@ pub(crate) struct ValidatedDmaRead { pub dma_len_reg: u32, } -pub(crate) fn flash_capacity_bytes(config: Option) -> Result { - match config { - Some(config) => (config.capacity_mb as usize) - .checked_mul(1024 * 1024) - .ok_or(SmcError::InvalidCapacity), - None => Ok(0), - } -} - -pub(crate) fn cs_capacity_bytes(config: &SmcConfig, cs: ChipSelect) -> Result { - let slot = match cs { - ChipSelect::Cs0 => config.cs0, - ChipSelect::Cs1 => config.cs1, - }; - match slot { - Some(_) => flash_capacity_bytes(slot), - None => Err(SmcError::InvalidChipSelect), - } -} - -pub(crate) fn total_capacity_bytes( - cs0: Option, - cs1: Option, -) -> Result { - let cs0_size = flash_capacity_bytes(cs0)?; - let cs1_size = flash_capacity_bytes(cs1)?; - let total = cs0_size - .checked_add(cs1_size) - .ok_or(SmcError::InvalidCapacity)?; - if total > SMC_WINDOW_SIZE_BYTES { - return Err(SmcError::InvalidCapacity); - } - Ok(total) -} - pub(crate) fn validate_mapped_range( offset: u32, len: usize, @@ -167,7 +129,7 @@ pub(crate) fn validate_dma_read( /// Encode an FMC memory segment into hardware register format. /// /// FMC decode fields use 512 KiB alignment. `end` is exclusive. -pub(crate) fn encode_fmc_segment(start: usize, end: usize) -> Result { +pub(crate) const fn encode_fmc_segment(start: usize, end: usize) -> Result { if end == 0 || end <= start { return Err(SmcError::InvalidCapacity); } @@ -180,7 +142,7 @@ pub(crate) fn encode_fmc_segment(start: usize, end: usize) -> Result Result { +pub(crate) const fn encode_spi_segment(start: usize, end: usize) -> Result { if end == 0 || end <= start { return Err(SmcError::InvalidCapacity); } @@ -345,27 +307,6 @@ mod tests { assert!(result.is_err()); } - #[test] - fn test_total_capacity_overflow() { - let result = total_capacity_bytes( - Some(FlashConfig { - capacity_mb: 128, - page_size: 256, - sector_size: 4096, - block_size: 65536, - spi_clock_mhz: 25, - }), - Some(FlashConfig { - capacity_mb: 129, - page_size: 256, - sector_size: 4096, - block_size: 65536, - spi_clock_mhz: 25, - }), - ); - assert!(result.is_err()); - } - #[test] fn test_validate_mapped_range_accepts_exact_fit() { let offset = validate_mapped_range(4092, 4, 4096).unwrap(); diff --git a/target/ast10x0/peripherals/smc/mod.rs b/target/ast10x0/peripherals/smc/mod.rs index f494922e7..a8d197a97 100644 --- a/target/ast10x0/peripherals/smc/mod.rs +++ b/target/ast10x0/peripherals/smc/mod.rs @@ -15,7 +15,9 @@ pub mod registers; pub mod spi; pub mod types; -pub use controller::{Ready, ReadySmc, Smc, UninitSmc, Uninitialized}; +pub use controller::{ + Cs, GeometrySource, Pinned, Ready, ReadySmc, Smc, SmcMode, UninitSmc, Uninitialized, +}; pub use device::{ BlockDeviceInfo, FlashAddressingPolicy, FlashCommandProfile, JedecId, SpiNorBlockDevice, SpiNorFlash, SpiNorFlashDevice, @@ -24,9 +26,10 @@ pub use fmc::{FmcReady, FmcUninit}; pub use interrupts::{SmcInterrupt, SmcInterruptDecoder}; pub use spi::{SpiReady, SpiTransaction, SpiUninit}; pub use types::{ - AddressWidth, ChipSelect, FlashConfig, SmcConfig, SmcController, SmcError, SmcRetryable, - SmcTopology, TransferMode, + AddressWidth, ChipSelect, Discover, FlashConfig, SmcConfig, SmcController, SmcError, + SmcInstance, SmcRetryable, SmcTopology, TransferMode, }; +pub use util_sfdp::FlashGeometry; /// Result type for SMC operations pub type Result = core::result::Result; diff --git a/target/ast10x0/peripherals/smc/spi/spi.rs b/target/ast10x0/peripherals/smc/spi/spi.rs index 343b70873..a8b062587 100644 --- a/target/ast10x0/peripherals/smc/spi/spi.rs +++ b/target/ast10x0/peripherals/smc/spi/spi.rs @@ -12,20 +12,19 @@ //! //! The wrapper's role is **construction and delegation only**: //! - `SpiUninit::new()`: Type-check that controller_id is SPI1 or SPI2 (not FMC) -//! - `SpiReady` methods: Delegate to inner controller operations +//! - `SpiReady::cs0` / `cs1`: Vend a per-chip [`Cs`] handle //! -//! For BootSpi (FMC), use `Smc` directly. +//! For BootSpi (FMC), use the [`crate::smc::fmc`] wrapper. //! For HostSpi/NormalSpi (SPI1/SPI2), use this wrapper. -use crate::smc::controller::{ReadySmc, UninitSmc}; -use crate::smc::interrupts::SmcInterrupt; -use crate::smc::types::{ - ChipSelect, FlashConfig, SmcConfig, SmcController, SmcError, TransferMode, -}; +use util_region::{Mmap, Region}; + +use crate::smc::controller::{Cs, ReadySmc, UninitSmc}; +use crate::smc::types::{SmcController, SmcError, SmcInstance}; /// SPI handle before hardware initialization. -pub struct SpiUninit { - inner: UninitSmc, +pub struct SpiUninit { + inner: UninitSmc, } /// SPI handle after hardware initialization. @@ -37,90 +36,60 @@ pub struct SpiUninit { /// programming) is handled by the controller layer, not here. This keeps the wrapper /// thin and the topology logic centralized. /// -/// # Example -/// -/// ```ignore -/// let mut spi = unsafe { SpiUninit::new(SmcController::Spi1, config)? }; -/// let spi = spi.init()?; // Topology-gated behaviors in controller.init() -/// spi.read(0, &mut buf)?; -/// ``` -pub struct SpiReady { - inner: ReadySmc, +/// Per-chip operations (read, transfer, DMA) are reached through a [`Cs`] handle +/// vended by [`SpiReady::cs0`] / [`SpiReady::cs1`]; SPIM mux bracketing is layered +/// on top of that handle by [`crate::smc::spi::SpiTransaction`]. +pub struct SpiReady { + inner: ReadySmc, } -impl SpiUninit { - /// Construct an uninitialized SPI controller for SPI1 or SPI2. +impl SpiUninit { + /// Construct an uninitialized SPI controller for SPI1 or SPI2 from the + /// regions mapped to it. /// /// # Topology Requirements /// /// The SPI wrapper is for HostSpi and NormalSpi topologies only. - /// BootSpi (FMC) should use the generic Smc directly. - /// - /// # Safety - /// Caller must ensure unique ownership of the selected SPI hardware block. - pub unsafe fn new( - controller_id: SmcController, - mut config: SmcConfig, - ) -> Result { - // Phase 3: Topology-aware SPI construction check. - // + /// BootSpi (FMC) should use the [`crate::smc::fmc`] wrapper. + pub fn new( + region: Region, + cs0_window: Region, + cs1_window: Region, + ) -> Result + where + Cs0: Mmap, + Cs1: Mmap, + { // The SPI wrapper is specialized for HostSpi and NormalSpi topologies. - // FMC (BootSpi topology) uses the generic controller with FmcRegisterBackend. - // This check enforces that constraint at construction time. - match controller_id { - SmcController::Fmc => return Err(SmcError::InvalidChipSelect), - SmcController::Spi1 | SmcController::Spi2 => {} + // FMC (BootSpi topology) uses the FMC wrapper. Enforce that here. + const { + assert!( + !matches!(I::CONTROLLER, SmcController::Fmc), + "SpiUninit requires an SmcInstance whose CONTROLLER is Spi1 or Spi2" + ); } - config.controller_id = controller_id; - // SAFETY: Caller upholds controller ownership requirements. - let inner = unsafe { UninitSmc::new(config)? }; + let inner = UninitSmc::::new(region, cs0_window, cs1_window)?; Ok(Self { inner }) } /// Initialize SPI hardware and transition to ready state. - pub fn init(self) -> Result { + pub fn init(self) -> Result, SmcError> { Ok(SpiReady { inner: self.inner.init()?, }) } } -impl SpiReady { - /// Perform a programmed I/O read via the SPI flash window. - pub fn read(&self, cs: ChipSelect, offset: u32, buf: &mut [u8]) -> Result { - self.inner.read(cs, offset, buf) - } - - /// Initiate a DMA read operation. - pub fn dma_read( - &mut self, - cs: ChipSelect, - flash_offset: u32, - dram_addr: usize, - len: u32, - ) -> Result<(), SmcError> { - self.inner.dma_read(cs, flash_offset, dram_addr, len) - } - - /// Read raw DMA/interrupt status bits from FMC008. - pub fn dma_status(&self) -> u32 { - self.inner.dma_status() +impl SpiReady { + /// Build a handle for CS0 from its init-resolved geometry. + pub fn cs0(&mut self) -> Result, SmcError> { + self.inner.cs0() } - /// Clear DMA-related status bits in FMC008 (write-1-to-clear). - pub fn clear_dma_status(&self, clear_mask: u32) { - self.inner.clear_dma_status(clear_mask) - } - - /// Handle DMA completion/error from IRQ status and finalize controller state. - pub fn handle_dma_irq(&mut self) -> Result { - self.inner.handle_dma_irq() - } - - /// Poll for DMA completion without requiring an IRQ. See `Smc::poll_dma_completion`. - pub fn poll_dma_completion(&mut self) -> core::task::Poll> { - self.inner.poll_dma_completion() + /// Build a handle for CS1 from its init-resolved geometry. + pub fn cs1(&mut self) -> Result, SmcError> { + self.inner.cs1() } /// Get the controller identifier. @@ -137,61 +106,4 @@ impl SpiReady { pub fn is_ready(&self) -> bool { self.inner.is_ready() } - - /// Program memory-mapped SPI NOR read mode for the selected chip select. - pub fn spi_nor_read_init(&mut self, cs: ChipSelect) -> Result<(), SmcError> { - self.inner.spi_nor_read_init(cs) - } - - /// Return configured flash capacity in bytes. - pub fn capacity_bytes(&self) -> Result { - self.inner.capacity_bytes() - } - - /// Return configured flash capacity in bytes for the given chip select. - pub fn cs_capacity_bytes(&self, cs: ChipSelect) -> Result { - self.inner.cs_capacity_bytes(cs) - } - - /// Return the configured `FlashConfig` for the requested chip select. - pub fn cs_config(&self, cs: ChipSelect) -> Result { - self.inner.cs_config(cs) - } - - /// Execute a raw user-mode SPI transfer on the selected SPI chip select. - /// - /// `cs` selects CS0 or CS1; `mode` controls the per-phase IO width. - /// Returns `SmcError::InvalidChipSelect` if CS1 is requested but not configured. - pub fn transceive_user( - &self, - cs: ChipSelect, - cmd: &[u8], - tx_payload: &[u8], - rx: &mut [u8], - mode: TransferMode, - ) -> Result<(), SmcError> { - self.inner.transceive_user(cs, cmd, tx_payload, rx, mode) - } - - /// Convenience wrapper: execute a user-mode transfer on CS0. - pub fn transceive_user_cs0( - &self, - cmd: &[u8], - tx_payload: &[u8], - rx: &mut [u8], - mode: TransferMode, - ) -> Result<(), SmcError> { - self.inner - .transceive_user(ChipSelect::Cs0, cmd, tx_payload, rx, mode) - } - - /// Access the underlying generic ready controller. - pub fn as_inner(&self) -> &ReadySmc { - &self.inner - } - - /// Mutable access to the underlying generic ready controller. - pub fn as_inner_mut(&mut self) -> &mut ReadySmc { - &mut self.inner - } } diff --git a/target/ast10x0/peripherals/smc/spi/spi_transaction.rs b/target/ast10x0/peripherals/smc/spi/spi_transaction.rs index 02c2f2991..fb3e93e83 100644 --- a/target/ast10x0/peripherals/smc/spi/spi_transaction.rs +++ b/target/ast10x0/peripherals/smc/spi/spi_transaction.rs @@ -5,10 +5,10 @@ use core::task::Poll; -use super::spi::SpiReady; use crate::scu::{ScuRegisters, SpiMonitorInstance, SpiMonitorSource, SpimGpioOriVal}; +use crate::smc::controller::Cs; use crate::smc::interrupts::SmcInterrupt; -use crate::smc::types::{ChipSelect, SmcController, SmcError, TransferMode}; +use crate::smc::types::{SmcController, SmcError, TransferMode}; #[derive(Clone, Copy)] struct SpiMuxState { @@ -19,15 +19,18 @@ struct SpiMuxState { /// In-flight SPI transaction state. /// -/// Synchronous helpers hide this state entirely. DMA returns it so the mux can -/// stay enabled until DMA completion. +/// Wraps a per-chip [`Cs`] handle and brackets the operation with SPIM +/// internal-mux setup/restore. The chip select is baked into the handle, so no +/// `ChipSelect` argument is threaded through. Synchronous helpers hide the mux +/// state entirely; DMA returns the transaction so the mux stays enabled until +/// DMA completion. pub struct SpiTransaction<'a> { - spi: &'a mut SpiReady, + cs: Cs<'a>, previous_mux: Option, } impl<'a> SpiTransaction<'a> { - fn begin(spi: &'a mut SpiReady, spim: Option) -> Result { + fn begin(cs: Cs<'a>, spim: Option) -> Result { let mut mux_state = SpiMuxState { spim_present: spim.is_some(), internal_mux_active: false, @@ -39,8 +42,8 @@ impl<'a> SpiTransaction<'a> { scu.validate_spim_instance(spim) .map_err(|_| SmcError::HardwareError)?; - if spi.master_idx() != 0 { - scu.set_spim_internal_mux(Self::spim_source(spi)?, spim as u8 + 1) + if cs.master_idx() != 0 { + scu.set_spim_internal_mux(Self::spim_source(&cs)?, spim as u8 + 1) .map_err(|_| SmcError::HardwareError)?; mux_state.internal_mux_active = true; } @@ -49,89 +52,79 @@ impl<'a> SpiTransaction<'a> { } Ok(Self { - spi, + cs, previous_mux: Some(mux_state), }) } - pub fn read( - spi: &'a mut SpiReady, - cs: ChipSelect, - offset: u32, - buf: &mut [u8], - ) -> Result { - Self::read_with_spim(spi, None, cs, offset, buf) + pub fn read(cs: Cs<'a>, offset: u32, buf: &mut [u8]) -> Result { + Self::read_with_spim(cs, None, offset, buf) } pub fn read_with_spim( - spi: &'a mut SpiReady, + cs: Cs<'a>, spim: impl Into>, - cs: ChipSelect, offset: u32, buf: &mut [u8], ) -> Result { - let mut txn = Self::begin(spi, spim.into())?; - let result = txn.spi.read(cs, offset, buf); + let mut txn = Self::begin(cs, spim.into())?; + let result = txn.cs.read(offset, buf); txn.finish_result(result) } pub fn transceive_user( - spi: &'a mut SpiReady, - cs: ChipSelect, + cs: Cs<'a>, cmd: &[u8], tx_payload: &[u8], rx: &mut [u8], mode: TransferMode, ) -> Result<(), SmcError> { - Self::transceive_user_with_spim(spi, None, cs, cmd, tx_payload, rx, mode) + Self::transceive_user_with_spim(cs, None, cmd, tx_payload, rx, mode) } pub fn transceive_user_with_spim( - spi: &'a mut SpiReady, + cs: Cs<'a>, spim: impl Into>, - cs: ChipSelect, cmd: &[u8], tx_payload: &[u8], rx: &mut [u8], mode: TransferMode, ) -> Result<(), SmcError> { - let mut txn = Self::begin(spi, spim.into())?; - let result = txn.spi.transceive_user(cs, cmd, tx_payload, rx, mode); + let mut txn = Self::begin(cs, spim.into())?; + let result = txn.cs.transceive_user(cmd, tx_payload, rx, mode); txn.finish_result(result) } pub fn dma_read( - spi: &'a mut SpiReady, - cs: ChipSelect, + cs: Cs<'a>, flash_offset: u32, dram_addr: usize, len: u32, ) -> Result { - Self::dma_read_with_spim(spi, None, cs, flash_offset, dram_addr, len) + Self::dma_read_with_spim(cs, None, flash_offset, dram_addr, len) } pub fn dma_read_with_spim( - spi: &'a mut SpiReady, + cs: Cs<'a>, spim: impl Into>, - cs: ChipSelect, flash_offset: u32, dram_addr: usize, len: u32, ) -> Result { - let txn = Self::begin(spi, spim.into())?; - txn.spi.dma_read(cs, flash_offset, dram_addr, len)?; + let mut txn = Self::begin(cs, spim.into())?; + txn.cs.dma_read(flash_offset, dram_addr, len)?; Ok(txn) } pub fn poll_dma_completion(&mut self) -> Poll> { - match self.spi.poll_dma_completion() { + match self.cs.poll_dma_completion() { Poll::Pending => Poll::Pending, Poll::Ready(result) => Poll::Ready(result.and_then(|_| self.finish_restore())), } } pub fn handle_dma_irq(&mut self) -> Result { - let interrupt = self.spi.handle_dma_irq()?; + let interrupt = self.cs.handle_dma_irq()?; self.finish_restore()?; Ok(interrupt) } @@ -163,8 +156,8 @@ impl<'a> SpiTransaction<'a> { Ok(()) } - fn spim_source(spi: &SpiReady) -> Result { - match spi.controller_id() { + fn spim_source(cs: &Cs<'a>) -> Result { + match cs.controller_id() { SmcController::Spi1 => Ok(SpiMonitorSource::Spi1), SmcController::Spi2 => Ok(SpiMonitorSource::Spi2), SmcController::Fmc => Err(SmcError::InvalidChipSelect), diff --git a/target/ast10x0/peripherals/smc/types.rs b/target/ast10x0/peripherals/smc/types.rs index 675c8f3c8..61b72184e 100644 --- a/target/ast10x0/peripherals/smc/types.rs +++ b/target/ast10x0/peripherals/smc/types.rs @@ -4,6 +4,9 @@ //! Type definitions and error handling use embedded_storage::nor_flash::{NorFlashError, NorFlashErrorKind}; +use util_region::Mmap; + +use crate::smc::controller::GeometrySource; /// Terminal errors: operation failed, don't retry #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -40,7 +43,7 @@ pub enum SmcError { pub enum ChipSelect { /// Primary chip select (CS0) — always valid when any flash is configured. Cs0 = 0, - /// Secondary chip select (CS1) — valid only when `SmcConfig.cs1.is_some()`. + /// Secondary chip select (CS1) — valid only when `SmcConfig.cs1` is `Some`. Cs1 = 1, } @@ -151,7 +154,7 @@ pub enum SmcController { impl SmcController { /// Get the base hardware address for this controller - pub fn base_address(&self) -> usize { + pub const fn base_address(&self) -> usize { match self { Self::Fmc => 0x7E620000, Self::Spi1 => 0x7E630000, @@ -160,7 +163,7 @@ impl SmcController { } /// Get the memory-mapped flash window address - pub fn flash_window_address(&self) -> usize { + pub const fn flash_window_address(&self) -> usize { match self { Self::Fmc => 0x80000000, Self::Spi1 => 0x90000000, @@ -178,44 +181,21 @@ impl SmcController { } } -/// Configuration for a single flash device +/// Per-chip-select input configuration. Holds only the SPI clock; the flash +/// geometry is resolved once at init from the [`SmcInstance`]'s per-CS +/// [`GeometrySource`](crate::smc::controller::GeometrySource). #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct FlashConfig { - /// Device capacity in MB - pub capacity_mb: u32, - /// Page size in bytes (typically 256) - pub page_size: u32, - /// Sector size in bytes (typically 4096) - pub sector_size: u32, - /// Block size in bytes (typically 65536) - pub block_size: u32, /// Desired SPI clock frequency in MHz pub spi_clock_mhz: u32, } -impl FlashConfig { - /// Winbond W25Q64 (8 MB) configuration - pub const fn winbond_w25q64() -> Self { - Self { - capacity_mb: 8, - page_size: 256, - sector_size: 4096, - block_size: 65536, - spi_clock_mhz: 25, - } - } - - /// Winbond W25Q256 (32 MB) configuration - pub const fn winbond_w25q256() -> Self { - Self { - capacity_mb: 32, - page_size: 256, - sector_size: 4096, - block_size: 65536, - spi_clock_mhz: 25, - } - } -} +/// Geometry-source marker: discover the geometry by reading SFDP from the chip. +/// +/// This is the only place SFDP discovery lives; a build whose markers never name +/// `Discover` never links the SFDP decode code. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct Discover; /// SPI controller topology: role and master index /// @@ -270,14 +250,15 @@ impl SmcTopology { } } -/// Per-controller configuration +/// Per-controller input configuration. +/// +/// A chip select is present when its slot is `Some`. Geometry is not stored +/// here; it is supplied per chip when the handle is built (`cs0`/`cs1`). #[derive(Clone, Copy, Debug)] pub struct SmcConfig { - /// Which controller to configure - pub controller_id: SmcController, - /// Optional configuration for CS0 flash device + /// Configuration for the CS0 flash device, if present pub cs0: Option, - /// Optional configuration for CS1 flash device + /// Configuration for the CS1 flash device, if present pub cs1: Option, /// Enable DMA transfers pub dma_enabled: bool, @@ -286,3 +267,44 @@ pub struct SmcConfig { /// Controller topology (role and master index) pub topology: SmcTopology, } + +/// Compile-time description of a wired SMC controller: which hardware block it +/// is and how it is configured. +/// +/// A target implements this on a zero-sized marker type, one per wired +/// controller. Because both fields are `const`, everything derivable from them — +/// segment layout, decode-region size, memory-map bases, flash-type config bits — +/// is computed at compile time, and an invalid configuration becomes a build +/// error rather than a runtime `Err`. The controller carries this marker as a +/// type parameter, so its configuration is never laundered through a runtime +/// value. +pub trait SmcInstance { + /// Which hardware controller this marker describes. + const CONTROLLER: SmcController; + /// The controller's configuration (chip selects, clocks, topology, …). + const CONFIG: SmcConfig; + /// The register block this controller was granted in `system.json5`. + /// Owning [`Region`](util_region::Region) is what authorizes + /// touching the hardware, and its `START` is checked against + /// [`Self::CONTROLLER`]'s base address at compile time. + type Regs: Mmap; + /// How CS0's geometry is resolved at init: [`Discover`] to read SFDP, or a + /// target-defined [`GeometrySource`] returning a fixed geometry. Only + /// consulted when `CONFIG.cs0` is `Some`. Defaults to [`Discover`]. + /// + /// To pin geometry instead of discovering it, define the struct up top and + /// name it in the type slot: + /// ```ignore + /// const CS0_GEOM: FlashGeometry = FlashGeometry { + /// capacity_bytes: 0x0400_0000, + /// page_size: 256, + /// sector_size: 4096, + /// block_size: 65536, + /// }; + /// type Cs0Geometry = Pinned; + /// ``` + type Cs0Geometry: GeometrySource = Discover; + /// How CS1's geometry is resolved at init. Only consulted when `CONFIG.cs1` + /// is `Some`. Defaults to [`Discover`]. + type Cs1Geometry: GeometrySource = Discover; +} diff --git a/target/ast10x0/tests/clock/BUILD.bazel b/target/ast10x0/tests/clock/BUILD.bazel new file mode 100644 index 000000000..e6f479d52 --- /dev/null +++ b/target/ast10x0/tests/clock/BUILD.bazel @@ -0,0 +1,14 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "clock", + srcs = ["clock.rs"], + crate_name = "board_clock", + edition = "2024", + deps = ["@pigweed//pw_kernel/userspace"], +) diff --git a/target/ast10x0/tests/clock/clock.rs b/target/ast10x0/tests/clock/clock.rs new file mode 100644 index 000000000..cbbd70486 --- /dev/null +++ b/target/ast10x0/tests/clock/clock.rs @@ -0,0 +1,35 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The system clock, in the units the test apps actually use. +//! +//! Every scenario app measures something against [`SystemClock`]: boot +//! windows, stall budgets, IPC deadlines, the FD_T1 and FD_T2 timers. +//! `SystemClock` counts ticks and all of them want milliseconds, so each +//! app had written the same conversion, three of them inline and two +//! behind a local helper of the same name. + +#![no_std] + +use userspace::time::{Clock, Instant, SystemClock}; + +/// Milliseconds for a tick count. +pub fn ticks_to_millis(ticks: u64) -> u64 { + ticks * 1000 / SystemClock::TICKS_PER_SEC +} + +/// Ticks for a duration in milliseconds. +pub fn millis_to_ticks(millis: u64) -> u64 { + millis * SystemClock::TICKS_PER_SEC / 1000 +} + +/// Now, in milliseconds. What the orchestrator's pumps and the firmware +/// device's timers are both measured against. +pub fn now_millis() -> u64 { + ticks_to_millis(SystemClock::now().ticks()) +} + +/// An [`Instant`] `millis` from now, for a syscall that takes a deadline. +pub fn deadline_in(millis: u64) -> Instant { + Instant::from_ticks(SystemClock::now().ticks() + millis_to_ticks(millis)) +} diff --git a/target/ast10x0/tests/fd_ops/BUILD.bazel b/target/ast10x0/tests/fd_ops/BUILD.bazel new file mode 100644 index 000000000..bef08501c --- /dev/null +++ b/target/ast10x0/tests/fd_ops/BUILD.bazel @@ -0,0 +1,27 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "fd_ops", + srcs = ["fd_ops.rs"], + crate_name = "board_fd_ops", + edition = "2024", + deps = [ + "@rust_crates//:pldm-common", + "@rust_crates//:pldm-interface", + ], +) + +# Host tests: build on the host platform, no kernel/QEMU. +rust_test( + name = "fd_ops_test", + crate = ":fd_ops", + target_compatible_with = [ + "@platforms//cpu:x86_64", + "@platforms//os:linux", + ], +) diff --git a/target/ast10x0/tests/fd_ops/fd_ops.rs b/target/ast10x0/tests/fd_ops/fd_ops.rs new file mode 100644 index 000000000..99fba065c --- /dev/null +++ b/target/ast10x0/tests/fd_ops/fd_ops.rs @@ -0,0 +1,242 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! What both QEMU Firmware Devices answer the same way. +//! +//! The two devices differ in what they do with an update. One gates every +//! step on an IPC decision from the RoT, the other decides locally. What a +//! device says about itself, and how it counts a download, are the same +//! either way. +//! +//! The device's own constants come in as arguments: the UUID, the +//! component id, the versions, the image size and the byte count. So each +//! device keeps its own identity and this crate checks the shared part by +//! itself. + +#![cfg_attr(not(test), no_std)] + +use pldm_common::message::firmware_update::get_fw_params::FirmwareParameters; +use pldm_common::message::firmware_update::get_status::ProgressPercent; +use pldm_common::protocol::firmware_update::{ + ComponentActivationMethods, ComponentClassification, ComponentParameterEntry, Descriptor, + DescriptorType, FirmwareDeviceCapability, PldmFirmwareString, PldmFirmwareVersion, +}; +use pldm_interface::firmware_device::fd_ops::FdOpsError; + +/// How the version strings are encoded, in the name `PldmFirmwareString` +/// takes. +const VERSION_STRING_TYPE: &str = "ASCII"; + +/// Each device advertises one component, so the parameter table has one +/// entry and it is entry 0. +const COMPONENT_COUNT: u16 = 1; +const COMPONENT_CLASSIFICATION_INDEX: u8 = 0; + +/// The device writes one descriptor, its UUID. +const IDENTIFIER_COUNT: usize = 1; + +/// DSP0267 makes the component comparison stamp optional, and zero says it +/// is unused. A device with nothing to compare images by reports zero. +const COMPARISON_STAMP_UNUSED: u32 = 0; + +/// The device advertises no capabilities during an update. +const NO_CAPABILITIES: FirmwareDeviceCapability = FirmwareDeviceCapability(0); + +/// No activation method set yet. `set_self_contained` adds the one these +/// devices use. +const NO_ACTIVATION_METHODS: ComponentActivationMethods = ComponentActivationMethods(0); + +/// A finished transfer, as the percentage `ProgressPercent` carries. +const COMPLETE_PERCENT: usize = 100; + +/// `GetDeviceIdentifiers`: the device's UUID, in the first slot. +pub fn device_identifiers( + device_identifiers: &mut [Descriptor], + uuid: &[u8; 16], +) -> Result { + let uuid = Descriptor::new(DescriptorType::Uuid, uuid) + .map_err(|_| FdOpsError::DeviceIdentifiersError)?; + *device_identifiers + .first_mut() + .ok_or(FdOpsError::DeviceIdentifiersError)? = uuid; + Ok(IDENTIFIER_COUNT) +} + +/// `GetFirmwareParameters`: one firmware component, with self-contained +/// activation. +/// +/// The activation method tells the Update Agent what has to happen after +/// an update for the new image to run: DSP0267's options range from +/// nothing up to a host reboot or a power cycle. Self-contained says the +/// ActivateFirmware command is the whole of it: the device switches to +/// the new image on its own, and the Update Agent has nothing further to +/// do. +/// +/// `comp_version` is the component's own version and `image_set_version` +/// is the set it belongs to. Both are `&str`, so passing them the other +/// way round still compiles and the device then describes itself wrongly. +pub fn firmware_parameters( + firmware_params: &mut FirmwareParameters, + comp_identifier: u16, + comp_version: &str, + image_set_version: &str, +) -> Result<(), FdOpsError> { + let comp_version = PldmFirmwareString::new(VERSION_STRING_TYPE, comp_version) + .map_err(|_| FdOpsError::FirmwareParametersError)?; + let image_set_version = PldmFirmwareString::new(VERSION_STRING_TYPE, image_set_version) + .map_err(|_| FdOpsError::FirmwareParametersError)?; + + let mut activation = NO_ACTIVATION_METHODS; + activation.set_self_contained(true); + + let component = ComponentParameterEntry::new( + ComponentClassification::Firmware, + comp_identifier, + COMPONENT_CLASSIFICATION_INDEX, + &PldmFirmwareVersion::new(COMPARISON_STAMP_UNUSED, &comp_version, None), + &PldmFirmwareVersion::default(), + activation, + NO_CAPABILITIES, + ); + + *firmware_params = FirmwareParameters::new( + NO_CAPABILITIES, + COMPONENT_COUNT, + &image_set_version, + &PldmFirmwareString::default(), + &[component], + ); + Ok(()) +} + +/// `QueryDownloadProgress`: how much of the image has arrived, as a +/// percentage capped at 100. +/// +/// Integer division floors, so a transfer one byte short of the image +/// reports 99 and never a premature 100. More than a whole image is an +/// honest count (a retransmitted window arrives twice) and caps at 100. +/// An image of no bytes, or a byte count large enough to overflow the +/// multiply, is an error: the first has no progress to report and the +/// second means the counter is corrupt. +pub fn download_progress( + received: usize, + image_size: usize, + progress_percent: &mut ProgressPercent, +) -> Result<(), FdOpsError> { + // Plain `*` panics on overflow in a debug build and wraps to a + // small garbage value in a release one, and plain `/` panics on a + // zero divisor. The checked forms answer `None` for both, and + // `ok_or` turns that into the error: a byte count too large to + // multiply means the counter is corrupt, and an invented percentage + // would cover that up. The agent sees a failed completion and the + // device keeps running, which a panic here would not allow. + let percent = received + .checked_mul(COMPLETE_PERCENT) + .and_then(|scaled| scaled.checked_div(image_size)) + .ok_or(FdOpsError::FwDownloadError)?; + progress_percent + .set_value(percent.min(COMPLETE_PERCENT) as u8) + .map_err(|_| FdOpsError::FwDownloadError) +} + +#[cfg(test)] +mod tests { + use super::*; + + const UUID: [u8; 16] = [7; 16]; + + #[test] + fn the_uuid_goes_in_the_first_slot() { + let mut slots = [Descriptor::new_empty(); 2]; + + assert!(matches!(device_identifiers(&mut slots, &UUID), Ok(1))); + + assert_eq!( + slots[0], + Descriptor::new(DescriptorType::Uuid, &UUID).unwrap() + ); + assert_eq!(slots[1], Descriptor::new_empty(), "and only the first"); + } + + // The trait hands the callback a caller-sized buffer. Writing through + // `first_mut` makes a buffer with no room an error; indexing slot 0 + // would make it a panic in the device's request handler. + #[test] + fn an_empty_descriptor_buffer_is_refused_not_a_panic() { + assert!(matches!( + device_identifiers(&mut [], &UUID), + Err(FdOpsError::DeviceIdentifiersError) + )); + } + + #[test] + fn the_parameters_describe_one_component() { + let mut params = FirmwareParameters::default(); + + firmware_parameters(&mut params, 0x0102, "v1", "set-v1").unwrap(); + + let count = params.params_fixed.comp_count; + assert_eq!(count, 1, "the table has the one entry"); + assert!(params.active_comp_image_set_ver_str.starts_with(b"set-v1")); + } + + #[test] + fn a_version_string_that_does_not_fit_is_an_error() { + // Longer than PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN, which + // `PldmFirmwareString::new` refuses. + let too_long = "x".repeat(256); + + assert!(matches!( + firmware_parameters(&mut FirmwareParameters::default(), 1, &too_long, "set"), + Err(FdOpsError::FirmwareParametersError) + )); + } + + #[test] + fn progress_is_the_share_received() { + let mut progress = ProgressPercent::default(); + + download_progress(256, 1024, &mut progress).unwrap(); + + assert_eq!(progress.value(), 25); + } + + // `is_download_complete` keys on the byte count reaching the image + // size, so a transfer that is one byte short must not report a + // hundred: an agent reading that would call a partial image done. + #[test] + fn a_transfer_one_byte_short_is_not_a_whole_image() { + let mut progress = ProgressPercent::default(); + + download_progress(1023, 1024, &mut progress).unwrap(); + + assert_eq!(progress.value(), 99); + } + + #[test] + fn progress_stops_at_a_whole_image() { + let mut progress = ProgressPercent::default(); + + download_progress(4096, 1024, &mut progress).unwrap(); + + assert_eq!(progress.value(), 100); + } + + // A count this size cannot come from summing chunk lengths, so it is + // a corrupt counter, and an invented percentage would cover that up. + #[test] + fn a_byte_count_that_overflows_the_multiply_is_an_error() { + assert!(matches!( + download_progress(usize::MAX, 1024, &mut ProgressPercent::default()), + Err(FdOpsError::FwDownloadError) + )); + } + + #[test] + fn an_image_of_no_bytes_has_no_progress() { + assert!(matches!( + download_progress(0, 0, &mut ProgressPercent::default()), + Err(FdOpsError::FwDownloadError) + )); + } +} diff --git a/target/ast10x0/tests/flash/BUILD.bazel b/target/ast10x0/tests/flash/BUILD.bazel new file mode 100644 index 000000000..5ec1c3229 --- /dev/null +++ b/target/ast10x0/tests/flash/BUILD.bazel @@ -0,0 +1,149 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@pigweed//pw_kernel/tooling:rust_app.bzl", "rust_app") +load("@pigweed//pw_kernel/tooling:system_image.bzl", "system_image", "system_image_test") +load("@pigweed//pw_kernel/tooling:target_codegen.bzl", "target_codegen") +load("@pigweed//pw_kernel/tooling:target_linker_script.bzl", "target_linker_script") +load("@pigweed//pw_kernel/tooling/panic_detector:rust_binary_no_panics_test.bzl", "rust_binary_no_panics_test") +load("@rules_rust//rust:defs.bzl", "rust_binary") +load("//target/ast10x0:defs.bzl", "TARGET_COMPATIBLE_WITH", "flash_system_image_test") +load("//util/region:defs.bzl", "app_regions") + +filegroup( + name = "system_config", + srcs = ["system.json5"], + visibility = ["//visibility:public"], +) + +target_codegen( + name = "codegen", + arch = "@pigweed//pw_kernel/arch/arm_cortex_m:arch_arm_cortex_m", + system_config = ":system_config", + target_compatible_with = TARGET_COMPATIBLE_WITH, +) + +target_linker_script( + name = "linker_script", + system_config = ":system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + template = "//target/ast10x0:linker_script_template", +) + +rust_binary( + name = "target", + srcs = ["target.rs"], + edition = "2024", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + deps = [ + ":codegen", + ":linker_script", + "//target/ast10x0:entry", + "//target/ast10x0/peripherals", + "@pigweed//pw_kernel/arch/arm_cortex_m:arch_arm_cortex_m", + "@pigweed//pw_kernel/kernel", + "@pigweed//pw_kernel/subsys/console:console_backend", + "@pigweed//pw_kernel/target:target_common", + "@pigweed//pw_kernel/userspace", + ], +) + +app_regions( + name = "app_flash_server_regions", + app_name = "flash_server_bin", + edition = "2024", + system_config = ":system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, +) + +rust_app( + name = "flash_server_bin", + srcs = ["server_main.rs"], + codegen_crate_name = "app_flash_server", + edition = "2024", + system_config = ":system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + deps = [ + ":app_flash_server_regions", + "//hal/blocking/flash", + "//services/flash:server", + "//target/ast10x0/backend/flash:flash_backend_ast10x0", + "//util/ipc", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + "@pigweed//pw_status/rust:pw_status", + ], +) + +rust_app( + name = "flash_client_app", + srcs = ["client_main.rs"], + codegen_crate_name = "app_flash_client", + edition = "2024", + system_config = ":system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + deps = [ + "//hal/blocking/flash", + "//services/flash:client", + "//util/ipc", + "//util/types", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + "@pigweed//pw_status/rust:pw_status", + ], +) + +system_image( + name = "flash", + apps = [ + ":flash_server_bin", + ":flash_client_app", + ], + kernel = ":target", + platform = "//target/ast10x0", + system_config = ":system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + visibility = ["//visibility:public"], +) + +# FMC flash is not modeled under QEMU in this repo (same restriction as +# //target/ast10x0/tests/smc/...): run on EVB hardware. +system_image_test( + name = "flash_evb_test", + image = ":flash", + tags = ["hardware"], + target_compatible_with = select({ + "//target/ast10x0:qemu_enabled": ["@platforms//:incompatible"], + "//conditions:default": [], + }), + visibility = ["//visibility:public"], +) + +# QEMU variant: the runner seeds 1 MiB erased images on both FMC chip selects +# (if=mtd), emulating the EVB where CS0 boot flash and the external W25Q512 on +# CS1 are both present. The flash service binds CS1, so program/erase/read-back +# runs there under emulation; CS0 is attached but untouched. +# bazelisk test --config=virt_ast10x0 //target/ast10x0/tests/flash:flash_qemu_test +flash_system_image_test( + name = "flash_qemu_test", + cs0_image = "cs0.img", + cs1_image = "cs1.img", + flash_size = 64 * 1024 * 1024, + fmc_model = "w25q512jv", + image = ":flash", + tags = ["qemu_only"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + visibility = ["//visibility:public"], +) + +rust_binary_no_panics_test( + name = "no_panics_test", + binary = ":flash", + tags = ["kernel"], +) diff --git a/target/ast10x0/tests/flash/client_main.rs b/target/ast10x0/tests/flash/client_main.rs new file mode 100644 index 000000000..3921abe19 --- /dev/null +++ b/target/ast10x0/tests/flash/client_main.rs @@ -0,0 +1,156 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +#![no_main] +#![no_std] + +use app_flash_client::handle; +use hal_flash::{Flash, FlashAddress}; +use services_flash_client::FlashIpcClient; +use userspace::entry; +use userspace::syscall; +use util_ipc::IpcHandle; + +/// 1 MiB in: same offset the on-hardware smc write test uses; clear of code. +/// The test is non-destructive on hardware: the whole sector is backed up +/// before the first erase and restored + verified at the end, exactly as +/// //target/ast10x0/tests/smc/write does. +const TEST_OFFSET: u32 = 0x0010_0000; +const SECTOR: usize = 4096; + +fn fail(msg: &str) -> ! { + pw_log::error!("flash client FAIL: {}", msg as &str); + let _ = syscall::debug_shutdown(Err(pw_status::Error::Internal)); + loop {} +} + +fn pattern(i: usize) -> u8 { + (i as u8).wrapping_mul(31).wrapping_add(7) +} + +#[entry] +fn entry() { + let mut flash = match FlashIpcClient::new(IpcHandle::new(handle::FLASH)) { + Ok(c) => c, + Err(_) => fail("connect/geometry"), + }; + + // 1. Geometry matches the backend's CS0 config. + let Ok((total, page, bitmap)) = flash.geometry() else { + fail("geometry"); + }; + if total.get() != 0x0400_0000 { + fail("total size"); + } + if page.get() != SECTOR { + fail("page size"); + } + if bitmap != 1 << 12 { + fail("erase bitmap"); + } + + // Back up the whole sector before any destructive op so the test restores + // the original contents on real hardware (mirrors smc/write). + let mut backup = [0u8; SECTOR]; + if flash + .read(FlashAddress::new(TEST_OFFSET), &mut backup) + .is_err() + { + fail("backup read"); + } + + // 2. Erase one sector, verify it reads back erased. + if flash.erase(FlashAddress::new(TEST_OFFSET), page).is_err() { + fail("erase"); + } + let mut buf = [0u8; 64]; + if flash + .read(FlashAddress::new(TEST_OFFSET), &mut buf) + .is_err() + { + fail("read after erase"); + } + if buf.iter().any(|&b| b != 0xff) { + fail("not erased"); + } + + // 3. Unaligned program crossing a 256-byte program-page boundary: + // starts at +250, 300 bytes -> exercises BlockingFlash window + // splitting and the intra-page start relaxation. + let mut data = [0u8; 300]; + for (i, b) in data.iter_mut().enumerate() { + *b = pattern(i); + } + if flash + .program(FlashAddress::new(TEST_OFFSET + 250), &data) + .is_err() + { + fail("program"); + } + + // 4. Read back and verify, including the untouched prefix. + let mut rb = [0u8; 600]; + if flash.read(FlashAddress::new(TEST_OFFSET), &mut rb).is_err() { + fail("read back"); + } + if rb[..250].iter().any(|&b| b != 0xff) { + fail("prefix clobbered"); + } + for i in 0..300 { + if rb[250 + i] != pattern(i) { + fail("data mismatch"); + } + } + if rb[550..].iter().any(|&b| b != 0xff) { + fail("suffix clobbered"); + } + + // 5. Error paths: bad erase size, out-of-bounds read. + if flash + .erase( + FlashAddress::new(TEST_OFFSET), + util_types::PowerOf2Usize::new(512).unwrap(), + ) + .is_ok() + { + fail("erase size not rejected"); + } + let mut oob = [0u8; 16]; + if flash + .read(FlashAddress::new(total.get() as u32), &mut oob) + .is_ok() + { + fail("oob read not rejected"); + } + + // Restore the original sector contents and verify (mirrors smc/write's + // restore_sector: erase -> program original -> read-back compare). + if flash.erase(FlashAddress::new(TEST_OFFSET), page).is_err() { + fail("restore erase"); + } + if flash + .program(FlashAddress::new(TEST_OFFSET), &backup) + .is_err() + { + fail("restore program"); + } + let mut restored = [0u8; SECTOR]; + if flash + .read(FlashAddress::new(TEST_OFFSET), &mut restored) + .is_err() + { + fail("restore read"); + } + if restored != backup { + fail("restore verify"); + } + + pw_log::info!("flash client PASS"); + let _ = syscall::debug_shutdown(Ok(())); + loop {} +} + +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + loop {} +} diff --git a/target/ast10x0/tests/flash/server_main.rs b/target/ast10x0/tests/flash/server_main.rs new file mode 100644 index 000000000..c7a02a273 --- /dev/null +++ b/target/ast10x0/tests/flash/server_main.rs @@ -0,0 +1,55 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +#![no_main] +#![no_std] + +use app_flash_server::handle; +use app_flash_server_regions::take_mmaps; +use flash_backend::{Backend, NoWaitBlocking}; +use hal_flash::BlockingFlash; +use services_flash_server::FlashIpcServer; +use userspace::entry; +use userspace::syscall::{self, Signals}; +use userspace::time::Instant; +use util_ipc::IpcHandle; + +/// IPC buffer: must hold the largest request/response. Reads are bounded by +/// the client's buffer and this size; 4 KiB of payload + opcode/status headroom. +const IPC_BUF_SIZE: usize = 4352; + +#[entry] +fn entry() { + // SAFETY: mints this process's memory mappings once, at its entry point. + let mmaps = unsafe { take_mmaps() }; + // The kernel target applied the FMC pinmux before starting any process. + let driver = match Backend::new(mmaps.fmc_regs, mmaps.fmc_cs0_window, mmaps.fmc_cs1_window) { + Ok(d) => d, + Err(e) => { + pw_log::error!("flash server: FMC init failed: {:08x}", e.0.get() as u32); + let _ = syscall::debug_shutdown(Err(pw_status::Error::Internal)); + loop {} + } + }; + let flash = BlockingFlash { + driver, + blocking: NoWaitBlocking, + }; + let mut server = FlashIpcServer::new(flash); + let mut buf = [0u8; IPC_BUF_SIZE]; + + pw_log::info!("flash server: ready"); + loop { + if syscall::object_wait(handle::FLASH, Signals::READABLE, Instant::MAX).is_err() { + continue; + } + if let Err(e) = server.handle_one(&IpcHandle::new(handle::FLASH), &mut buf) { + pw_log::error!("flash server: request failed: {:08x}", e.0.get() as u32); + } + } +} + +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + loop {} +} diff --git a/target/ast10x0/tests/flash/system.json5 b/target/ast10x0/tests/flash/system.json5 new file mode 100644 index 000000000..944e96679 --- /dev/null +++ b/target/ast10x0/tests/flash/system.json5 @@ -0,0 +1,98 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +// AST10x0 Flash Service Configuration +// ARM Cortex-M4 @ 200 MHz with 768KB SRAM (0x00000000 - 0x000BFFFF) +// NOTE: AST10x0 does not support XIP - firmware executes from RAM. +// +// PMSAv7-Friendly Memory Layout (same as ../usart/system.json5): +// 0x00000000 - 0x00000500: Vector table (1280 bytes) +// 0x00000500 - 0x00020000: Kernel code (~126KB, ends at 128KB boundary) +// 0x00020000 - 0x00060000: Flash server + client app flash (256KB) +// 0x00060000 - 0x00080000: Kernel RAM (128KB) +// 0x00080000 - 0x000A0000: App RAM (128KB) +{ + arch: { + type: "armv7m", + vector_table_start_address: 0x00000000, + vector_table_size_bytes: 1280, // 0x500 + }, + kernel: { + flash_start_address: 0x00000500, // After vector table + flash_size_bytes: 129792, // ~126KB (ends at 0x00020000) + ram_start_address: 0x00060000, // After all flash regions + ram_size_bytes: 131072, // 128KB + }, + apps: [ + { + name: "flash_server_bin", + flash_size_bytes: 131072, // 128KB for server code + processes: [ + { + name: "flash_server_process", + ram_size_bytes: 65536, // 64KB RAM (holds the 4KB+ IPC buffer) + objects: [ + { + name: "flash", + type: "channel_handler", // Server side of client→server channel + }, + { + type: "thread", + name: "flash_server_thread", + kernel_stack_size_bytes: 4096, // 4KB stack + },], + memory_mappings: [ + // FMC pinctrl is applied by the kernel target's + // pre-task init, so the server does not map the SCU. + { + // FMC controller registers. + name: "fmc_regs", + type: "device", + start_address: 0x7e620000, + size_bytes: 0x1000, + }, + { + // FMC CS0 memory-mapped flash read window (8 MiB). + name: "fmc_cs0_window", + type: "device", + start_address: 0x80000000, + size_bytes: 0x800000, + }, + { + // FMC CS1 memory-mapped flash read window (64 MiB). + // With both CS0 and CS1 present the 256 MiB FMC + // aperture is split in half, relocating the served + // CS1 window to 0x88000000. + name: "fmc_cs1_window", + type: "device", + start_address: 0x88000000, + size_bytes: 0x04000000, + }, + ], + }, + ], + }, + { + name: "flash_client_app", + flash_size_bytes: 65536, // 64KB for client code + processes: [ + { + name: "flash_client_process", + ram_size_bytes: 32768, // 32KB RAM + objects: [ + { + name: "flash", + type: "channel_initiator", + handler_process: "flash_server_process", + handler_object_name: "flash", + }, + { + type: "thread", + name: "flash_client_thread", + kernel_stack_size_bytes: 2048, + },], + }, + ], + }, + ], +} diff --git a/target/ast10x0/tests/flash/target.rs b/target/ast10x0/tests/flash/target.rs new file mode 100644 index 000000000..e7cfabc3a --- /dev/null +++ b/target/ast10x0/tests/flash/target.rs @@ -0,0 +1,49 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! AST10x0 Flash Service Target +//! +//! This target runs the flash server as a userspace process. +//! Clients can communicate with it over an IPC channel. + +#![no_std] +#![no_main] + +use ast10x0_peripherals::scu::pinctrl::PINCTRL_FMC_QUAD; +use ast10x0_peripherals::scu::ScuRegisters; +use console_backend::console_backend_write_all; +use entry as _; +use target_common::{declare_target, TargetInterface}; + +pub struct Target {} + +impl TargetInterface for Target { + const NAME: &'static str = "AST10x0 Flash Service"; + + fn main() -> ! { + // Static pinmux configuration, applied before any process starts so + // no task ever needs SCU access (avoids cross-task RMW races on the + // shared pinctrl registers). + // SAFETY: kernel main() runs once, single-threaded, with exclusive + // hardware ownership. + let scu = unsafe { ScuRegisters::new_global_unlocked() }; + scu.apply_pinctrl_group(PINCTRL_FMC_QUAD); + + codegen::start(); + #[expect(clippy::empty_loop)] + loop {} + } + + fn shutdown(code: u32) -> ! { + let sentinel: &[u8] = if code == 0 { + b"TEST_RESULT:PASS\n" + } else { + b"TEST_RESULT:FAIL\n" + }; + let _ = console_backend_write_all(sentinel); + #[expect(clippy::empty_loop)] + loop {} + } +} + +declare_target!(Target); diff --git a/target/ast10x0/tests/integration/BUILD.bazel b/target/ast10x0/tests/integration/BUILD.bazel new file mode 100644 index 000000000..fb58566c3 --- /dev/null +++ b/target/ast10x0/tests/integration/BUILD.bazel @@ -0,0 +1,7 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +# Holds scenario.bzl, which every scenario in this tree loads. No targets +# of its own. + +exports_files(["scenario.bzl"]) diff --git a/target/ast10x0/tests/integration/GAPS.md b/target/ast10x0/tests/integration/GAPS.md new file mode 100644 index 000000000..1b5500076 --- /dev/null +++ b/target/ast10x0/tests/integration/GAPS.md @@ -0,0 +1,330 @@ +# What the QEMU integration tests do not cover + +Written 2026-10-05. The scenarios and how to run them are in README.md; +this is the list of what a green run still does not say. + +## The two halves have met, in one scenario + +`full_update` closes this: five apps in one image, an update over PLDM +followed by the device being reset into it and reporting ready a second +time. Checked against its negative, a device that stops reporting after +the post-activation reset. + +It carries two negatives of its own: a device that never comes up, and a +device that takes the update and never comes back. `mock_downstream_device` and +`pldm_update` keep theirs. + +## The lines are IPC channels, not GPIOs + +Reset and boot-worked are board traces between two chips. QEMU models one +chip and the mock downstream device is a process inside it, so there is no second +device for a pin to reach. The adapters in `board/src/bmc.rs` are swapped +out at the trait seam rather than exercised. Pin wiring is what the +hardware tests are for. + +## It is not a black box + +The orchestrator runs as an app inside the image and the scenarios assert +on its state from in there. The only observations from outside the guest +are the UART sentinel and the CS1 backing file, and only the happy path +checks the latter. + +## Parts of the DSP0267 Type 5 flow with no scenario + +`full_update` covers the happy path: Type 0 discovery, inventory, request, +pass-component, update-component, the data loop, transfer, verify, apply, +activate, reset, and the device booting what it was given. The following +parts of the specification are not exercised: + +- Automatic activation without ActivateFirmware. The device advertises + self-contained activation and the Update Agent sends ActivateFirmware. A + flow where the RoT writing the image and resetting the device is the + activation, with `activate()` never called and `PerformActivate` never + produced, has no scenario. +- The pending-reset handshake: a pending reset signal to the device, the + device preparing for shutdown, and an acknowledgement. This exists + nowhere, not in DSP0267, not in pldm-lib, not in the orchestrator. +- Authenticating the running image before the first release. The verifier + reads nothing and the device table carries no layout, so the first boot + is unverified. Doing it for real means two processes mapping the FMC, + with the Firmware Device writing CS1 while the RoT reads it. +- Updating the backup partition after the commit. #512 merged, but the + component here binds `SvnFloorBinding::SelfManaged`, and since 993219b8 + a self-managed component's slots are left to the device. The re-sync + cannot trigger until a scenario variant binds an eRoT floor. +- Boot progress over MCTP. The managed device in the spec is one device + that is the Update Agent, the reset target and the progress reporter at + once. Here those are two apps, and progress arrives on an IPC channel. + +## What the transfer-error scenario does not say + +`pldm_update/transfer_error` has the Update Agent answer one +RequestFirmwareData with an error completion code. The device aborts the +transfer, which is the claim. Two things it does not cover: a dropped response +rather than an errored one, which would be a T2 retry and then a T1 timeout, +and `RetryRequestFwData`, which the device is supposed to answer by sending the +request again. The run also ends with `run_terminus` returning an error rather +than the device going back to idle, so what a second update attempt after an +abort would do is untested. + +## Arcs of the update state machine with no scenario + +- `UpdateSecurityRevision` on the eRoT's own floor. The downstream half + runs end to end in `pldm_update/svn_commit`: the Update Agent sends + 0x22 after the activation, the device parks at `SvnCommitPending`, and + the loop dispatches `Event::SvnCommitRequest`, then sends + PerformSvnCommit if the state machine emitted `Effect::CommitSvnFloor` + and RejectSvnCommit if it did not. `svn_commit_refused` runs the reject + side, a second request with nothing outstanding. The eRoT's own SVN + floor has no equivalent yet. It takes the same path: the eRoT is a Firmware + Device like any other, so the Update Agent offers it an update over + PLDM and sends it 0x22 afterwards. Nothing serves that side on the + eRoT yet, so + `commit_self_svn_floor` still has no caller outside tests. The other + update scenarios keep dispatching the event themselves, the way they + already dispatch `BootConfirmed`: without the 0x22 exchange nothing + parks their device at the status. +- A self-update in one run. The two scenarios split it at the reset. + `self_update` offers the eRoT a candidate, stages it, authenticates it + and reports the SVN it carries, and the activation records the session + and marks the trial pending; the run ends where the eRoT would reboot. + `self_trial` starts from that session and judges the boot. Joining them + needs a reset this target does not have (nothing drives SYSRESETREQ, and + QEMU models one chip) and a session in flash rather than in RAM, so the + session would survive the reset into the same run. +- A candidate that came from somewhere. `self_update` is its own update + source: the bytes are a constant and the slot counts them rather than + writing them, because nothing serves the eRoT's own update over PLDM + and no board wires a flash-backed `Updatable` for that slot. +- `Ready` to `Recovering`. `full_update/recovery_preempts` reports + corruption while the component is `Updating`; nothing reports it on a + component sitting `Ready`, so `Ready` to `Recovering` is never taken + and an `Isolable` component is never gated. +- A recovery loop that never ends. `device_hangs` wires no recovery + source, so it locks on the first attempt. With a source behind it, a + device that verifies but never boots recovers forever: + `Event::VerificationPassed` clears the component's retry count, so the + attempt handed to `restore` stays 0 and `MAX_RETRY` never bites. Found + while writing `recovery`, which is why the source is wired in the two + recovery cfgs alone. Whether the count should survive a passing + verification is a question for the machine. +- The spare slot re-sync after a commit, and the floor advance held until + the spare has the image. It cannot run on any board here: the re-sync + sits below the binding test in `commit_svn_floor`, so a component that + keeps its own SVN never reaches it, and all three boards bind + `SvnFloorBinding::SelfManaged`. A scenario needs a device whose floor + the eRoT holds, which is a board shape no itest has yet. +- The same two for the slots the eRoT boots from, which nothing + implements, not just nothing covers. `commit_self_svn_floor` advances + the floor as soon as the trial is confirmed, and no pass re-stages the + slot the eRoT stopped booting from. `queue_slot_resync` cannot serve + the eRoT: the claim it reads, `last_activated`, is RAM, and the + self-reset wipes it. The ROM rejects an image below the counter, so after + the advance the other slot is unbootable, and a corruption of the running + slot leaves the eRoT with nothing to fall back to. +- A board that wires no self-update at all. `Board.self_update` is an + `Option` and `()` satisfies `SelfUpdate` and `SelfReset`, so such a + board builds and refuses an update aimed at the eRoT at submit, with + `NoErotUpdate`. Self-resiliency is required of every eRoT, so the + `Option` is a bring-up seam for QEMU and the mock boards rather than a + configuration a platform may ship; nothing in the types says so. Two + stages close it: a wiring type with a named cannot-self-update variant, + so each board states the choice the way `SvnFloorBinding` makes it + state who keeps a floor, and then a plain field once a board wires a + real self-update. + +## What the measurement scenario does not say + +`mock_downstream_device/measured` runs the path #546 merged: a verdict +carrying `Some(measurement)` reaches the sink as `Report::Measured`, once, +for the component the walk measured. The digest is a constant, so what it +proves is the wiring, not any hashing. Nothing computes a measurement +anywhere in the tree: the `Measurer` capability has no implementor and is +not a `BoardCapabilities` type, and the real one belongs to the crypto +lane. The staged candidate is not measured either, because the update path +verifies through `IncrementalVerifier`, which has no measurement seam. + +The eRoT's own image is not measured at all. `Report::Measured` comes from +a verdict, and the walk passes over the eRoT, so it is never verified: its +image settles through `settle_self_update_at_boot`, which dispatches the +settlement event without calling a verifier. Measuring it needs a seam on +that path, not another scenario. + +## Arcs the trial gate does not cover + +`DeviceTrialBoot` is wired and `full_update` closes the trial for a +downstream device both ways: confirmed when the device boots what it was given, reverted when +the device takes the update and never comes back. What no scenario reaches +is `is_pending`, which exists for an orchestrator that rebooted mid-update +and has to read an open trial for a device from stored state. Nothing calls +`is_pending`, so a trial left open by a crashed orchestrator is not +settled at the next boot. Whether a boot should settle a trial nobody claimed is also +undecided for the eRoT itself. + +A revert leaves the rejected image in the slot the update wrote it to. Only +the slot metadata moves, and the one re-sync in the tree, +`queue_slot_resync` in the driver, runs on the commit path to bring the +spare slot up to the image that was just confirmed. Nothing brings the +spare back to the confirmed image after a revert, so the slot keeps an +image no verdict accepted, and nothing records the slot as stale. The +floor never advances on a revert, so the slots agree about SVN. What is +undecided is how a later reader should treat that slot: a recovery scheme +that falls back slot to slot, or a settle path for a trial left open. +Either the reader treats the contents as untrusted, or the revert +overwrites them. + +## What the preemption scenario does not say + +`full_update/recovery_preempts` takes the state machine from `Updating` +to `Recovering`: the corruption lands while the device is transferring, +and the driver drops the candidate and reports the update superseded to +the requester. What +the run cannot show is recovery succeeding afterwards, because the board +wires no recovery source and the episode ends in lockdown. A scenario with +both a source and an update in flight would say more. + +The scenario app raises the event itself. `orchestrator_main.rs` +dispatches `CorruptionDetected` where the device is transferring; no +platform code raises it. The driver makes its verdicts from the chain +walk, and the walk does not run while the state machine is in +`Updating`, so what the transition waits on is a runtime monitor, not +another scenario. + +The corruption lands on the component under update. `Updating` preempts on +a `Required` corruption of any component, including one the update is not +touching, and that transition is untaken. + +## Events no scenario can reach + +Checked by grepping the scenario apps for each `Event`, then asking what +the wired board can produce. An app naming no event is not enough: the +driver makes `BootFailed` and `RecoveryUnavailable` on its own, and +`device_hangs` reaches both. `Timeout` and `CommitTimeout` come from +`server/src/runtime.rs`, which no scenario runs. + +- `VerificationFailed`. All three scenarios wire the chain walk to + `StubVerifier` in `services/orchestrator/test/stubs.rs`, which returns + `Authenticated` without opening the image, so no walk can fail. The + update candidate has a different verifier, `PatternVerifier`, which can + fault, but that ends as `UpdateRejected`. +- `Restored`. Every board wires `Recovery = ()`, which answers + `SourceExhausted` on the first attempt, so recovery always exhausts and + never succeeds. The retry cap and `max_retry` have no scenario. +- `AttestationChallenge`. No scenario issues one. +- `CommitTimeout`. The scenarios run their own event loop rather than + `server/src/runtime.rs`, and nothing else arms the watchdog, so + commit-or-lock cannot fire here. The same holds outside the tests: + `BootWatchdogs::arm_commit` has no caller but the ast10x0 runtime test, + so the activated-but-not-committed window is unbounded on a real + platform. +- `EffectFailed`. The effects a scenario runs either cannot fail or are + never made to fail: `StubVerifier` never opens an image, and + `Recovery = ()` returns a verdict rather than an error. No scenario + makes an actuation fault, so the lockdown that follows one is + untested. + +## Edge cases with no scenario + +- Two components in flight. Every scenario supervises one managed + device. Recovery of one component during the commit window of another, + and the id scoping that decides what the recovery voids, are covered + only by unit tests. +- A device that reports ready twice with no reset in between, or reports + for a component that was never released. +- An update aimed at the eRoT itself. No scenario sends one. + +## Resets in the middle of a flow + +Each scenario boots once, so anything that needs a reset mid-flow has no +scenario at all. The ones that matter: + +- Between `BootConfirmed` and the request the Update Agent sends. The + outstanding advance lives in RAM, so a reset drops it and the later + `SvnCommitRequest` finds nothing to move. +- During a spare-slot re-sync. The claim that a pass is in flight is + RAM-only too, so a reset leaves a half-written spare with no durable + record that it is dirty. `driver/src/board.rs` records that open + question under `Report::SlotResyncFailed`. +- Between the device taking its SVN and the eRoT writing its mirror. The + two floors disagree afterwards and nothing reconciles them. + +## A failed spare-slot re-sync leaves the floor behind + +`commit_svn_floor` holds the advance when it queues a re-sync, so the +floor takes the new SVN only once the spare holds the image. A pass that +fails clears the held advance and reports `Report::SlotResyncFailed` +(`driver/src/driver/update.rs`). The floor keeps the old SVN, so the +image the update replaced installs again, and no pass re-stages the +spare or records the slot as stale anywhere a reset would preserve. + +The Update Agent hears that the commit succeeded either way. The +scenario loop sends PerformSvnCommit when the state machine emits +`Effect::CommitSvnFloor`, which happens before the pump runs, so the +answer says granted while the floor still holds the old SVN. Two changes +close this: re-attempt the pass or mark the slot stale somewhere +durable, and answer the Update Agent once the SVN floor advances +rather than when the effect arrives. + +## Assertions that are looser than they look + +`pldm_update/svn_commit` asserts the effect, not the outcome. The state +machine emits `Effect::CommitSvnFloor` whatever SVN floor binding the +component carries, and the orchestrator answers the Update Agent on seeing +it, but `commit_svn_floor` in the driver returns at once for a component that +keeps its own SVN (`driver.rs`, the `SvnFloorBinding::Erot` test). Every board +here binds `SelfManaged`, so no SVN floor moves in that run or in its refusal +variant. What those scenarios prove is the 0x22 exchange and the decision the +state machine takes, which is their claim; the SVN floor itself has no run. + +`pldm_update` has no managed device, so its `BootConfirmed` is a +stand-in: it is dispatched once the activation is acknowledged, not once +anything booted. `full_update` is where that claim is actually tested. + +The same scenario checks the machine is back in `Ready` after the update. +Since `UpdateVerified` enters `PreSupervision`, the path back to `Ready` +runs through verification, and the stub verifier passes synchronously, so +that check would hold even with no boot walk ever polled. + +## Known weaknesses in the test apps + +- In `full_update` the RoT owns the sentinel, so a firmware-device failure + after the activation is acknowledged shows in the log but does not fail + the run. The orchestrator's own path covers the cases that matter today, + because every step needs the device's acknowledgement and a missing one + times out, and the host checks CS1 afterwards. It does not cover the + device's consent flags. + +- The RoT's own verifier reads the staging region, which in this scenario + is a synthetic pattern rather than the bytes the device actually staged. + The device checks the real bytes; the RoT checks a stand-in. +- A refusal is recorded rather than enforced. The device stops its own + flow, but the orchestrator has no way to make the request the Update + Agent sends fail with a PLDM completion code. +- `query_status` reports `PhaseFailed` with a fixed phase and result code + rather than the values the device sent the Update Agent. +- The RoT does not wait on the `USER` signal the Firmware Device raises. It + works because a `QueryStatus` sits in the channel until the device serves + it and this RoT has nothing else to do, but a real event loop would wait + on the signal. + +## Things that bit us, kept here so they are not rediscovered + +- A scenario asserting `State::Ready` passed with the device wedged. The + pass condition has to be the thing being tested, not a state that is + reached anyway. +- Three apps were calling `debug_shutdown`, so two sentinels reached the + console and the runner graded whichever came first. +- The agent calls `handle_component` twice, once to pass the component + table and once to start the component. +- An app whose thread stack is too small dies before its first log line, + with no panic and no warning. +- An app that is misaligned or oversized still builds; the only sign is a + PMSAv7 subregion overlap warning on the console. +- Whichever app owns the sentinel decides the run. `full_update` passed + while the device never rebooted, because the Firmware Device was still + declaring the verdict and its own flow had finished. +- `svn_commit` failed about one run in ten, and once on CI. Nothing is + registered between the device's two `run_terminus` calls, so the + Update Agent's UpdateSecurityRevision was dropped. It retries now. A + future scenario whose agent app sends a command just after update mode + ends needs the same retry. diff --git a/target/ast10x0/tests/integration/README.md b/target/ast10x0/tests/integration/README.md new file mode 100644 index 000000000..6ea8508a6 --- /dev/null +++ b/target/ast10x0/tests/integration/README.md @@ -0,0 +1,377 @@ +# QEMU integration tests + +Each scenario is its own system image, running under QEMU with no +hardware. The AST1030 is the black box; everything it talks to is another +app in the same image, reached through the same traits a real board wires. + +The runner greps one pass/fail sentinel per run, so one scenario per image +is what lets a failure name itself. + +That sentinel is why a scenario checks its claim by returning `false` and +logging what went wrong, rather than by calling `assert!`. A panic in a +`no_std` app on the target kills the process before the sentinel is +printed, so the run fails as a timeout with nothing saying why. The +verdict helpers follow that shape: `trial_closed_as_expected` in +`full_update` compares the confirm and revert counts, logs both numbers +when they differ, and hands a `bool` up to the one place that prints the +sentinel. + +A few are the thing working. Most are the thing failing, and they pass +when the failure is caught. One, `cancel_mid_transfer`, is neither: the +agent withdraws the update, so nothing failed and nothing was installed. +A scenario that only ever passes proves nothing: the first version of the +boot scenario passed with the device wedged, because it asserted the +wrong thing. Each negative also names the failure it +arranged, so a run that died of something else fails rather than looking +like the proof. + +| Scenario | What it arranges | Passes when | +| --- | --- | --- | +| `mock_downstream_device` | the device boots | the walk completes | +| `mock_downstream_device/device_hangs` | the device never reports | the platform locks | +| `mock_downstream_device/self_update` | the eRoT is offered an update of its own image | the candidate is staged and the trial is marked pending | +| `mock_downstream_device/self_trial` | the eRoT boots the trial image of its own update | the chain coming up confirms the session | +| `mock_downstream_device/measured` | the verifier reports a digest for the device's image | the sink is handed exactly one measurement, for that device | +| `mock_downstream_device/recovery` | the RoT refuses the device's image | the restore runs and the re-walk boots the device | +| `mock_downstream_device/recovery_exhausted` | the restored image is refused too | the platform reports the device and locks | +| `pldm_update` | a clean update | the update commits | +| `pldm_update/retry_chunk` | the Update Agent answers one data request with a retry | the Firmware Device requests that window again and the update completes | +| `pldm_update/corrupt_image` | one byte of the image is flipped | the Firmware Device catches it | +| `pldm_update/refused_update` | the RoT refuses the request | nothing is activated | +| `pldm_update/transfer_error` | the Update Agent errors on one data request | the Firmware Device aborts the transfer | +| `pldm_update/cancel_mid_transfer` | the Update Agent withdraws two chunks in | the state machine drops the update and acknowledges the Firmware Device | +| `pldm_update/offer_before_supervising` | the offer arrives before the RoT supervises anything | the RoT refuses it as busy | +| `pldm_update/svn_commit` | the Update Agent commits the security revision afterwards | the RoT grants it and the Firmware Device commits | +| `pldm_update/svn_commit_refused` | the Update Agent requests to commit the same revision twice | the RoT refuses the second request and the Firmware Device reports it not permitted | +| `full_update` | boot, update, reboot in one image | the device boots the image it was given | +| `full_update/device_hangs` | the device never comes up | no update is ever offered | +| `full_update/device_stays_down` | the device takes the update, then stays down | the RoT notices it never came back | +| `full_update/recovery_preempts` | the running image turns out corrupt mid-update | the candidate is dropped, the update reported superseded, and the platform locks | + +A negative scenario is a package of its own, built from the same sources +and the same system config with one `--cfg` added. `scenario.bzl` holds +the rules every scenario needs and `SCENARIO_CFGS` lists every flag, so +adding one is a BUILD file and a `#[cfg]`, not a copy of the image. + +## Running them + + bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/... + +One scenario at a time, with the console: + + bazel test --config=virt_ast10x0 --test_output=all \ + //target/ast10x0/tests/integration/mock_downstream_device:mock_downstream_device_qemu_test + + bazel test --config=virt_ast10x0 --test_output=all \ + //target/ast10x0/tests/integration/mock_downstream_device/self_update:self_update_qemu_test + + bazel test --config=virt_ast10x0 --test_output=all \ + //target/ast10x0/tests/integration/pldm_update:pldm_update_qemu_test + + bazel test --config=virt_ast10x0 --test_output=all \ + //target/ast10x0/tests/integration/pldm_update/retry_chunk:retry_chunk_qemu_test + + bazel test --config=virt_ast10x0 --test_output=all \ + //target/ast10x0/tests/integration/mock_downstream_device/self_trial:self_trial_qemu_test + + bazel test --config=virt_ast10x0 --test_output=all \ + //target/ast10x0/tests/integration/full_update:full_update_qemu_test + + bazel test --config=virt_ast10x0 --test_output=all \ + //target/ast10x0/tests/integration/pldm_update/svn_commit:svn_commit_qemu_test + + bazel test --config=virt_ast10x0 --test_output=all \ + //target/ast10x0/tests/integration/mock_downstream_device/measured:measured_qemu_test + + bazel test --config=virt_ast10x0 --test_output=all \ + //target/ast10x0/tests/integration/mock_downstream_device/recovery:recovery_qemu_test + +The rest, same shape. The negatives, and `cancel_mid_transfer`: + + //target/ast10x0/tests/integration/mock_downstream_device/device_hangs:device_hangs_qemu_test + //target/ast10x0/tests/integration/mock_downstream_device/recovery_exhausted:recovery_exhausted_qemu_test + //target/ast10x0/tests/integration/pldm_update/corrupt_image:corrupt_image_qemu_test + //target/ast10x0/tests/integration/pldm_update/refused_update:refused_update_qemu_test + //target/ast10x0/tests/integration/pldm_update/transfer_error:transfer_error_qemu_test + //target/ast10x0/tests/integration/pldm_update/cancel_mid_transfer:cancel_mid_transfer_qemu_test + //target/ast10x0/tests/integration/pldm_update/offer_before_supervising:offer_before_supervising_qemu_test + //target/ast10x0/tests/integration/pldm_update/svn_commit_refused:svn_commit_refused_qemu_test + //target/ast10x0/tests/integration/full_update/device_hangs:device_hangs_qemu_test + //target/ast10x0/tests/integration/full_update/device_stays_down:device_stays_down_qemu_test + +Bazel caches a passing test, so add `--nocache_test_results` when you want +the run to actually happen. Checking for a flake: + + for i in $(seq 1 20); do + bazel test --config=virt_ast10x0 --test_output=summary \ + --nocache_test_results \ + //target/ast10x0/tests/integration/... 2>&1 | grep 'tests pass' + done + +Each image also has a `no_panics_test`, which fails if any panic path +survives into the binary. It builds for the host and needs no QEMU. + +## The boot scenario + +`mock_downstream_device/` watches a managed device through a boot. The orchestrator app +runs the shipped state machine and platform driver; what the test supplies +is the board. + +```mermaid +flowchart LR + subgraph image["system image"] + orch["orchestrator
Orchestrator + PlatformDriver
CheckpointWalk"] + bmc["mock_downstream_device
BootBehaviour"] + end + orch -- "reset_cmd: assert / release" --> bmc + bmc -- "boot_evt: ready" --> orch +``` + +The two lines are IPC channels, not GPIO. Reset and ready are board traces +between two chips, QEMU models one chip, and the mock downstream device is a process +inside it, so even a working GPIO block would connect to nothing. The +adapters in `board/src/bmc.rs` are swapped out at the trait seam rather +than exercised; the pin wiring is what the hardware tests are for. + +Evidence arrives as a request on `boot_evt` and is latched in a static, +because `EvidenceReader::read` is synchronous and may not block. Both +directions of the reset line clear the latch, so a report from an earlier +attempt cannot satisfy the next walk. + +Reaching `Ready` is not the pass condition. A passive component is +released speculatively, so the machine is `Ready` as soon as the last +component verifies, whether or not the device ever came up. The walk's own +verdict is what proves the boot. + +`device_hangs` is the same image with the device set to never report. The +window closes, the walk names the checkpoint, recovery has no source and +the platform locks, which is what that scenario passes on: + + [ERR] device failed at checkpoint ready + [INF] report: component 0 failed at ready + [INF] report: component 0 out of recovery sources + [INF] the device never came up and the platform locked + TEST_RESULT:PASS + +`self_trial` is the same image with the eRoT's own update session set up +as the boot after an activation would find it: `TrialPending`, with the +trial image running. Nothing judges that session before the walk; what +judges it is the walk reaching `Ready`, which is where the state machine +confirms it. The run passes when the session reads `Committed` by the +time the device has booted, because a session that is still +`TrialPending` means that when the Update Agent sends +UpdateSecurityRevision, there is nothing to advance the anti-rollback +floor for. + +The session is two atomics rather than storage. This scenario never +resets the eRoT, so nothing has to survive a reset; what it exercises is +the path from the session, through `Event::SelfTrialBooted` and +`Effect::ConfirmSelfTrial`, back to the session. + +## The full update scenario + +`full_update/` is the other two joined: five apps, one image, the Update +Agent and the Firmware Device and the bus from `pldm_update`, the managed +device from `mock_downstream_device`, and a RoT that does both jobs. + +```mermaid +flowchart LR + subgraph image["system image"] + ua["pldm_ua"] + bus["mctp_bus"] + fd["pldm_fd"] + orch["orchestrator
supervises and commands"] + bmc["mock_downstream_device
the managed device"] + end + ua <--> bus + bus <--> fd + orch <-- "QueryStatus, Perform, Reject" --> fd + orch -- "reset" --> bmc + bmc -- "ready" --> orch +``` + +The claim is an ordering, which is the one thing the other scenarios cannot +test apart: the device boots under supervision, an update arrives, the RoT +accepts it, the device stages and verifies it, the RoT activates it, the +device is reset into the new image, it reports ready a second time, and only +then does the floor commit. + + [INF] ORCH: the device reported ready, first boot + [INF] ORCH: update accepted, 1024 bytes + [INF] ORCH: both verdicts agree, activating + [INF] ORCH: the device reported ready, second boot + [INF] ORCH: update committed after the device booted it + +The RoT declares this run rather than the Firmware Device, because the +device's own flow ends at activation and tells it nothing about the reset +that has to follow. The first version had the device declaring it, and the +run passed while the device never rebooted. + +Two negatives, and the second is the one that matters. +`full_update/device_hangs` has the device never come up, so the first walk +fails and no update is ever offered: that says the supervision half is +live before the update half. `full_update/device_stays_down` lets the +update succeed and then keeps the device from coming back: + + [INF] ORCH: update accepted, 1024 bytes + [INF] ORCH: both verdicts agree, activating + [ERR] ORCH: the device failed at checkpoint ready + [INF] ORCH: the device took the update and never came back + TEST_RESULT:PASS + +Every scenario that stops at activation passes that run. Only one that +waits for the device to boot what it was given can tell the difference, +which is the whole reason this scenario exists. + +The RoT names which of the four outcomes it reached rather than returning +a bare failure, so a run that died somewhere else fails instead of looking +like the proof. + +## The update scenario + +`pldm_update/` runs a full DSP0267 update, Update Agent to Firmware +Device, with the RoT deciding whether it may go on. + +```mermaid +flowchart LR + subgraph image["system image"] + ua["pldm_ua
Update Agent"] + bus["mctp_bus
one MCTP server per endpoint
joined by transport-loopback"] + fd["pldm_fd
FirmwareDevice"] + orch["orchestrator
Orchestrator + PlatformDriver"] + end + ua <-- "MCTP, EID 42" --> bus + bus <-- "MCTP, EID 8" --> fd + fd -- "update lifecycle" --> orch + orch -- "accepted / refused" --> fd +``` + +PLDM reaches the wire the way it does on hardware: each endpoint is an +`IpcMctpClient` to an MCTP server. Only the bottom binding differs, +`transport-loopback` instead of `transport-i2c`, so EID routing, +fragmentation and reassembly are the shipped code. + +The Firmware Device decides nothing. It reports what the Update Agent +asked for and what came of it, and the orchestrator says whether the +update may proceed: + +```mermaid +sequenceDiagram + participant UA as pldm_ua + participant FD as pldm_fd + participant RoT as orchestrator + UA->>FD: RequestUpdate + FD->>RoT: UpdateRequested, 1024 bytes + Note over RoT: request_update records the job,
the pump verifies the candidate + RoT-->>FD: accepted + UA->>FD: image, in windows + Note over FD: reads the staged image back + FD->>RoT: VerifyOutcome, good + Note over RoT: both verdicts agree,
ActivateUpdate reaches the device + RoT-->>FD: accepted + UA->>FD: ActivateFirmware + FD->>RoT: Activated + Note over RoT: BootConfirmed commits the floor + RoT-->>FD: accepted +``` + +The accepted `RequestUpdate` travels through an `FdEventSink`, so it is +sent while `run_terminus` is running rather than after it returns. That is +what lets the orchestrator be in `Updating` before the verdict arrives. +Verify and activation are reported from the `FdOps` calls that settle +them, because only those know the outcome. + +The orchestrator is its own process rather than a core inside the Firmware +Device. The design has the RoT grant or refuse and the device obey, and +that means nothing when both are the same thread with the same state. + +Two verdicts land on the same candidate. The device reads its staged image +back out of flash and checks it against the pattern the Update Agent sent; +the RoT's own verifier reads the staging region and does the same. The +update goes through only when both say yes. + +The device stages into real SPI NOR on chip select 1, at `0x10_0000`, not +into a RAM buffer. Both chip selects are attached, because with both +present the FMC aperture splits and CS1 moves to `0x88000000`, which is +the window the device maps. The kernel applies the FMC pinmux before any +process starts, so no app touches the SCU. + +A third verdict comes from outside the guest. After QEMU exits, the runner +reads the CS1 backing file and compares it with the image the update was +supposed to write (`cs1_expect` and `cs1_expect_offset` on the test). Every +other check is the guest talking about its own memory; this one is the host +reading the device's flash, and it is the only one a confused guest cannot +talk its way past. Flipping a byte of the expected file gives: + + TEST_RESULT:PASS + CS1 differs from the expected image at 0x10012c: got 0x31, want 0x30 + +with the test failing anyway, which is the point. + +`corrupt_image` flips one byte of what the Update Agent sends. The device +catches it at download, and the scenario passes on that rather than on +the run merely failing: + + [ERR] FD: byte 700 is wrong + [INF] FD: the corrupt image was caught and the update refused + TEST_RESULT:PASS + +`refused_update` has the RoT refuse the request before looking at +anything. The update never reaches `Updating`, and the orchestrator +afterwards agrees to nothing else either: + + [ERR] ORCH: a verdict arrived with no update in flight + [ERR] ORCH: a boot was reported for an update that never activated + [INF] FD: the orchestrator withheld consent and the update did not happen + TEST_RESULT:PASS + +That second one also shows a gap rather than hiding it. The device +finishes the PLDM flow and activates, because a refusal is recorded and +not enforced yet. + +## What is not proven yet + +GAPS.md has the full list, including the arcs of the update state machine +with no scenario yet and the assertions that are looser than they look. +The short version: + +Signature checking is stubbed until the crypto service exists, so all the +verifiers are content checks rather than signature checks. The driver's +`Updatable` stages nothing, because in DSP0267 the device pulls its own +chunks from the Update Agent, so `activate` is the only side of that seam +with a real caller. And a refusal is recorded rather than enforced: the +device finishes the PLDM flow and fails the run at the end instead of +answering the Update Agent with an error. + +## Memory layout + +Both images are tight. The AST1030 has 768 KB of SRAM and no XIP, so code +and data share it. Each `system.json5` carries its own map and the +reasoning. The rule both follow: an app's flash has to start at a multiple +of its own size. The pldm_update image runs four 64 KB apps from +`0x10000`; the mock_downstream_device image runs two 128 KB apps from `0x20000`. + +That rule comes from the MPU. It protects memory in regions, and a region +has to be a power of two in size and start at a multiple of its size, so a +64 KB app has to start on a 64 KB boundary. The MPU also cuts each region +into eight subregions, which is how it covers a span that is not itself a +power of two. + +So the apps cannot be packed end to end behind the kernel. Give the kernel +a round 64 KB and its flash runs to `0x10500`, past the vector table at the +bottom. An app placed there cannot have a region starting there, because +`0x10500` is not a multiple of 64 KB. The nearest legal start is `0x10000`, +and that region's last subregions then reach into the next app, so two apps +share subregions and neither is protected from the other. The sizes fit and +the addresses still do not. + +That is why the kernel's flash is 64256 bytes rather than a round 64 KB: +`0x10000` minus the 1280-byte vector table, which puts the first app at +exactly `0x10000`. The mock_downstream_device image does the same thing one power of two +up, with 129792 bytes. + +Getting a size wrong is quiet. The image still builds, and the only sign is +a PMSAv7 subregion overlap warning on the console, which means the +protection is wrong. Check for one after changing any size. A thread whose +stack is too small is quieter still: the app dies before its first log +line, with no panic and no warning. diff --git a/target/ast10x0/tests/integration/full_update/BUILD.bazel b/target/ast10x0/tests/integration/full_update/BUILD.bazel new file mode 100644 index 000000000..c855cadab --- /dev/null +++ b/target/ast10x0/tests/integration/full_update/BUILD.bazel @@ -0,0 +1,32 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load(":apps.bzl", "APPS", "FLASH", "SYSTEM_CONFIG", "TARGET_DEPS", "TARGET_SRC") + +package(default_visibility = ["//target/ast10x0/tests/integration:__subpackages__"]) + +filegroup( + name = "system_config", + srcs = ["system.json5"], +) + +exports_files([ + "target.rs", + "orchestrator_main.rs", +]) + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/full_update:full_update_qemu_test +qemu_scenario( + name = "full_update_qemu", + apps = APPS, + cfgs = ["rot_owns_verdict"], + flash = dict( + FLASH, + cs1_expect = "//target/ast10x0/tests/integration/pldm_update:staged_image", + cs1_expect_offset = 0x100000, + ), + system_config = SYSTEM_CONFIG, + target_deps = TARGET_DEPS, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/full_update/apps.bzl b/target/ast10x0/tests/integration/full_update/apps.bzl new file mode 100644 index 000000000..2fc556466 --- /dev/null +++ b/target/ast10x0/tests/integration/full_update/apps.bzl @@ -0,0 +1,53 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +"""The apps in the full update scenario. + +Four of the five are the other scenarios' sources, built from here by +label: the Update Agent, the Firmware Device and the bus from +pldm_update, the managed device from mock_downstream_device. Only the +RoT is new, because it is the only one that has to do both jobs at once. +""" + +load("//target/ast10x0/tests/integration/mock_downstream_device:apps.bzl", mock_downstream_device_apps = "APPS") +load("//target/ast10x0/tests/integration/pldm_update:apps.bzl", _FLASH = "FLASH", pldm_apps = "APPS") + +HERE = "//target/ast10x0/tests/integration/full_update:" + +FLASH = _FLASH + +ORCHESTRATOR_DEPS = [ + "//services/orchestrator/adapters/walk:orchestrator_checkpoint_walk", + "//services/orchestrator/capabilities:orchestrator_capabilities", + "//services/orchestrator/config:orchestrator_config", + "//services/orchestrator/driver:orchestrator_driver", + "//services/orchestrator/sm:orchestrator_sm", + "//services/orchestrator/test:stubs", + "//services/pldm/api:pldm_api", + "//services/pldm/client:pldm_client", + "//util/io", + "//util/ipc:ipc", + "//target/ast10x0/tests/clock", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + "@pigweed//pw_status/rust:pw_status", +] + +def _without_orchestrator(apps): + return [app for app in apps if app["name"] != "orchestrator"] + +APPS = _without_orchestrator(pldm_apps) + _without_orchestrator(mock_downstream_device_apps) + [ + # The RoT: supervises the managed device and commands the firmware + # device, which is what makes this scenario more than the other two + # running side by side. + { + "deps": ORCHESTRATOR_DEPS, + "name": "orchestrator", + "src": HERE + "orchestrator_main.rs", + }, +] + +TARGET_DEPS = ["//target/ast10x0/peripherals"] + +SYSTEM_CONFIG = HERE + "system_config" +TARGET_SRC = HERE + "target.rs" diff --git a/target/ast10x0/tests/integration/full_update/device_hangs/BUILD.bazel b/target/ast10x0/tests/integration/full_update/device_hangs/BUILD.bazel new file mode 100644 index 000000000..22e36887c --- /dev/null +++ b/target/ast10x0/tests/integration/full_update/device_hangs/BUILD.bazel @@ -0,0 +1,30 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +# The full scenario's negative: the managed device never comes up. +# +# It passes when the first walk fails, so no update is ever offered. That +# is what says the supervision half is live before the update half, rather +# than the RoT accepting an update for a device that is not there. +# +# The RoT ends this run, on the failed first walk, before the Update Agent +# gets as far as offering anything. So the Firmware Device never waits on +# a RoT that is not listening, and the run does not sit out its decision +# timeout: it finishes in about a second. + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load("//target/ast10x0/tests/integration/full_update:apps.bzl", "APPS", "FLASH", "SYSTEM_CONFIG", "TARGET_DEPS", "TARGET_SRC") + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/full_update/device_hangs:device_hangs_qemu_test +qemu_scenario( + name = "device_hangs_qemu", + apps = APPS, + cfgs = [ + "rot_owns_verdict", + "device_hangs", + ], + flash = FLASH, + system_config = SYSTEM_CONFIG, + target_deps = TARGET_DEPS, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/full_update/device_stays_down/BUILD.bazel b/target/ast10x0/tests/integration/full_update/device_stays_down/BUILD.bazel new file mode 100644 index 000000000..dddcb9911 --- /dev/null +++ b/target/ast10x0/tests/integration/full_update/device_stays_down/BUILD.bazel @@ -0,0 +1,26 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +# The full scenario's negative: the managed device takes the update and +# never comes back from the reset that was supposed to boot it. +# +# This is the one that matters. The update itself succeeds, so every +# scenario that stops at activation would still pass; only a run that +# waits for the device to boot what it was given can tell the difference. + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load("//target/ast10x0/tests/integration/full_update:apps.bzl", "APPS", "FLASH", "SYSTEM_CONFIG", "TARGET_DEPS", "TARGET_SRC") + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/full_update/device_stays_down:device_stays_down_qemu_test +qemu_scenario( + name = "device_stays_down_qemu", + apps = APPS, + cfgs = [ + "rot_owns_verdict", + "device_stays_down", + ], + flash = FLASH, + system_config = SYSTEM_CONFIG, + target_deps = TARGET_DEPS, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/full_update/orchestrator_main.rs b/target/ast10x0/tests/integration/full_update/orchestrator_main.rs new file mode 100644 index 000000000..742d1e5bf --- /dev/null +++ b/target/ast10x0/tests/integration/full_update/orchestrator_main.rs @@ -0,0 +1,902 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The RoT in the full update scenario: it supervises the managed device +//! and commands the Firmware Device, and the point of the scenario is that +//! it does both in one run. +//! +//! The claim is an ordering. The device boots under supervision and the +//! walk completes. An update arrives over PLDM, the RoT accepts it, the +//! device stages and verifies it, the RoT activates it. Activation only +//! proposes the image, so the state machine re-walks: the device is reset, +//! boots the image it was just given, and reports ready a second time. +//! Only then does the successful boot confirm the image, and only then +//! does the SVN floor commit. +//! +//! Each of those steps has its own scenario elsewhere. What cannot be +//! tested apart is that they happen in that order, with the second ready +//! report caused by the reset that followed the activation rather than +//! left over from the first boot. + +#![no_main] +#![no_std] + +use core::convert::Infallible; +use core::sync::atomic::{AtomicBool, AtomicU32, Ordering}; + +use board_stubs::{BoardFault, StubImage, StubVerifier}; +use openprot_orchestrator_driver::{ + bring_up, request_update, Board, BoardCapabilities, ComponentWiring, Report, ReportSink, + SvnFloorBinding, +}; +use openprot_orchestrator_sm::{ComponentAttrs, ComponentId, Event, PowerOnResult, State}; +use orchestrator_capabilities::{ + AuthenticatedImage, BootControl, BootStatus, DeviceTrialBoot, EvidenceReader, + IncrementalVerifier, PollOutcome, StageProgress, Svn, SvnFloor, Updatable, UpdateError, + VerifySession, +}; +use orchestrator_checkpoint_walk::CheckpointWalk; +use orchestrator_config::{ + assert_retry_reaches_every_image, chain_of, BootCheckpoint, ChainEntries, DeviceConfig, +}; +use pldm_api::wire::{MAX_REQUEST_SIZE, MAX_RESPONSE_SIZE}; +use pldm_api::{FdStatus, RejectReason}; +use pldm_client::{ClientError, FdIpcClient, Reply}; +use util_io::{ByteReadError, ByteSource}; +use util_ipc::{AsyncChannelTransport, IpcHandle}; + +use board_clock::{deadline_in, now_millis}; +use userspace::syscall::Signals; +use userspace::time::{Clock, Instant, SystemClock}; +use userspace::{entry, syscall}; + +use app_orchestrator::handle; + +/// The component this RoT supervises and updates. Position 1 because the +/// eRoT holds position 0 in every device table. +const TARGET: ComponentId = ComponentId::new(1); + +/// Chain capacity and the effect-sink cap on the core (`E >= 2*N + 2`). +const N: usize = DEVICES.len(); +const E: usize = 2 * N + 2; +const MAX_RETRY: u8 = 3; + +/// Bytes in the image the Update Agent hands over, and where the device +/// stages it. +const IMAGE_SIZE: usize = 1024; +const STAGING_BASE: u32 = 0x10_0000; + +/// How long the managed device has to report ready after a reset. The +/// device boots in 50 ms, so the window fails only when the device hung, +/// not when QEMU ran slow. +const BOOT_WINDOW_MILLIS: u64 = 2_000; + +/// How long one supervised boot may take before the run gives up. Larger +/// than the window so the walk, not this budget, judges a late device. +const BOOT_BUDGET_MILLIS: u64 = 10_000; + +/// How long the Firmware Device may take to answer a command. +const DEVICE_TIMEOUT_MILLIS: u64 = 10_000; + +/// How many device steps one update may take. A full run is four. +const MAX_DEVICE_STEPS: usize = 16; + +/// Reset command bytes, read by the managed device as its reset line. +const RESET_ASSERT: u8 = 0; +const RESET_RELEASE: u8 = 1; + +/// The PLDM IPC buffers this process lends the kernel. +static mut SEND_BUF: [u8; MAX_REQUEST_SIZE] = [0; MAX_REQUEST_SIZE]; +static mut RECV_BUF: [u8; MAX_RESPONSE_SIZE] = [0; MAX_RESPONSE_SIZE]; + +type Fd = FdIpcClient>; +type Core = openprot_orchestrator_sm::Orchestrator; +type Driver = openprot_orchestrator_driver::PlatformDriver; + +/// The device table. One checkpoint: the device reports ready inside the +/// window or it does not. +/// Chain position 0 is the eRoT itself. It is addressable but never +/// supervised. This scenario updates the downstream device and not the eRoT, +/// so the eRoT entry carries no layout. +static DEVICES: [DeviceConfig; 2] = [ + DeviceConfig::erot("erot", None), + DeviceConfig::new( + "downstream", + 0, + &[BootCheckpoint::new( + "ready", + 1, + core::time::Duration::from_millis(BOOT_WINDOW_MILLIS), + )], + None, + ComponentAttrs::passive_required(), + ), +]; + +static CHAIN: ChainEntries = chain_of(&DEVICES); + +const _: () = assert_retry_reaches_every_image(MAX_RETRY, &DEVICES); + +/// Latches the ready report from the managed device. `drain_reports` +/// sets the latch when the report arrives, and `BmcReset` clears it on +/// every reset, so the walk after the activation reset sees only a +/// report from the boot it supervises, not the report the first boot +/// left behind. +static DEVICE_READY: AtomicBool = AtomicBool::new(false); + +/// How many times `release` let the device out of reset. `run` reads +/// the count before and after the update and fails unless it went up: +/// without a reset the latch still holds the ready report from the +/// first boot, and the second walk would pass on it. +static RESETS: AtomicU32 = AtomicU32::new(0); + +/// Set when the verifier the RoT runs itself authenticates the candidate. +static ROT_AUTHENTICATED: AtomicBool = AtomicBool::new(false); + +/// Set when the driver calls `Updatable::activate`. +static ACTIVATED: AtomicBool = AtomicBool::new(false); + +/// Times `abandon` ran on the staged candidate, and times +/// `ReportUpdateAborted` reached the sink. Statics because the updatable +/// lives inside the board and the sink beside it, while the run that +/// judges them is outside both. +static ABANDONED: AtomicU32 = AtomicU32::new(0); +static ABORTED: AtomicU32 = AtomicU32::new(0); + +/// How far the run got. A negative scenario arranges one of these and +/// passes on that one, so a run that died somewhere else fails rather +/// than looking like the proof. +#[derive(Clone, Copy, PartialEq, Eq)] +enum Outcome { + /// The device booted, took an update, rebooted into it, and the SVN + /// floor committed. + Committed, + /// The device never came up at all, so no update was ever offered. + FirstBootFailed, + /// The update itself did not go through. + UpdateFailed, + /// The device took the update but never came back from the reset that + /// was supposed to boot it. + SecondBootFailed, + /// Recovery took the platform away from the update while the device + /// was still transferring. + Preempted, +} + +/// Counts what the orchestrator did with the trial record for the managed +/// device. The driver owns the board, so the scenario reads the counts +/// through these statics. +static CONFIRMS: AtomicU32 = AtomicU32::new(0); +static REVERTS: AtomicU32 = AtomicU32::new(0); + +/// The trial record for the downstream device. A real record is slot +/// metadata the +/// device reads at boot; this record counts calls instead, because the +/// scenario claims exact confirm and revert counts. +struct TrialRecord; + +impl DeviceTrialBoot for TrialRecord { + type Error = BoardFault; + + /// The scenario starts with no trial open, so `is_pending` answers + /// false. The settle path for a trial left open at boot is an open + /// question in GAPS.md. + fn is_pending(&self) -> Result { + Ok(false) + } + + fn confirm(&mut self) -> Result<(), BoardFault> { + CONFIRMS.fetch_add(1, Ordering::Relaxed); + pw_log::info!("ORCH: the orchestrator confirmed the trial for the device"); + Ok(()) + } + + fn revert(&mut self) -> Result<(), BoardFault> { + REVERTS.fetch_add(1, Ordering::Relaxed); + pw_log::info!("ORCH: the orchestrator reverted the trial for the device"); + Ok(()) + } +} + +/// How often the orchestrator closed the trial, each way. +#[derive(PartialEq, Eq)] +struct TrialCloses { + confirms: u32, + reverts: u32, +} + +/// What this scenario expects those counts to be. +const EXPECT_TRIAL: TrialCloses = if cfg!(device_hangs) { + // No update is ever offered, so no image is ever on trial. + TrialCloses { + confirms: 0, + reverts: 0, + } +} else if cfg!(device_stays_down) { + // The driver activated the image and the image never ran, so the + // orchestrator reverts the trial. + TrialCloses { + confirms: 0, + reverts: 1, + } +} else { + // The device booted what it was given, so the orchestrator confirms + // the trial. + TrialCloses { + confirms: 1, + reverts: 0, + } +}; + +/// Whether the trial ended the way this scenario says it must. +/// +/// Returns a `bool` instead of asserting, because a panic here would kill +/// the app before the pass/fail sentinel is printed and the run would +/// fail as a timeout saying nothing. README.md has the convention. +fn trial_closed_as_expected() -> bool { + let closed = TrialCloses { + confirms: CONFIRMS.load(Ordering::Relaxed), + reverts: REVERTS.load(Ordering::Relaxed), + }; + if closed == EXPECT_TRIAL { + return true; + } + pw_log::error!( + "ORCH: the trial closed {} confirms and {} reverts, expected {} and {}", + closed.confirms as u32, + closed.reverts as u32, + EXPECT_TRIAL.confirms as u32, + EXPECT_TRIAL.reverts as u32 + ); + false +} + +/// Whether the run did what this scenario expects of it. +fn verdict(outcome: Outcome) -> bool { + match outcome { + Outcome::Committed => { + if cfg!(any(device_hangs, device_stays_down)) { + pw_log::error!("ORCH: the update committed, which this scenario rules out"); + return false; + } + pw_log::info!("ORCH: the device booted the image it was given"); + trial_closed_as_expected() + } + Outcome::FirstBootFailed => { + if cfg!(device_hangs) { + pw_log::info!("ORCH: the device never came up, so no update was offered"); + return trial_closed_as_expected(); + } + pw_log::error!("ORCH: the device never came up"); + false + } + Outcome::SecondBootFailed => { + if cfg!(device_stays_down) { + pw_log::info!("ORCH: the device took the update and never came back"); + return trial_closed_as_expected(); + } + pw_log::error!("ORCH: the device never came back from the activation reset"); + false + } + Outcome::UpdateFailed => { + pw_log::error!("ORCH: the update did not go through"); + false + } + Outcome::Preempted => { + if !cfg!(recovery_preempts) { + pw_log::error!( + "ORCH: recovery took the update away, which this scenario rules out" + ); + return false; + } + pw_log::info!( + "ORCH: recovery preempted the update and the driver dropped the candidate" + ); + true + } + } +} + +/// The byte the Update Agent sends at `offset`, which is also what the +/// staging region serves and what the device checks. +fn expected_byte(offset: usize) -> u8 { + (offset % 251) as u8 +} + +/// Drives the reset line of the managed device. An undeliverable command +/// is a wiring failure, not a boot failure. +fn drive_reset(level: u8) -> Result<(), BoardFault> { + let mut ack = [0u8; 1]; + syscall::channel_transact(handle::RESET_CMD, &[level], &mut ack, deadline_in(1_000)) + .map(|_| ()) + .map_err(|_| BoardFault) +} + +/// The reset line of the managed device. `hold_in_reset` and `release` +/// both clear the ready latch: the device is restarting either way, so +/// anything it reported before belongs to an earlier attempt. +struct BmcReset; + +impl BootControl for BmcReset { + type Error = BoardFault; + + fn hold_in_reset(&mut self) -> Result<(), BoardFault> { + DEVICE_READY.store(false, Ordering::Relaxed); + drive_reset(RESET_ASSERT) + } + + fn release(&mut self) -> Result<(), BoardFault> { + DEVICE_READY.store(false, Ordering::Relaxed); + RESETS.fetch_add(1, Ordering::Relaxed); + drive_reset(RESET_RELEASE) + } +} + +/// Reads the ready latch. `EvidenceReader::read` is synchronous and may not +/// block, so the latch is the only shape that fits. +struct BmcEvidence; + +impl EvidenceReader for BmcEvidence { + type Error = Infallible; + + fn read(&mut self, _probe: &u8) -> Result { + Ok(if DEVICE_READY.load(Ordering::Relaxed) { + BootStatus::Booted + } else { + BootStatus::Booting + }) + } +} + +/// The device keeps its own SVN floor: a PLDM Firmware Device commits +/// internally, so the eRoT holds no second floor. +struct NoFloor; + +impl SvnFloor for NoFloor { + type Error = BoardFault; + + fn floor(&self) -> Result { + Err(BoardFault) + } + + fn advance(&mut self, _to: Svn) -> Result<(), BoardFault> { + Err(BoardFault) + } +} + +/// The Firmware Device as the driver sees it. The device has already +/// staged the candidate by the time the RoT hears about it, because the +/// device pulls its own chunks from the Update Agent, so `activate` is +/// the one call that reaches the device. +struct FdUpdatable; + +impl Updatable for FdUpdatable { + fn poll_stage(&mut self, _payload: &dyn ByteSource) -> Result { + Ok(StageProgress::Ready) + } + + fn abandon(&mut self) { + ABANDONED.fetch_add(1, Ordering::Relaxed); + pw_log::info!("ORCH: the driver dropped the staged candidate"); + } + + fn activate(&mut self) -> Result<(), UpdateError> { + ACTIVATED.store(true, Ordering::Relaxed); + Ok(()) + } +} + +/// The staging region, as big as the candidate and carrying the bytes the +/// device is expected to have staged. +struct PatternStaging; + +impl ByteSource for PatternStaging { + fn len(&self) -> u64 { + IMAGE_SIZE as u64 + } + + fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<(), ByteReadError> { + let end = offset + .checked_add(buf.len() as u64) + .ok_or(ByteReadError::OutOfRange)?; + if end > self.len() { + return Err(ByteReadError::OutOfRange); + } + for (i, slot) in buf.iter_mut().enumerate() { + *slot = expected_byte(offset as usize + i); + } + Ok(()) + } +} + +/// The check the RoT runs itself on the staged candidate. A content +/// check, because signature checking belongs to the crypto service and is +/// stubbed. +struct PatternVerifier; + +struct PatternSession; + +impl IncrementalVerifier for PatternVerifier { + type Error = BoardFault; + type Session = PatternSession; + + fn start(self) -> PatternSession { + PatternSession + } +} + +impl VerifySession for PatternSession { + type Verifier = PatternVerifier; + type Error = BoardFault; + + fn poll(self, payload: &dyn ByteSource) -> PollOutcome { + let len = payload.len() as usize; + if len == 0 { + return PollOutcome::Fault(PatternVerifier, BoardFault); + } + + let mut chunk = [0u8; 64]; + let mut offset = 0usize; + while offset < len { + let take = core::cmp::min(chunk.len(), len - offset); + if payload.read_at(offset as u64, &mut chunk[..take]).is_err() { + return PollOutcome::Fault(PatternVerifier, BoardFault); + } + for (i, byte) in chunk[..take].iter().enumerate() { + if *byte != expected_byte(offset + i) { + return PollOutcome::Rejected(PatternVerifier); + } + } + offset += take; + } + + ROT_AUTHENTICATED.store(true, Ordering::Relaxed); + PollOutcome::Authenticated { + verifier: PatternVerifier, + image: AuthenticatedImage { + // The pattern check reads a synthetic image: no manifest + // and no digest. + svn: None, + measurement: None, + }, + } + } + + fn abandon(self) -> PatternVerifier { + PatternVerifier + } +} + +/// Reports go to the console, where the test reads them as an operator +/// would. +struct LogSink; + +impl ReportSink for LogSink { + fn report(&mut self, report: Report) { + match report { + Report::Isolated(id) => { + pw_log::info!("ORCH: report, component {} isolated", id.get() as u32) + } + Report::RecoveryFailed(id) => pw_log::info!( + "ORCH: report, component {} out of recovery sources", + id.get() as u32 + ), + Report::UpdateAborted => { + ABORTED.fetch_add(1, Ordering::Relaxed); + pw_log::info!("ORCH: report, the update was superseded") + } + Report::BootFailed { id, checkpoint, .. } => pw_log::info!( + "ORCH: report, component {} failed at {}", + id.get() as u32, + checkpoint as &str + ), + _ => pw_log::info!("ORCH: report, unrecognised"), + } + } +} + +struct UpdateBoard; + +impl BoardCapabilities for UpdateBoard { + type Image = StubImage; + type Verifier = StubVerifier; + type BootControl = BmcReset; + type BootWatch = CheckpointWalk; + type SvnFloor = NoFloor; + type ReportSink = LogSink; + type Updatable = FdUpdatable; + type Recovery = (); + type DeviceTrial = TrialRecord; + type Staging = PatternStaging; + type UpdateVerifier = PatternVerifier; + type SelfUpdate = (); + type SelfReset = (); + type ResetSignal = u8; + type Probe = u8; +} + +fn board() -> Board { + Board { + // Built from the table index, so the parts of one component + // cannot end up wired to a different slot than the one they sit + // in. + // + // Index 0 is the eRoT. The walk passes over the eRoT entry, so + // nothing reads or actuates it. Components are indexed by ComponentId, + // so index 0 still needs a value. + components: core::array::from_fn(|i| ComponentWiring { + device: &DEVICES[i], + image: StubImage, + boot_control: BmcReset, + boot_watch: CheckpointWalk::new(BmcEvidence, &DEVICES[i]), + svn_floor: SvnFloorBinding::SelfManaged, + updatable: FdUpdatable, + recovery: (), + trial: TrialRecord, + }), + verifier: StubVerifier, + report_sink: LogSink, + update_staging: PatternStaging, + update_verifier: Some(PatternVerifier), + self_update: None, + update_stall_budget_millis: 5_000, + } +} + +/// Drains whatever the managed device has reported and latches a ready +/// report. Non-blocking: the caller has already waited. +fn drain_reports() { + let mut evt = [0u8; 1]; + while let Ok(len) = syscall::channel_read(handle::BOOT_EVT, 0usize, &mut evt) { + let _ = syscall::channel_respond(handle::BOOT_EVT, &[0u8; 0]); + if len == 1usize && evt[0] == 1 { + DEVICE_READY.store(true, Ordering::Relaxed); + } + } +} + +#[entry] +fn entry() { + pw_log::info!("ORCH: app started"); + + if syscall::wait_group_add(handle::WG, handle::BOOT_EVT, Signals::READABLE, 0usize).is_err() { + pw_log::error!("ORCH: wait group add failed"); + loop {} + } + + // SAFETY: taken once, at the entry point of this process, and handed + // straight to the transport that owns them from here on. + let send = unsafe { &mut *core::ptr::addr_of_mut!(SEND_BUF) }; + let recv = unsafe { &mut *core::ptr::addr_of_mut!(RECV_BUF) }; + let transport = AsyncChannelTransport::new(IpcHandle::new(handle::FD), send, recv); + let mut fd = FdIpcClient::new(transport); + + let (mut core, mut driver) = + bring_up::(&CHAIN, &DEVICES, board(), MAX_RETRY); + + // The RoT declares this run. The claim is the ordering, and only the + // RoT sees the whole of it: the flow at the Firmware Device ends at + // activation and says nothing about the reset that has to follow. + let outcome = run(&mut core, &mut driver, &mut fd); + if verdict(outcome) { + let _ = syscall::debug_shutdown(Ok(())); + } else { + let _ = syscall::debug_shutdown(Err(pw_status::Error::Internal)); + } + #[expect(clippy::empty_loop)] + loop {} +} + +/// The whole scenario, in the order the claim is about. +fn run(core: &mut Core, driver: &mut Driver, fd: &mut Fd) -> Outcome { + // Power on. The driver releases the device, which arms its walk. + core.dispatch(driver, Event::PowerGood(PowerOnResult::Provisioned)); + if !supervise_boot(core, driver, "first") { + return Outcome::FirstBootFailed; + } + if core.state() != State::Ready { + pw_log::error!("ORCH: not supervising after the first boot"); + return Outcome::FirstBootFailed; + } + + let resets_before = RESETS.load(Ordering::Relaxed); + + if !drive_update(core, driver, fd) { + if cfg!(recovery_preempts) { + return preemption_outcome(core); + } + return Outcome::UpdateFailed; + } + + // Activation only proposed the image. The state machine re-walks, and + // that walk is what resets the device into the image the driver just + // activated. + let resets_after = RESETS.load(Ordering::Relaxed); + if resets_after <= resets_before { + pw_log::error!("ORCH: no reset followed the activation"); + return Outcome::UpdateFailed; + } + + if !supervise_boot(core, driver, "second") { + return Outcome::SecondBootFailed; + } + + // Only now has the boot confirmed the image. + core.dispatch(driver, Event::BootConfirmed(TARGET)); + // And the SVN floor moves only when the Update Agent sends + // UpdateSecurityRevision. Dispatched here rather than read off the + // device status: the Firmware Device never parks at + // `SvnCommitPending` in this build, which GAPS.md records. + core.dispatch(driver, Event::SvnCommitRequest(TARGET)); + if core.state() != State::Ready { + pw_log::error!("ORCH: the state machine did not settle after the second boot"); + return Outcome::SecondBootFailed; + } + pw_log::info!("ORCH: update committed after the device booted it"); + Outcome::Committed +} + +/// Checks what the state machine did with the update that recovery +/// preempted. +/// +/// `abandon` ran once: a run that staged nothing never calls it, and a +/// retry loop calls it repeatedly. `ReportUpdateAborted` reached the sink, +/// which says the update was superseded, where `ReportUpdateDeferred` +/// would say it was refused for later. And `activate` never ran, which is +/// also true of a run that offered no update at all. +/// +/// The board wires no recovery source, so the episode exhausts its sources +/// on the first attempt and the platform locks, which is where the run +/// ends. +fn preemption_outcome(core: &Core) -> Outcome { + let abandoned = ABANDONED.load(Ordering::Relaxed); + let aborted = ABORTED.load(Ordering::Relaxed); + if abandoned != 1 || aborted != 1 { + pw_log::error!( + "ORCH: the preemption discarded {} candidates and reported {} aborts, expected one each", + abandoned as u32, + aborted as u32 + ); + return Outcome::UpdateFailed; + } + if ACTIVATED.load(Ordering::Relaxed) { + pw_log::error!("ORCH: the driver activated the preempted update anyway"); + return Outcome::UpdateFailed; + } + if core.state() != State::Locked { + pw_log::error!("ORCH: recovery had no source and the platform did not lock"); + return Outcome::UpdateFailed; + } + Outcome::Preempted +} + +/// Waits for the walk on the managed device to complete. +/// +/// The verdict of the walk is the pass condition, not the state of the +/// state machine: the driver releases a passive component speculatively, +/// so the state machine reaches `Ready` whether or not the device ever +/// came up. +fn supervise_boot(core: &mut Core, driver: &mut Driver, which: &str) -> bool { + let give_up = deadline_in(BOOT_BUDGET_MILLIS); + + loop { + if core.state() == State::Locked { + pw_log::error!("ORCH: the platform locked during a boot"); + return false; + } + + let poll = driver.poll_boot_walks(now_millis()); + match poll.event { + Some(Event::Booted(_)) | Some(Event::ComponentReady(_)) => { + let event = poll.event.expect("just matched"); + core.dispatch(driver, event); + pw_log::info!("ORCH: the device reported ready, {} boot", which as &str); + return true; + } + Some(Event::BootFailed { checkpoint, .. }) => { + pw_log::error!( + "ORCH: the device failed at checkpoint {}", + checkpoint as &str + ); + core.dispatch(driver, poll.event.expect("just matched")); + return false; + } + Some(event) => { + core.dispatch(driver, event); + continue; + } + None => {} + } + + let deadline = match poll.next_deadline_millis { + Some(millis) => Instant::from_ticks(millis * SystemClock::TICKS_PER_SEC / 1000), + None => give_up, + }; + match syscall::object_wait(handle::WG, Signals::READABLE, deadline) { + Ok(_) => drain_reports(), + Err(pw_status::Error::DeadlineExceeded) => {} + Err(_) => return false, + } + + if SystemClock::now() >= give_up { + pw_log::error!("ORCH: gave up waiting for the device to boot"); + return false; + } + } +} + +/// Drives one update, device step by device step, up to activation. +fn drive_update(core: &mut Core, driver: &mut Driver, fd: &mut Fd) -> bool { + for _ in 0..MAX_DEVICE_STEPS { + let Some(status) = query(fd) else { + return false; + }; + + match status { + FdStatus::OfferPending { total, .. } => { + if !offer(core, driver, fd, total) { + return false; + } + // The device is transferring now. The corruption lands + // here in the scenario that arranges one: the state + // machine is in `Updating` and the candidate is + // mid-transfer. + if cfg!(recovery_preempts) { + pw_log::info!("ORCH: the image the device is running is corrupt, mid-update"); + core.dispatch(driver, Event::CorruptionDetected(TARGET)); + return false; + } + } + FdStatus::VerifyPending => { + if !command(fd, |fd| fd.perform_verify()) { + return false; + } + } + FdStatus::ApplyPending => { + if !verified(core, driver, fd) { + return false; + } + } + FdStatus::ActivationPending => { + return command(fd, |fd| fd.perform_activate()); + } + FdStatus::PhaseFailed { phase, result_code } => { + pw_log::error!( + "ORCH: the device failed phase {} with code {}", + phase as u32, + result_code as u32 + ); + core.dispatch(driver, Event::UpdateRejected); + return false; + } + FdStatus::Idle { .. } => { + pw_log::error!("ORCH: the device went idle mid-update"); + return false; + } + _ => { + pw_log::error!("ORCH: the device reported a status this scenario does not drive"); + return false; + } + } + } + + pw_log::error!("ORCH: the device never finished"); + false +} + +/// Records the job, walks it to authenticated, and answers the offer. +fn offer(core: &mut Core, driver: &mut Driver, fd: &mut Fd, total: u32) -> bool { + if request_update(core, driver, TARGET, u64::from(total)).is_err() { + pw_log::error!("ORCH: refused the update request"); + let _ = fd.reject_offer(RejectReason::PolicyViolation); + let _ = settle(fd); + return false; + } + if core.state() != State::Updating(TARGET) { + pw_log::error!("ORCH: the request did not reach Updating"); + return false; + } + + // Walk the job to authenticated. The device already holds the + // candidate, so staging is a bookkeeping move, but the verifier the + // RoT runs itself still reads the staging region and activation + // refuses a candidate that did not reach it. + for _ in 0..8 { + let poll = driver.pump_update(now_millis()); + match poll.event { + Some(Event::UpdateVerified) => break, + Some(event) => { + pw_log::error!("ORCH: the update pump gave up on the job"); + core.dispatch(driver, event); + return false; + } + None => {} + } + } + + if !ROT_AUTHENTICATED.load(Ordering::Relaxed) { + pw_log::error!("ORCH: the candidate never authenticated"); + return false; + } + + pw_log::info!("ORCH: update accepted, {} bytes", total as u32); + command(fd, |fd| fd.accept_offer(STAGING_BASE)) +} + +/// The device says it verified. The update goes on only if the verifier +/// the RoT runs itself agreed too. +fn verified(core: &mut Core, driver: &mut Driver, fd: &mut Fd) -> bool { + if !ROT_AUTHENTICATED.load(Ordering::Relaxed) { + pw_log::error!("ORCH: the device accepted a candidate the RoT did not"); + core.dispatch(driver, Event::UpdateRejected); + let _ = fd.reject_apply(RejectReason::PolicyViolation); + let _ = settle(fd); + return false; + } + + core.dispatch(driver, Event::UpdateVerified); + if !ACTIVATED.load(Ordering::Relaxed) { + pw_log::error!("ORCH: the verdict did not reach the device"); + return false; + } + pw_log::info!("ORCH: both verdicts agree, activating"); + command(fd, |fd| fd.perform_apply()) +} + +/// Queries the Firmware Device for what it is waiting for. +fn query(fd: &mut Fd) -> Option { + if fd.query_status().is_err() { + pw_log::error!("ORCH: the status request to the device failed"); + return None; + } + match settle(fd) { + Some(Reply::Status(status)) => Some(status), + Some(Reply::Acked) => { + pw_log::error!("ORCH: the device acknowledged QueryStatus instead of answering"); + None + } + None => None, + } +} + +/// Sends one command and waits for the Firmware Device to take it. +fn command(fd: &mut Fd, start: impl FnOnce(&mut Fd) -> Result<(), ClientError>) -> bool { + if start(fd).is_err() { + pw_log::error!("ORCH: could not send a command"); + return false; + } + match settle(fd) { + Some(Reply::Acked) => true, + Some(Reply::Status(_)) => { + pw_log::error!("ORCH: the device answered a command with a status"); + false + } + None => false, + } +} + +/// Waits for the answer to whatever is in flight. The deadline is what +/// turns a Firmware Device that stopped serving into a log line rather +/// than a stall. +fn settle(fd: &mut Fd) -> Option { + let deadline = deadline_in(DEVICE_TIMEOUT_MILLIS); + loop { + match fd.poll() { + Ok(Some(reply)) => return Some(reply), + Ok(None) => {} + Err(_) => { + pw_log::error!("ORCH: the answer from the device did not decode"); + return None; + } + } + if syscall::object_wait(handle::FD, Signals::READABLE, deadline).is_err() { + pw_log::error!("ORCH: the device stopped answering"); + return None; + } + } +} + +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + loop {} +} diff --git a/target/ast10x0/tests/integration/full_update/recovery_preempts/BUILD.bazel b/target/ast10x0/tests/integration/full_update/recovery_preempts/BUILD.bazel new file mode 100644 index 000000000..ba1717abb --- /dev/null +++ b/target/ast10x0/tests/integration/full_update/recovery_preempts/BUILD.bazel @@ -0,0 +1,28 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +# Recovery preempting an update. +# +# Same sources, same system config, one flag. The RoT learns the running +# image is corrupt while the device is still transferring, so the state +# machine leaves Updating for Recovering. The scenario passes when the +# driver drops the staged candidate and reports the update superseded +# rather than delayed, activates nothing, and the platform locks because +# this board wires no recovery source. + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load("//target/ast10x0/tests/integration/full_update:apps.bzl", "APPS", "FLASH", "SYSTEM_CONFIG", "TARGET_DEPS", "TARGET_SRC") + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/full_update/recovery_preempts:recovery_preempts_qemu_test +qemu_scenario( + name = "recovery_preempts_qemu", + apps = APPS, + cfgs = [ + "recovery_preempts", + "rot_owns_verdict", + ], + flash = FLASH, + system_config = SYSTEM_CONFIG, + target_deps = TARGET_DEPS, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/full_update/system.json5 b/target/ast10x0/tests/integration/full_update/system.json5 new file mode 100644 index 000000000..ebc7f8c18 --- /dev/null +++ b/target/ast10x0/tests/integration/full_update/system.json5 @@ -0,0 +1,241 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +// AST10x0 full update QEMU test: boot, update, reboot in one image. +// +// Five processes: +// +// pldm_ua: the Update Agent, the BMC's half of the update +// pldm_fd: the DSP0267 Firmware Device, staging into CS1 flash, +// and the IPC server the RoT commands it through +// mctp_bus: an MCTP server per endpoint, joined by the loopback +// orchestrator: the RoT, which supervises the device and decides +// whether the update may proceed +// mock_downstream_device: the managed device, on a reset line and a ready line +// +// What this scenario claims, and what the others cannot: the device boots +// under supervision, an update arrives over PLDM, the RoT accepts it, the +// device stages and verifies it, the RoT activates it, the device is reset +// into the new image, it reports ready a second time, and only then does +// the floor commit. The ordering is the claim, not the individual steps. +// +// Memory map (AST10x0: 768 KB SRAM, no XIP, so code and data share it): +// 0x00000000 - 0x00000500 vector table (1280 B) +// 0x00000500 - 0x00010000 kernel flash (64256 B) +// 0x00010000 - 0x00060000 app flash (5 x 64 KB) +// 0x00060000 - 0x00080000 kernel RAM (128 KB) +// 0x00080000 - 0x000C0000 app RAM (5 x 32 KB used of a 256 KB region) +// +// Every app starts 64 KB aligned, because the MPU wants power-of-2 +// alignment and apps that merely fit arithmetically overlap each other's +// subregions. Oversizing and misalignment are both quiet: the image still +// builds, and the only sign is a PMSAv7 subregion overlap warning. Check +// for one after changing any size here. +{ + arch: { + type: "armv7m", + vector_table_start_address: 0x00000000, + vector_table_size_bytes: 1280, + }, + kernel: { + flash_start_address: 0x00000500, + flash_size_bytes: 64256, + ram_start_address: 0x00060000, + ram_size_bytes: 131072, + }, + apps: [ + { + name: "mctp_bus", + flash_size_bytes: 65536, + processes: [ + { + name: "mctp_bus_process", + ram_size_bytes: 32768, + objects: [ + { + name: "wg", + type: "wait_group", + }, + { + // The side of the wire the Firmware Device holds. + name: "fd", + type: "channel_handler", + }, + { + // The side the Update Agent uses. + name: "ua", + type: "channel_handler", + }, + { + type: "thread", + name: "mctp_bus_thread", + // Two packet queues live on this stack. At + // QUEUE_DEPTH 32 they overflowed 4 KB and the + // app died before its first log line, with no + // panic and no warning. + kernel_stack_size_bytes: 16384, + }, + ], + }, + ], + }, + { + name: "pldm_fd", + flash_size_bytes: 65536, + processes: [ + { + name: "pldm_fd_process", + ram_size_bytes: 32768, + objects: [ + { + name: "mctp", + type: "channel_initiator", + handler_process: "mctp_bus_process", + handler_object_name: "fd", + }, + { + // The RoT's channel into this device. The device + // answers; it does not command. + name: "orch", + type: "channel_handler", + }, + { + type: "thread", + name: "pldm_fd_thread", + // Staging reads a window back from flash on this + // stack, on top of the PLDM message buffer. + kernel_stack_size_bytes: 8192, + }, + ], + memory_mappings: [ + // The kernel applies the FMC pinmux before any + // process starts, so this one does not map the SCU. + { + // FMC controller registers. + name: "fmc_regs", + type: "device", + start_address: 0x7e620000, + size_bytes: 0x1000, + }, + { + // FMC CS0 memory-mapped flash read window (8 MiB). + // The backend takes both windows even though + // nothing here reads CS0. + name: "fmc_cs0_window", + type: "device", + start_address: 0x80000000, + size_bytes: 0x800000, + }, + { + // FMC CS1 memory-mapped flash read window (64 MiB), + // where the staged image lands. With both chip + // selects present the 256 MiB FMC aperture splits + // in half, which is why CS1 sits at 0x88000000. + name: "fmc_cs1_window", + type: "device", + start_address: 0x88000000, + size_bytes: 0x04000000, + }, + ], + }, + ], + }, + { + name: "orchestrator", + flash_size_bytes: 65536, + processes: [ + { + name: "orchestrator_process", + ram_size_bytes: 32768, + objects: [ + { + name: "wg", + type: "wait_group", + }, + { + // Into the Firmware Device: QueryStatus and the + // Perform and Reject commands. + name: "fd", + type: "channel_initiator", + handler_process: "pldm_fd_process", + handler_object_name: "orch", + }, + { + // The managed device's ready report arrives here. + name: "boot_evt", + type: "channel_handler", + }, + { + // The managed device's reset line. + name: "reset_cmd", + type: "channel_initiator", + handler_process: "mock_downstream_device_process", + handler_object_name: "reset_cmd", + }, + { + type: "thread", + name: "orchestrator_thread", + kernel_stack_size_bytes: 4096, + }, + ], + }, + ], + }, + { + name: "pldm_ua", + flash_size_bytes: 65536, + processes: [ + { + name: "pldm_ua_process", + ram_size_bytes: 32768, + objects: [ + { + name: "mctp", + type: "channel_initiator", + handler_process: "mctp_bus_process", + handler_object_name: "ua", + }, + { + type: "thread", + name: "pldm_ua_thread", + kernel_stack_size_bytes: 4096, + }, + ], + }, + ], + }, + { + name: "mock_downstream_device", + flash_size_bytes: 65536, + processes: [ + { + name: "mock_downstream_device_process", + ram_size_bytes: 32768, + objects: [ + { + name: "wg", + type: "wait_group", + }, + { + // The RoT drives this device's reset line. + name: "reset_cmd", + type: "channel_handler", + }, + { + // This device reports ready through here. + name: "boot_evt", + type: "channel_initiator", + handler_process: "orchestrator_process", + handler_object_name: "boot_evt", + }, + { + type: "thread", + name: "mock_downstream_device_thread", + kernel_stack_size_bytes: 4096, + }, + ], + }, + ], + }, + ], +} diff --git a/target/ast10x0/tests/integration/full_update/target.rs b/target/ast10x0/tests/integration/full_update/target.rs new file mode 100644 index 000000000..475643427 --- /dev/null +++ b/target/ast10x0/tests/integration/full_update/target.rs @@ -0,0 +1,52 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Kernel target for the PLDM update QEMU test. +//! +//! The Firmware Device reports the result with +//! `syscall::debug_shutdown(Ok(()) | Err(..))`, which lands here and writes +//! the UART sentinel qemu_runner.py greps for. + +#![no_std] +#![no_main] + +use ast10x0_peripherals::scu::pinctrl::PINCTRL_FMC_QUAD; +use ast10x0_peripherals::scu::ScuRegisters; +use console_backend::console_backend_write_all; +use entry as _; +use target_common::{declare_target, TargetInterface}; + +pub struct Target {} + +impl TargetInterface for Target { + const NAME: &'static str = "AST10x0 PLDM update test"; + + fn main() -> ! { + // The Firmware Device stages into SPI NOR on CS1, so the pins have + // to be muxed before any process runs. Doing it here keeps SCU + // access out of userspace, where two tasks could race the shared + // pinctrl registers. + // + // SAFETY: kernel main() runs once, single-threaded, with exclusive + // hardware ownership. + let scu = unsafe { ScuRegisters::new_global_unlocked() }; + scu.apply_pinctrl_group(PINCTRL_FMC_QUAD); + + codegen::start(); + #[expect(clippy::empty_loop)] + loop {} + } + + fn shutdown(code: u32) -> ! { + let sentinel: &[u8] = if code == 0 { + b"TEST_RESULT:PASS\n" + } else { + b"TEST_RESULT:FAIL\n" + }; + let _ = console_backend_write_all(sentinel); + #[expect(clippy::empty_loop)] + loop {} + } +} + +declare_target!(Target); diff --git a/target/ast10x0/tests/integration/mock_downstream_device/BUILD.bazel b/target/ast10x0/tests/integration/mock_downstream_device/BUILD.bazel new file mode 100644 index 000000000..8aaaebf93 --- /dev/null +++ b/target/ast10x0/tests/integration/mock_downstream_device/BUILD.bazel @@ -0,0 +1,26 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load(":apps.bzl", "APPS", "SYSTEM_CONFIG", "TARGET_SRC") + +package(default_visibility = ["//target/ast10x0/tests/integration:__subpackages__"]) + +filegroup( + name = "system_config", + srcs = ["system.json5"], +) + +exports_files([ + "target.rs", + "mock_downstream_device_main.rs", + "orchestrator_main.rs", +]) + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/mock_downstream_device:mock_downstream_device_qemu_test +qemu_scenario( + name = "mock_downstream_device_qemu", + apps = APPS, + system_config = SYSTEM_CONFIG, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/mock_downstream_device/apps.bzl b/target/ast10x0/tests/integration/mock_downstream_device/apps.bzl new file mode 100644 index 000000000..f6939a711 --- /dev/null +++ b/target/ast10x0/tests/integration/mock_downstream_device/apps.bzl @@ -0,0 +1,52 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +"""The apps in the boot scenario, shared with its negative case. + +Labels rather than file names, because the negative scenario is a package +of its own and builds the same sources from there. +""" + +HERE = "//target/ast10x0/tests/integration/mock_downstream_device:" + +MOCK_BMC_DEPS = [ + "//hal/blocking", + "//services/test/mock-downstream-device:mock_downstream_device", + "//target/ast10x0/tests/clock", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + "@pigweed//pw_status/rust:pw_status", + "@rust_crates//:embedded-hal", +] + +ORCHESTRATOR_DEPS = [ + "//services/orchestrator/adapters/walk:orchestrator_checkpoint_walk", + "//services/orchestrator/capabilities:orchestrator_capabilities", + "//services/orchestrator/config:orchestrator_config", + "//services/orchestrator/driver:orchestrator_driver", + "//services/orchestrator/sm:orchestrator_sm", + "//services/orchestrator/test:stubs", + "//util/io", + "//target/ast10x0/tests/clock", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + "@pigweed//pw_status/rust:pw_status", +] + +APPS = [ + # The managed device: drives its ready line in response to its reset line. + { + "deps": MOCK_BMC_DEPS, + "name": "mock_downstream_device", + "src": HERE + "mock_downstream_device_main.rs", + }, + # The RoT: releases the device and judges whether it came up. + { + "deps": ORCHESTRATOR_DEPS, + "name": "orchestrator", + "src": HERE + "orchestrator_main.rs", + }, +] + +SYSTEM_CONFIG = HERE + "system_config" +TARGET_SRC = HERE + "target.rs" diff --git a/target/ast10x0/tests/integration/mock_downstream_device/device_hangs/BUILD.bazel b/target/ast10x0/tests/integration/mock_downstream_device/device_hangs/BUILD.bazel new file mode 100644 index 000000000..07ae2e6d4 --- /dev/null +++ b/target/ast10x0/tests/integration/mock_downstream_device/device_hangs/BUILD.bazel @@ -0,0 +1,20 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +# The boot scenario's negative case: the device never reports ready. +# +# Same sources, same system config, one flag. It passes when the walk +# times out, the checkpoint is named and the platform locks, so a green +# here is what says the boot scenario's green means something. + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load("//target/ast10x0/tests/integration/mock_downstream_device:apps.bzl", "APPS", "SYSTEM_CONFIG", "TARGET_SRC") + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/mock_downstream_device/device_hangs:device_hangs_qemu_test +qemu_scenario( + name = "device_hangs_qemu", + apps = APPS, + cfgs = ["device_hangs"], + system_config = SYSTEM_CONFIG, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/mock_downstream_device/measured/BUILD.bazel b/target/ast10x0/tests/integration/mock_downstream_device/measured/BUILD.bazel new file mode 100644 index 000000000..bdf363ad2 --- /dev/null +++ b/target/ast10x0/tests/integration/mock_downstream_device/measured/BUILD.bazel @@ -0,0 +1,22 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +# The boot scenario with a verifier that measures. +# +# Same sources, same system config, one flag. The verdict carries a digest, +# which the driver reports as Report::Measured, and the run passes when the +# sink was handed exactly one, for the managed device. Every other scenario +# wires a verifier that measures nothing, so this is the only place that +# path runs. + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load("//target/ast10x0/tests/integration/mock_downstream_device:apps.bzl", "APPS", "SYSTEM_CONFIG", "TARGET_SRC") + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/mock_downstream_device/measured:measured_qemu_test +qemu_scenario( + name = "measured_qemu", + apps = APPS, + cfgs = ["measured"], + system_config = SYSTEM_CONFIG, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/mock_downstream_device/mock_downstream_device_main.rs b/target/ast10x0/tests/integration/mock_downstream_device/mock_downstream_device_main.rs new file mode 100644 index 000000000..e77a4b6bc --- /dev/null +++ b/target/ast10x0/tests/integration/mock_downstream_device/mock_downstream_device_main.rs @@ -0,0 +1,147 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The managed device: reacts to its reset line, reports when it is ready. +//! +//! Stands in for the chip on the other end of two board traces. The reset +//! line arrives as a request on the `reset_cmd` channel and the ready line +//! leaves as a request on `boot_evt`, because QEMU models one chip and both +//! ends of those traces live inside it. +//! +//! The behaviour itself is `openprot_mock_downstream_device::MockDownstreamDevice`, which is pin-generic +//! and host-tested. Here the pins are two cells: the reset cell is written by +//! the channel handler, and the ready cell is read after each poll to decide +//! whether the orchestrator needs telling. + +#![no_main] +#![no_std] + +use core::cell::Cell; + +use board_clock::{millis_to_ticks, now_millis}; +use embedded_hal::digital::{ErrorType, InputPin, OutputPin}; +use openprot_hal_blocking::gpio_port::ActivePolarity; +use openprot_mock_downstream_device::{BootBehaviour, MockDownstreamDevice}; +use userspace::syscall::Signals; +use userspace::time::{Clock, Instant, SystemClock}; +use userspace::{entry, syscall}; + +use app_mock_downstream_device::handle; + +/// How long this device takes to boot once reset is released. Well inside +/// any window the orchestrator waits, so the happy path is the happy path. +#[cfg(not(device_hangs))] +const BOOT_MILLIS: u64 = 50; + +/// What the device does when released. The scenario picks it at build +/// time, so the negative case is a target of its own rather than an edit +/// somebody has to remember to undo. +#[cfg(not(device_hangs))] +const BEHAVIOUR: BootBehaviour = BootBehaviour::Boots { + after_millis: BOOT_MILLIS, +}; +#[cfg(device_hangs)] +const BEHAVIOUR: BootBehaviour = BootBehaviour::Hangs; + +/// How often the model is polled while it is booting. The delay is measured +/// from release rather than counted in polls, so this only bounds how late +/// the ready report can be, never whether it happens. +const POLL_MILLIS: u64 = 10; + +/// Reset is asserted low, the RoT_BMC_RESET_L convention. +const RESET_ASSERTED: u8 = 0; + +/// One line, shared between the model and the code that drives or watches +/// it. Single-threaded, so a `Cell` is enough. +#[derive(Clone, Copy)] +struct Line<'a>(&'a Cell); + +impl ErrorType for Line<'_> { + type Error = core::convert::Infallible; +} + +impl InputPin for Line<'_> { + fn is_high(&mut self) -> Result { + Ok(self.0.get()) + } + + fn is_low(&mut self) -> Result { + Ok(!self.0.get()) + } +} + +impl OutputPin for Line<'_> { + fn set_high(&mut self) -> Result<(), Self::Error> { + self.0.set(true); + Ok(()) + } + + fn set_low(&mut self) -> Result<(), Self::Error> { + self.0.set(false); + Ok(()) + } +} + +#[entry] +fn entry() { + // Reset starts asserted (low) and ready starts inactive, which is where + // a device sits before the RoT lets it go. + let reset = Cell::new(false); + let ready = Cell::new(false); + + let mut device = MockDownstreamDevice::new( + Line(&reset), + ActivePolarity::ActiveLow, + Line(&ready), + ActivePolarity::ActiveHigh, + BEHAVIOUR, + ); + + if syscall::wait_group_add(handle::WG, handle::RESET_CMD, Signals::READABLE, 0usize).is_err() { + loop {} + } + + let mut reported = false; + let mut cmd = [0u8; 1]; + + loop { + // Wake on a reset command or on the poll interval, whichever comes + // first. Nothing here blocks on the orchestrator. + let deadline = + Instant::from_ticks(SystemClock::now().ticks() + millis_to_ticks(POLL_MILLIS)); + let _ = syscall::object_wait(handle::WG, Signals::READABLE, deadline); + + if let Ok(len) = syscall::channel_read(handle::RESET_CMD, 0usize, &mut cmd) { + if len == 1usize { + let asserted = cmd[0] == RESET_ASSERTED; + // Active low: asserted means the line is driven low. + reset.set(!asserted); + // A reset clears the flag so the next boot reports again, + // except where the scenario asks for a device that comes + // up once and never again. + if asserted && !cfg!(device_stays_down) { + reported = false; + } + } + let _ = syscall::channel_respond(handle::RESET_CMD, &[0u8; 0]); + } + + if device.poll(now_millis()).is_err() { + let _ = syscall::debug_shutdown(Err(pw_status::Error::Internal)); + } + + // The ready line going active is the whole message. Report it once + // per boot; a reset clears the flag so the next boot reports again. + if ready.get() && !reported { + let mut ack = [0u8; 1]; + if syscall::channel_transact(handle::BOOT_EVT, &[1u8], &mut ack, Instant::MAX).is_ok() { + reported = true; + } + } + } +} + +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + loop {} +} diff --git a/target/ast10x0/tests/integration/mock_downstream_device/orchestrator_main.rs b/target/ast10x0/tests/integration/mock_downstream_device/orchestrator_main.rs new file mode 100644 index 000000000..b3bb2a7af --- /dev/null +++ b/target/ast10x0/tests/integration/mock_downstream_device/orchestrator_main.rs @@ -0,0 +1,1127 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The RoT side of the mock-downstream-device integration test, running the shipped +//! orchestrator rather than a hand-rolled sequence. +//! +//! `bring_up` builds the state machine and the platform driver from one +//! device table, so the chain the SM decides over and the arrays the driver +//! indexes cannot disagree. What this file supplies is the board: a reset +//! line that reaches the mock downstream device over IPC, a `CheckpointWalk` over a +//! latched evidence reader, and stubs for the capabilities a boot scenario +//! never touches. +//! +//! Scenario: power on, verify, release the device from reset, and wait for +//! it to report ready inside its checkpoint window. The run passes when the +//! machine reaches `Ready`. +//! +//! Evidence arrives as a request on `boot_evt` and is latched in a static. +//! The orchestrator never asks the device whether it is up, because +//! `EvidenceReader::read` is synchronous and may not block; reading a latch +//! is the only shape that satisfies that. The reset path clears the latch, +//! never the reader, so evidence from a previous attempt cannot satisfy the +//! next one. + +#![no_main] +#![no_std] + +use core::convert::Infallible; +use core::sync::atomic::{AtomicBool, AtomicU32, AtomicU8, Ordering}; + +use board_stubs::{BoardFault, StubImage}; +// The shared stub authenticates everything and measures nothing. The +// `measured` and recovery cfgs wire a verifier of their own. +#[cfg(not(any(measured, recovery, recovery_exhausted)))] +use board_stubs::StubVerifier; +use openprot_orchestrator_driver::{ + bring_up, settle_self_update_at_boot, Board, BoardCapabilities, ComponentWiring, ErotUpdate, + Report, ReportSink, SelfUpdateSettlement, SvnFloorBinding, +}; +#[cfg(any(measured, recovery, recovery_exhausted))] +use openprot_orchestrator_driver::{ImageSource, Verdict, Verifier}; +// Only the self-update build submits a job of its own; every other +// scenario here is a boot. +#[cfg(self_update)] +use openprot_orchestrator_driver::request_update; +#[cfg(any(measured, recovery, recovery_exhausted, self_update))] +use openprot_orchestrator_sm::ComponentId; +use openprot_orchestrator_sm::{ComponentAttrs, Event, PowerOnResult, State}; +#[cfg(any(measured, recovery, recovery_exhausted, self_update))] +use orchestrator_capabilities::AuthenticatedImage; +#[cfg(measured)] +use orchestrator_capabilities::Measurement; +use orchestrator_capabilities::{ + BootControl, BootStatus, EvidenceReader, IncrementalVerifier, PollOutcome, RunningImage, + SelfUpdate, SelfUpdateState, StageProgress, Svn, SvnFloor, Updatable, UpdateError, + VerifySession, +}; +#[cfg(self_update)] +use orchestrator_capabilities::{Progress, SelfReset}; +// Only the recovery cfgs wire a restore source. +#[cfg(any(recovery, recovery_exhausted))] +use orchestrator_capabilities::{Recovery, RestoreOutcome}; +use orchestrator_checkpoint_walk::CheckpointWalk; +use orchestrator_config::{ + assert_retry_reaches_every_image, chain_of, BootCheckpoint, ChainEntries, DeviceConfig, +}; +use util_io::{ByteReadError, ByteSource}; + +use board_clock::{deadline_in, millis_to_ticks, now_millis}; +use userspace::syscall::Signals; +use userspace::time::{Clock, Instant, SystemClock}; +use userspace::{entry, syscall}; + +use app_orchestrator::handle; + +/// Chain capacity and the core's effect-sink cap (`E >= 2*N + 2`). `N` +/// counts the device table below, so the two cannot disagree. +const N: usize = DEVICES.len(); +const E: usize = 2 * N + 2; +const MAX_RETRY: u8 = 3; + +/// How long the device has to report ready. It boots in 50 ms, so this is +/// slack rather than a race. +const BOOT_WINDOW_MILLIS: u64 = 2_000; + +/// How long the whole run may take before the test gives up. Larger than the +/// boot window so a walk timeout is reported by the orchestrator rather than +/// cut short here. +const RUN_BUDGET_MILLIS: u64 = 10_000; + +/// Whether this build passes on a platform lock: the device never reports +/// (`device_hangs`), or its image is refused with no source left +/// (`recovery_exhausted`). Inverting the verdict here, rather than letting +/// the target fail, keeps a build error and a caught failure from looking +/// the same to the runner. +const EXPECT_LOCKDOWN: bool = cfg!(device_hangs) || cfg!(recovery_exhausted); + +/// Whether this build starts with an image the RoT refuses. `recovery` +/// restores a good image and boots. `recovery_exhausted` restores an image +/// the verifier still refuses, then runs out of sources. +const EXPECT_RECOVERY: bool = cfg!(recovery) || cfg!(recovery_exhausted); + +/// Whether the expected lockdown happens inside the `PowerGood` dispatch. +/// The verification, both restore calls and the gating are follow-ups of +/// `PowerGood`, so the state machine is already `Locked` when that +/// dispatch returns. +const LOCKS_AT_POWER_ON: bool = cfg!(recovery_exhausted); + +/// How many times the run expects `restore` to be called. `recovery` +/// needs one. `recovery_exhausted` needs two: the first writes an image +/// the verifier still refuses, the second answers `SourceExhausted`. +const EXPECT_RESTORE_CALLS: u8 = if cfg!(recovery_exhausted) { + 2 +} else if cfg!(recovery) { + 1 +} else { + 0 +}; + +/// Whether this build boots the trial image of the eRoT's own update. +/// +/// The variant scenario starts the session at `TrialPending` and runs the +/// same boot. What it adds is the claim that bringing the chain up confirms +/// the session, so the Update Agent can advance the SVN floor afterwards. +#[cfg(not(self_trial))] +const EXPECT_SELF_TRIAL: bool = false; +#[cfg(self_trial)] +const EXPECT_SELF_TRIAL: bool = true; + +/// The SVN the trial image carries, as the session recorded it before the +/// eRoT reset into it. +const TRIAL_SVN: Svn = Svn(7); + +/// The SVN the candidate carries. Above the floor, which starts at zero, +/// and apart from `TRIAL_SVN` so the two self scenarios cannot be confused +/// for one another in a log. +#[cfg(self_update)] +const CANDIDATE_SVN: Svn = Svn(9); + +/// The candidate's bytes. A real one arrives over PLDM, but nothing serves +/// the eRoT's own update yet, so this scenario is its own update source. +#[cfg(self_update)] +const CANDIDATE: [u8; 256] = [0xa5; 256]; + +/// How much of the candidate one `poll_stage` takes. Several steps, so the +/// pump is driven the way a real transfer drives it rather than completing +/// in one call. +#[cfg(self_update)] +const STAGE_CHUNK: usize = 64; + +/// What settling the eRoT's own session has to answer in this build. A +/// self-trial build is mid-trial; any other boot has nothing in flight. +const EXPECT_SETTLEMENT: SelfUpdateSettlement = if EXPECT_SELF_TRIAL { + SelfUpdateSettlement::TrialRunning { svn: TRIAL_SVN } +} else { + SelfUpdateSettlement::Settled +}; + +/// Reset command bytes, read by the device as its reset line. +const RESET_ASSERT: u8 = 0; +const RESET_RELEASE: u8 = 1; + +/// The device table. One checkpoint: the device either reports ready inside +/// the window or it does not. Probe 1 is what the evidence reader answers +/// `Booted` for once the latch is set. +/// Chain position 0 is the eRoT itself. It is never released, walked or +/// recovered. It is in the table so the orchestrator can address it, not so +/// it can supervise it. A boot scenario never updates the eRoT either, so +/// the entry carries no layout. +static DEVICES: [DeviceConfig; 2] = [ + DeviceConfig::erot("erot", None), + DeviceConfig::new( + "downstream", + 0, + &[BootCheckpoint::new( + "ready", + 1, + core::time::Duration::from_millis(BOOT_WINDOW_MILLIS), + )], + // A boot walk never looks at images, so no layout is legal here. + None, + ComponentAttrs::passive_required(), + ), +]; + +static CHAIN: ChainEntries = chain_of(&DEVICES); + +const _: () = assert_retry_reaches_every_image(MAX_RETRY, &DEVICES); + +/// The device's ready line, as the RoT sees it. +/// +/// Set when the mock downstream device reports in, cleared by the reset path. A static +/// because the reader lives inside the walk, inside the board, inside the +/// driver, while the run loop that receives the report is outside all three. +static DEVICE_READY: AtomicBool = AtomicBool::new(false); + +/// Drives the device's reset line. An undeliverable command is a wiring +/// failure, not a boot failure, and surfaces as an effect error. +fn drive_reset(level: u8) -> Result<(), BoardFault> { + let mut ack = [0u8; 1]; + syscall::channel_transact(handle::RESET_CMD, &[level], &mut ack, deadline_in(1_000)) + .map(|_| ()) + .map_err(|_| BoardFault) +} + +/// The device's reset line. Both directions clear the ready latch: the +/// device is restarting either way, so anything it reported before this +/// belongs to a previous attempt. +struct BmcReset; + +impl BootControl for BmcReset { + type Error = BoardFault; + + fn hold_in_reset(&mut self) -> Result<(), BoardFault> { + DEVICE_READY.store(false, Ordering::Relaxed); + drive_reset(RESET_ASSERT) + } + + fn release(&mut self) -> Result<(), BoardFault> { + DEVICE_READY.store(false, Ordering::Relaxed); + drive_reset(RESET_RELEASE) + } +} + +/// Reads the ready latch. Probe 1 is the only checkpoint, so any probe the +/// walk asks about is answered from the same latch. +struct BmcEvidence; + +impl EvidenceReader for BmcEvidence { + type Error = Infallible; + + fn read(&mut self, _probe: &u8) -> Result { + Ok(if DEVICE_READY.load(Ordering::Relaxed) { + BootStatus::Booted + } else { + BootStatus::Booting + }) + } +} + +/// Whether the RoT accepts the device's image. Starts false; a restore +/// that writes a good image flips it. +#[cfg(any(recovery, recovery_exhausted))] +static IMAGE_GOOD: AtomicBool = AtomicBool::new(false); + +/// Replaces the shared stub, which authenticates whatever it is given. +/// Reads `IMAGE_GOOD`, so the restore is what makes the image pass. The +/// walk skips the eRoT, so only the managed device is verified. +#[cfg(any(recovery, recovery_exhausted))] +struct LatchedVerifier; + +#[cfg(any(recovery, recovery_exhausted))] +impl Verifier for LatchedVerifier { + type Error = BoardFault; + + fn verify( + &mut self, + _id: ComponentId, + _image: &mut impl ImageSource, + ) -> Result { + if !IMAGE_GOOD.load(Ordering::Relaxed) { + return Ok(Verdict::Rejected); + } + Ok(Verdict::Authenticated(AuthenticatedImage { + // Like the shared stub: no manifest for an SVN, no engine to + // measure with. + svn: None, + measurement: None, + })) + } +} + +/// The verifier this scenario wires: the shared stub, unless the build +/// needs a verifier that refuses (the recovery cfgs) or one that measures +/// (`measured`). +#[cfg(not(any(measured, recovery, recovery_exhausted)))] +type ScenarioVerifier = StubVerifier; +#[cfg(any(recovery, recovery_exhausted))] +type ScenarioVerifier = LatchedVerifier; +#[cfg(measured)] +type ScenarioVerifier = MeasuringVerifier; + +/// The `ScenarioVerifier` the board is built with. +#[cfg(not(any(measured, recovery, recovery_exhausted)))] +const SCENARIO_VERIFIER: ScenarioVerifier = StubVerifier; +#[cfg(any(recovery, recovery_exhausted))] +const SCENARIO_VERIFIER: ScenarioVerifier = LatchedVerifier; +#[cfg(measured)] +const SCENARIO_VERIFIER: ScenarioVerifier = MeasuringVerifier; + +/// How many times `restore` has been called. The call that answers +/// `SourceExhausted` writes nothing and still counts. +static RESTORE_CALLS: AtomicU8 = AtomicU8::new(0); + +/// Only the recovery cfgs wire a restore source. The rest keep `()`, +/// which answers `SourceExhausted` at once, so `device_hangs` still locks +/// instead of restoring. +#[cfg(not(any(recovery, recovery_exhausted)))] +type DeviceRecovery = (); +#[cfg(any(recovery, recovery_exhausted))] +type DeviceRecovery = RecoverySource; + +/// The `DeviceRecovery` each component is built with. +#[cfg(not(any(recovery, recovery_exhausted)))] +const DEVICE_RECOVERY: DeviceRecovery = (); +#[cfg(any(recovery, recovery_exhausted))] +const DEVICE_RECOVERY: DeviceRecovery = RecoverySource; + +/// The device's one recovery source: it writes an image over the active +/// image, and a second attempt answers `SourceExhausted`. The re-walk judges +/// the image this writes, so the `recovery_exhausted` cfg writes an image +/// the verifier refuses. +#[cfg(any(recovery, recovery_exhausted))] +struct RecoverySource; + +#[cfg(any(recovery, recovery_exhausted))] +impl Recovery for RecoverySource { + type Error = BoardFault; + + fn restore(&mut self, attempt: u8) -> Result { + RESTORE_CALLS.fetch_add(1, Ordering::Relaxed); + if attempt > 0 { + pw_log::info!("no source left to restore the device from"); + return Ok(RestoreOutcome::SourceExhausted); + } + pw_log::info!("restoring the device's image from its recovery source"); + IMAGE_GOOD.store(cfg!(recovery), Ordering::Relaxed); + Ok(RestoreOutcome::Restored) + } +} + +/// The managed device keeps its own floor, so the eRoT holds none for it. +/// The eRoT's own floor is a different thing and is held here, in RAM: this +/// scenario never resets the eRoT, so nothing has to survive a reset. +struct ErotFloor; + +/// The eRoT's own anti-rollback floor. Starts at zero, which is below +/// `TRIAL_SVN`, so a confirmed trial still has the advance ahead of it. +static EROT_FLOOR: AtomicU32 = AtomicU32::new(0); + +impl SvnFloor for ErotFloor { + type Error = BoardFault; + + fn floor(&self) -> Result { + Ok(Svn(EROT_FLOOR.load(Ordering::Relaxed))) + } + + fn advance(&mut self, to: Svn) -> Result<(), BoardFault> { + EROT_FLOOR.fetch_max(to.0, Ordering::Relaxed); + Ok(()) + } +} + +/// The eRoT's own update session. +/// +/// A real one lives in flash and survives the reset that decides the trial. +/// This one is two atomics, because the scenario never resets the eRoT: the +/// session is set up as the boot that follows an activation would find it, +/// and the claim is what the boot does about it. +/// +/// The state lives in statics rather than in the struct so the run can read +/// it back. The driver takes the board at `bring_up` and hands out no +/// reference to it. +struct SelfSession; + +/// The session's state, as `STATE_*` below. +static SESSION_STATE: AtomicU8 = AtomicU8::new(0); +/// The SVN the session recorded, read only when the state carries one. +static SESSION_SVN: AtomicU32 = AtomicU32::new(0); + +const STATE_IDLE: u8 = 0; +const STATE_PREPARED: u8 = 1; +const STATE_TRIAL_PENDING: u8 = 2; +const STATE_COMMITTED: u8 = 3; + +impl SelfSession { + /// Sets the session up as the boot after an activation would find it. + /// An ordinary boot leaves it `Idle`. + fn install() { + if EXPECT_SELF_TRIAL { + SESSION_SVN.store(TRIAL_SVN.0, Ordering::Relaxed); + SESSION_STATE.store(STATE_TRIAL_PENDING, Ordering::Relaxed); + } + } + + fn read() -> SelfUpdateState { + let svn = Svn(SESSION_SVN.load(Ordering::Relaxed)); + match SESSION_STATE.load(Ordering::Relaxed) { + STATE_IDLE => SelfUpdateState::Idle, + STATE_PREPARED => SelfUpdateState::Prepared { svn }, + STATE_TRIAL_PENDING => SelfUpdateState::TrialPending { svn }, + STATE_COMMITTED => SelfUpdateState::Committed { svn }, + // Nothing outside this file writes SESSION_STATE. Reading an + // unknown value back as `Idle` would make the write bug look + // like a boot with no self-update in flight. + _ => unreachable!("the session holds a state nothing wrote"), + } + } +} + +impl SelfUpdate for SelfSession { + type Error = BoardFault; + + fn state(&self) -> Result { + Ok(Self::read()) + } + + fn running(&self) -> Result { + // Which image this boot runs is the boot selector's answer, not the + // session's. Here it is the scenario's: a self-trial build is the + // boot that runs the trial image. + Ok(if EXPECT_SELF_TRIAL { + RunningImage::Trial + } else { + RunningImage::Confirmed + }) + } + + fn prepare(&mut self, svn: Svn) -> Result<(), BoardFault> { + SESSION_SVN.store(svn.0, Ordering::Relaxed); + SESSION_STATE.store(STATE_PREPARED, Ordering::Relaxed); + Ok(()) + } + + fn set_trial_pending(&mut self) -> Result<(), BoardFault> { + match Self::read() { + // Marking a pending trial again is a retry, not a fault. + SelfUpdateState::Prepared { .. } | SelfUpdateState::TrialPending { .. } => { + SESSION_STATE.store(STATE_TRIAL_PENDING, Ordering::Relaxed); + Ok(()) + } + _ => Err(BoardFault), + } + } + + fn confirm(&mut self) -> Result<(), BoardFault> { + match Self::read() { + // Confirming a confirmed session is the same retry. + SelfUpdateState::TrialPending { .. } | SelfUpdateState::Committed { .. } => { + SESSION_STATE.store(STATE_COMMITTED, Ordering::Relaxed); + Ok(()) + } + _ => Err(BoardFault), + } + } + + fn complete(&mut self) -> Result<(), BoardFault> { + match Self::read() { + // Only a committed session closes, and closing a closed one is + // a retry. A session still being judged is dropped with + // `revert`, so completing it here would discard a pending + // trial. + SelfUpdateState::Committed { .. } | SelfUpdateState::Idle => { + SESSION_STATE.store(STATE_IDLE, Ordering::Relaxed); + Ok(()) + } + _ => Err(BoardFault), + } + } + + fn revert(&mut self) -> Result<(), BoardFault> { + SESSION_STATE.store(STATE_IDLE, Ordering::Relaxed); + Ok(()) + } +} + +/// No update path in a boot scenario. Every step errors, which is what the +/// board contract asks of a device that cannot be updated. +#[cfg(not(self_update))] +struct NoUpdate; + +#[cfg(not(self_update))] +impl Updatable for NoUpdate { + fn poll_stage(&mut self, _payload: &dyn ByteSource) -> Result { + Err(UpdateError::Device) + } + + fn abandon(&mut self) {} + + fn activate(&mut self) -> Result<(), UpdateError> { + Err(UpdateError::Device) + } +} + +/// No update is verified in a boot scenario, so being polled at all is a +/// wiring mistake rather than a verdict. It reports a fault, which the pump +/// turns into a rejection, instead of accepting an image nothing checked. +#[cfg(not(self_update))] +struct NeverVerifier; + +#[cfg(not(self_update))] +struct NeverSession; + +#[cfg(not(self_update))] +impl IncrementalVerifier for NeverVerifier { + type Error = BoardFault; + type Session = NeverSession; + + fn start(self) -> NeverSession { + NeverSession + } +} + +#[cfg(not(self_update))] +impl VerifySession for NeverSession { + type Verifier = NeverVerifier; + type Error = BoardFault; + + fn poll(self, _payload: &dyn ByteSource) -> PollOutcome { + PollOutcome::Fault(NeverVerifier, BoardFault) + } + + fn abandon(self) -> NeverVerifier { + NeverVerifier + } +} + +/// The eRoT's own slot, as the pump writes into it. +/// +/// The slot writes nothing to flash: QEMU models one chip, so the image the +/// eRoT would boot is the one running. What the scenario needs from this +/// seam is that the pump ran to the end, so it counts the bytes it was +/// handed and reports `Ready` on the last one. +#[cfg(self_update)] +struct SelfSlot { + written: u64, +} + +/// Bytes the slot was handed, read at the end of the run. The slot itself +/// is inside the board, which the driver takes and hands no reference to. +/// A `u32` because this target has no 64-bit atomics, and +/// `CANDIDATE.len()` fits one. +#[cfg(self_update)] +static STAGED: AtomicU32 = AtomicU32::new(0); + +#[cfg(self_update)] +impl Updatable for SelfSlot { + fn poll_stage(&mut self, payload: &dyn ByteSource) -> Result { + let total = payload.len(); + if total == 0 { + return Err(UpdateError::EmptyPayload); + } + let take = (total - self.written).min(STAGE_CHUNK as u64); + let mut window = [0u8; STAGE_CHUNK]; + let window = &mut window[..take as usize]; + payload + .read_at(self.written, window) + .map_err(|_| UpdateError::Device)?; + self.written += take; + STAGED.store(self.written as u32, Ordering::Relaxed); + if self.written == total { + return Ok(StageProgress::Ready); + } + Ok(StageProgress::Transferring { + progress: Progress { + written: self.written, + total, + }, + }) + } + + fn abandon(&mut self) { + self.written = 0; + STAGED.store(0, Ordering::Relaxed); + } + + /// Never called on this path: the eRoT's activation records a session + /// and resets rather than commanding a device to run what it staged. + fn activate(&mut self) -> Result<(), UpdateError> { + Err(UpdateError::Device) + } +} + +/// Authenticates the staged candidate and reports the SVN it carries, +/// which is what the activation records on the session. +/// +/// One pass, no chunking: the signature check is stubbed everywhere in +/// these scenarios, and what this seam has to supply here is a verdict +/// with an SVN in it. +#[cfg(self_update)] +struct SvnVerifier; + +#[cfg(self_update)] +struct SvnSession; + +#[cfg(self_update)] +impl IncrementalVerifier for SvnVerifier { + type Error = BoardFault; + type Session = SvnSession; + + fn start(self) -> SvnSession { + SvnSession + } +} + +#[cfg(self_update)] +impl VerifySession for SvnSession { + type Verifier = SvnVerifier; + type Error = BoardFault; + + fn poll(self, _payload: &dyn ByteSource) -> PollOutcome { + PollOutcome::Authenticated { + verifier: SvnVerifier, + image: AuthenticatedImage { + svn: Some(CANDIDATE_SVN), + measurement: None, + }, + } + } + + fn abandon(self) -> SvnVerifier { + SvnVerifier + } +} + +/// The eRoT's reset, which is where this scenario's run ends. +/// +/// Nothing on this target reboots the eRoT, and the driver does not come +/// back from here, so the claim is judged in place: the session has to +/// read `TrialPending` at the candidate's SVN, which is what the boot +/// after the reset would find. `self_trial` starts from exactly that +/// session and carries on from there. +#[cfg(self_update)] +struct EndOfRun; + +#[cfg(self_update)] +impl SelfReset for EndOfRun { + type Error = BoardFault; + + fn reset(&mut self) -> Result { + let staged = STAGED.load(Ordering::Relaxed); + if staged != CANDIDATE.len() as u32 { + // Checked first: a session marked pending for an image the + // pump never finished writing is worse than an incomplete + // staging alone. + pw_log::error!( + "the eRoT would reset into {} bytes of a {} byte candidate", + staged as u32, + CANDIDATE.len() as u32 + ); + let _ = syscall::debug_shutdown(Err(pw_status::Error::Internal)); + } else if SelfSession::read() == (SelfUpdateState::TrialPending { svn: CANDIDATE_SVN }) { + pw_log::info!("the candidate is staged and the eRoT would reset into it now"); + let _ = syscall::debug_shutdown(Ok(())); + } else { + pw_log::error!("the activation requested a reset with no trial pending"); + let _ = syscall::debug_shutdown(Err(pw_status::Error::Internal)); + } + #[expect(clippy::empty_loop)] + loop {} + } +} + +/// The candidate the pump pulls from. +#[cfg(self_update)] +struct CandidateBytes; + +#[cfg(self_update)] +impl ByteSource for CandidateBytes { + fn len(&self) -> u64 { + CANDIDATE.len() as u64 + } + + fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<(), ByteReadError> { + let start = usize::try_from(offset).map_err(|_| ByteReadError::OutOfRange)?; + let end = start + .checked_add(buf.len()) + .ok_or(ByteReadError::OutOfRange)?; + buf.copy_from_slice(CANDIDATE.get(start..end).ok_or(ByteReadError::OutOfRange)?); + Ok(()) + } +} + +/// No staging region, because nothing stages here. +#[cfg(not(self_update))] +struct NoStaging; + +#[cfg(not(self_update))] +impl ByteSource for NoStaging { + fn len(&self) -> u64 { + 0 + } + + fn read_at(&self, _offset: u64, _buf: &mut [u8]) -> Result<(), ByteReadError> { + Err(ByteReadError::OutOfRange) + } +} + +/// The digest the measuring build reports. A real one is a hash of the +/// image; this is a constant, because what the scenario claims is that a +/// measurement the verifier reported reaches the report sink, not that +/// anything hashed correctly. +#[cfg(measured)] +const DIGEST: Measurement = Measurement([0x5a; Measurement::LEN]); + +/// Reports a constant digest in its verdict. +/// +/// The shared stub authenticates and reports no digest, which is every +/// other scenario here, so the measurement path has never run: +/// `Report::Measured` is emitted only for a verdict carrying +/// `Some(measurement)`. The walk passes over the eRoT, so the only +/// component this is asked about is the managed device. +#[cfg(measured)] +struct MeasuringVerifier; + +#[cfg(measured)] +impl Verifier for MeasuringVerifier { + type Error = BoardFault; + + fn verify( + &mut self, + _id: ComponentId, + _image: &mut impl ImageSource, + ) -> Result { + Ok(Verdict::Authenticated(AuthenticatedImage { + // Still nothing read: this build changes what the verifier + // measures, not what it parses. + svn: None, + measurement: Some(DIGEST), + })) + } +} + +/// What the sink was handed about the managed device's image: how many +/// measurements, and the last digest. A static because the sink lives +/// inside the board, inside the driver, while the run that judges it is +/// outside all three. +/// +/// `Relaxed` on every access: the app is one thread, and the sink writes +/// these from the same run loop that reads them back, so there is no +/// second thread to order against. +static MEASUREMENTS: AtomicU32 = AtomicU32::new(0); +static MEASURED_ID: AtomicU8 = AtomicU8::new(u8::MAX); + +/// The managed device's chain position. `chain_of` rejects a table that +/// does not start with the eRoT, and `CHAIN` runs it at compile time, so +/// position 1 is the first walked device whatever `DEVICES` holds. +const MANAGED_DEVICE: u8 = 1; + +/// Reports go to the console. The test reads them the way an operator +/// would, and a scenario that ends badly says why in its own output. +struct LogSink; + +impl ReportSink for LogSink { + fn report(&mut self, report: Report) { + match report { + Report::Isolated(id) => pw_log::info!("report: component {} isolated", id.get() as u32), + Report::RecoveryFailed(id) => { + pw_log::info!( + "report: component {} out of recovery sources", + id.get() as u32 + ) + } + Report::Measured { id, .. } => { + MEASUREMENTS.fetch_add(1, Ordering::Relaxed); + MEASURED_ID.store(id.get(), Ordering::Relaxed); + pw_log::info!("report: component {} measured", id.get() as u32) + } + Report::BootFailed { id, checkpoint, .. } => pw_log::info!( + "report: component {} failed at {}", + id.get() as u32, + checkpoint as &str + ), + _ => pw_log::info!("report: unrecognised"), + } + } +} + +// The update wiring, named once per build so the `Board` carries no cfg. +// The self-update build wires the real pieces; every other build wires +// the stubs a boot scenario needs, which fault when polled so a wiring +// mistake cannot look like a verdict. `scenario_updatable` is a function +// rather than a constant because the self-update build's slot counts +// what it was handed. The reset differs the same way: an activation of +// the eRoT's own image supplies a reset of its own, and the `()` impl +// reports that it cannot drive one. + +#[cfg(self_update)] +type ScenarioUpdatable = SelfSlot; +#[cfg(self_update)] +type ScenarioStaging = CandidateBytes; +#[cfg(self_update)] +type ScenarioUpdateVerifier = SvnVerifier; +#[cfg(self_update)] +type ScenarioSelfReset = EndOfRun; +#[cfg(self_update)] +fn scenario_updatable() -> ScenarioUpdatable { + SelfSlot { written: 0 } +} +#[cfg(self_update)] +const SCENARIO_STAGING: ScenarioStaging = CandidateBytes; +#[cfg(self_update)] +const SCENARIO_UPDATE_VERIFIER: ScenarioUpdateVerifier = SvnVerifier; +#[cfg(self_update)] +const SCENARIO_SELF_RESET: ScenarioSelfReset = EndOfRun; + +#[cfg(not(self_update))] +type ScenarioUpdatable = NoUpdate; +#[cfg(not(self_update))] +type ScenarioStaging = NoStaging; +#[cfg(not(self_update))] +type ScenarioUpdateVerifier = NeverVerifier; +#[cfg(not(self_update))] +type ScenarioSelfReset = (); +#[cfg(not(self_update))] +fn scenario_updatable() -> ScenarioUpdatable { + NoUpdate +} +#[cfg(not(self_update))] +const SCENARIO_STAGING: ScenarioStaging = NoStaging; +#[cfg(not(self_update))] +const SCENARIO_UPDATE_VERIFIER: ScenarioUpdateVerifier = NeverVerifier; +#[cfg(not(self_update))] +const SCENARIO_SELF_RESET: ScenarioSelfReset = (); + +struct MockDownstreamDeviceBoard; + +impl BoardCapabilities for MockDownstreamDeviceBoard { + type Image = StubImage; + type Verifier = ScenarioVerifier; + type BootControl = BmcReset; + type BootWatch = CheckpointWalk; + type SvnFloor = ErotFloor; + type ReportSink = LogSink; + type Updatable = ScenarioUpdatable; + type Recovery = DeviceRecovery; + type DeviceTrial = (); + type Staging = ScenarioStaging; + type UpdateVerifier = ScenarioUpdateVerifier; + type SelfUpdate = SelfSession; + type SelfReset = ScenarioSelfReset; + type ResetSignal = u8; + type Probe = u8; +} + +fn board() -> Board { + Board { + // Built from the table index, so a component's parts cannot end + // up wired to a different slot than the one they sit in. + // + // Index 0 is the eRoT. The walk passes over it, so nothing reads + // or actuates that entry. Components are indexed by ComponentId, + // so index 0 still needs a value. + components: core::array::from_fn(|i| ComponentWiring { + device: &DEVICES[i], + image: StubImage, + boot_control: BmcReset, + boot_watch: CheckpointWalk::new(BmcEvidence, &DEVICES[i]), + svn_floor: SvnFloorBinding::SelfManaged, + updatable: scenario_updatable(), + recovery: DEVICE_RECOVERY, + trial: (), + }), + verifier: SCENARIO_VERIFIER, + report_sink: LogSink, + update_staging: SCENARIO_STAGING, + update_verifier: Some(SCENARIO_UPDATE_VERIFIER), + self_update: Some(ErotUpdate { + session: SelfSession, + floor: ErotFloor, + reset: SCENARIO_SELF_RESET, + }), + update_stall_budget_millis: 1_000, + } +} + +/// The chain and the driver, as this scenario's update phase holds them. +#[cfg(self_update)] +type Core = openprot_orchestrator_sm::Orchestrator; +#[cfg(self_update)] +type Driver = openprot_orchestrator_driver::PlatformDriver; + +/// The eRoT, which is chain position 0 in every device table. +#[cfg(self_update)] +const EROT: ComponentId = ComponentId::new(0); + +/// Stages a candidate into the eRoT's own slot and activates it. +/// +/// This is the half `self_trial` does not cover. The two scenarios meet +/// at the reset: `self_update` ends where the eRoT would reboot, and +/// `self_trial` starts from the session that reset would have left +/// behind. One run cannot do both, because nothing on this target resets +/// the eRoT and the session lives in RAM. +/// +/// Returns only when something went wrong. A successful activation records +/// the session, marks the trial pending and resets, and the reset is +/// [`EndOfRun`], which judges the run and shuts the target down. +#[cfg(self_update)] +fn self_update(core: &mut Core, driver: &mut Driver) -> Result<(), ()> { + let len = CANDIDATE.len() as u64; + if request_update(core, driver, EROT, len).is_err() { + pw_log::error!("the eRoT's own update was refused"); + return Err(()); + } + if core.state() != State::Updating(EROT) { + pw_log::error!("the request did not reach Updating"); + return Err(()); + } + pw_log::info!("staging {} bytes into the eRoT's own slot", len as u32); + + // The transfer steps, the authentication step, and the same again in + // slack, so the bound can never cut a working transfer short. A run + // that uses it up stopped making progress: a stalled pump returns no + // event, so only this bound ends such a run. + const UPDATE_ROUNDS: usize = 2 * (CANDIDATE.len() / STAGE_CHUNK + 1); + for _ in 0..UPDATE_ROUNDS { + let poll = driver.pump_update(now_millis()); + match poll.event { + // The activation runs inside this dispatch and does not come + // back from the reset. + Some(Event::UpdateVerified) => { + core.dispatch(driver, Event::UpdateVerified); + pw_log::error!("the activation returned instead of resetting the eRoT"); + return Err(()); + } + Some(event) => { + pw_log::error!("the update pump gave up on the eRoT's own job"); + core.dispatch(driver, event); + return Err(()); + } + None => {} + } + } + + pw_log::error!("the pump never authenticated the eRoT's own candidate"); + Err(()) +} + +/// Drains whatever the mock downstream device has reported and latches a ready report. +/// Non-blocking: the run loop has already waited. +fn drain_reports() { + let mut evt = [0u8; 1]; + while let Ok(len) = syscall::channel_read(handle::BOOT_EVT, 0usize, &mut evt) { + let _ = syscall::channel_respond(handle::BOOT_EVT, &[0u8; 0]); + if len == 1usize && evt[0] == 1 { + DEVICE_READY.store(true, Ordering::Relaxed); + } + } +} + +/// Whether the image measurement reached the report sink as this build +/// arranges: once, for the managed device, where the verifier reports a +/// digest, and never where it does not. +/// +/// The second half is the half that bites. Every other scenario wires a +/// verifier that measures nothing, so a `Report::Measured` there would +/// mean a digest nobody computed. +fn measured_as_expected() -> bool { + let expected = u32::from(cfg!(measured)); + let measurements = MEASUREMENTS.load(Ordering::Relaxed); + if measurements != expected { + pw_log::error!( + "the sink was handed {} measurements, expected {}", + measurements as u32, + expected as u32 + ); + return false; + } + if cfg!(measured) && MEASURED_ID.load(Ordering::Relaxed) != MANAGED_DEVICE { + pw_log::error!("the measurement named a component that is not the managed device"); + return false; + } + true +} + +/// Whether `restore` was called exactly `EXPECT_RESTORE_CALLS` times. +/// The count is zero outside the recovery cfgs, so every other scenario +/// checks recovery never ran. +fn restore_calls_as_expected() -> bool { + let calls = RESTORE_CALLS.load(Ordering::Relaxed); + if calls == EXPECT_RESTORE_CALLS { + return true; + } + pw_log::error!( + "restore was called {} times, expected {}", + calls as u32, + EXPECT_RESTORE_CALLS as u32 + ); + false +} + +fn run() -> Result<(), ()> { + syscall::wait_group_add(handle::WG, handle::BOOT_EVT, Signals::READABLE, 0usize) + .map_err(|_| ())?; + + SelfSession::install(); + + let (mut core, mut driver) = + bring_up::(&CHAIN, &DEVICES, board(), MAX_RETRY); + + // What the eRoT's last self-update was doing, read before anything + // walks. A trial running right now has to be declared here, because + // what judges it is this walk reaching `Ready`. + let settlement = match settle_self_update_at_boot(&mut core, &mut driver) { + Ok(settlement) => settlement, + Err(_) => { + pw_log::error!("the eRoT's own session could not be settled"); + return Err(()); + } + }; + if settlement != EXPECT_SETTLEMENT { + pw_log::error!("the eRoT's own session did not say what this boot is"); + return Err(()); + } + + // Power on and pass verification. The driver's release of the reset + // line is what arms the walk, so nothing here touches the device + // directly. + core.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); + if core.state() == State::Locked && !LOCKS_AT_POWER_ON { + pw_log::error!("locked before the device was released"); + return Err(()); + } + if LOCKS_AT_POWER_ON && core.state() != State::Locked { + pw_log::error!("recovery did not run out of sources in the power-on dispatch"); + return Err(()); + } + + let give_up = deadline_in(RUN_BUDGET_MILLIS); + + // Reaching `Ready` is not the pass condition. A passive component is + // released speculatively, so the machine is `Ready` as soon as the last + // component verifies, whether or not the device ever came up. What + // proves the boot is the walk's own verdict. + let mut booted = false; + + loop { + if core.state() == State::Locked { + if !EXPECT_LOCKDOWN { + pw_log::error!("orchestrator locked the platform"); + return Err(()); + } + if !restore_calls_as_expected() || !measured_as_expected() { + return Err(()); + } + if EXPECT_RECOVERY { + pw_log::info!("recovery ran out of sources and the platform locked"); + } else { + pw_log::info!("the device never came up and the platform locked"); + } + return Ok(()); + } + if booted { + if EXPECT_LOCKDOWN { + pw_log::error!("the device reported ready when it should not have"); + return Err(()); + } + // The chain is up. In a self-trial build that is the verdict on + // the trial, and the session has to read `Committed`: without it + // the UpdateSecurityRevision the Update Agent sends has nothing to + // advance the floor for. + if EXPECT_SELF_TRIAL + && SelfSession::read() != (SelfUpdateState::Committed { svn: TRIAL_SVN }) + { + pw_log::error!("the chain came up and the self trial was not confirmed"); + return Err(()); + } + // Without the call count, `recovery` would pass on a verifier + // that never refused the image. + if !restore_calls_as_expected() || !measured_as_expected() { + return Err(()); + } + pw_log::info!("device booted and the orchestrator is in Ready"); + // Only `Ready` accepts an UpdateRequest; anywhere else the + // state machine answers `ReportUpdateDeferred`. So the run + // offers the eRoT its own update once the walk has finished. + #[cfg(self_update)] + return self_update(&mut core, &mut driver); + #[cfg(not(self_update))] + return Ok(()); + } + + let poll = driver.poll_boot_walks(now_millis()); + if let Some(event) = poll.event { + match event { + Event::Booted(_) => booted = true, + // Released speculatively; not boot proof. + Event::ComponentReady(_) => {} + Event::BootFailed { checkpoint, .. } => { + pw_log::error!("device failed at checkpoint {}", checkpoint as &str); + } + _ => {} + } + core.dispatch(&mut driver, event); + continue; + } + + // Nothing to judge yet. Sleep until the walk's own deadline, or + // until the device reports, whichever comes first. A lapsed + // deadline is not an error here: the next poll is what judges it. + let deadline = match poll.next_deadline_millis { + Some(millis) => Instant::from_ticks(millis_to_ticks(millis)), + None => give_up, + }; + match syscall::object_wait(handle::WG, Signals::READABLE, deadline) { + Ok(_) => drain_reports(), + Err(pw_status::Error::DeadlineExceeded) => {} + Err(_) => return Err(()), + } + + if SystemClock::now() >= give_up { + // Expecting lockdown and not getting one is a failure too: a + // walk that never finished judged nothing. + pw_log::error!("run budget expired with the machine still deciding"); + return Err(()); + } + } +} + +#[entry] +fn entry() { + match run() { + Ok(()) => { + let _ = syscall::debug_shutdown(Ok(())); + } + Err(()) => { + let _ = syscall::debug_shutdown(Err(pw_status::Error::Internal)); + } + } + #[expect(clippy::empty_loop)] + loop {} +} + +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + loop {} +} diff --git a/target/ast10x0/tests/integration/mock_downstream_device/recovery/BUILD.bazel b/target/ast10x0/tests/integration/mock_downstream_device/recovery/BUILD.bazel new file mode 100644 index 000000000..0a675d66e --- /dev/null +++ b/target/ast10x0/tests/integration/mock_downstream_device/recovery/BUILD.bazel @@ -0,0 +1,21 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +# The boot scenario with an image the RoT refuses. +# +# Same sources, same system config, one flag. Verification rejects the +# device's image, the board restores it from its one source, and the +# re-walk authenticates it and releases the device. The run passes when +# the device boots through the restore. + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load("//target/ast10x0/tests/integration/mock_downstream_device:apps.bzl", "APPS", "SYSTEM_CONFIG", "TARGET_SRC") + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/mock_downstream_device/recovery:recovery_qemu_test +qemu_scenario( + name = "recovery_qemu", + apps = APPS, + cfgs = ["recovery"], + system_config = SYSTEM_CONFIG, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/mock_downstream_device/recovery_exhausted/BUILD.bazel b/target/ast10x0/tests/integration/mock_downstream_device/recovery_exhausted/BUILD.bazel new file mode 100644 index 000000000..d7bcb3670 --- /dev/null +++ b/target/ast10x0/tests/integration/mock_downstream_device/recovery_exhausted/BUILD.bazel @@ -0,0 +1,21 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +# The recovery scenario's negative case: the restored image is refused too. +# +# Same sources, same system config, one flag. The re-walk rejects what the +# first restore wrote, and the second finds no source left. The device is +# required, so the platform reports the component and locks. The run passes +# when both restore calls ran and the lockdown followed. + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load("//target/ast10x0/tests/integration/mock_downstream_device:apps.bzl", "APPS", "SYSTEM_CONFIG", "TARGET_SRC") + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/mock_downstream_device/recovery_exhausted:recovery_exhausted_qemu_test +qemu_scenario( + name = "recovery_exhausted_qemu", + apps = APPS, + cfgs = ["recovery_exhausted"], + system_config = SYSTEM_CONFIG, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/mock_downstream_device/self_trial/BUILD.bazel b/target/ast10x0/tests/integration/mock_downstream_device/self_trial/BUILD.bazel new file mode 100644 index 000000000..240e99652 --- /dev/null +++ b/target/ast10x0/tests/integration/mock_downstream_device/self_trial/BUILD.bazel @@ -0,0 +1,23 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +# The boot scenario with the eRoT running the trial image of its own +# update. +# +# Same sources, same system config, one flag. The session starts at +# TrialPending, as the boot after an activation would find it, and the run +# passes when the chain coming up has moved it to Committed. Without that +# the UpdateSecurityRevision the Update Agent sends has no confirmed +# session to advance the anti-rollback floor for. + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load("//target/ast10x0/tests/integration/mock_downstream_device:apps.bzl", "APPS", "SYSTEM_CONFIG", "TARGET_SRC") + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/mock_downstream_device/self_trial:self_trial_qemu_test +qemu_scenario( + name = "self_trial_qemu", + apps = APPS, + cfgs = ["self_trial"], + system_config = SYSTEM_CONFIG, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/mock_downstream_device/self_update/BUILD.bazel b/target/ast10x0/tests/integration/mock_downstream_device/self_update/BUILD.bazel new file mode 100644 index 000000000..db1181e0f --- /dev/null +++ b/target/ast10x0/tests/integration/mock_downstream_device/self_update/BUILD.bazel @@ -0,0 +1,27 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +# The eRoT's own update, up to the reset. +# +# Same sources, same system config, one flag. The chain comes up, the +# orchestrator offers itself a candidate, the pump stages it and the +# verifier reports the SVN it carries, and the activation records the +# session, marks the trial pending and requests the reset. It passes when +# the session reads TrialPending at that SVN, which is what the boot after +# the reset would find. +# +# `self_trial` is the other half: it starts from that session and checks +# what the boot does with it. One run cannot do both, because nothing on +# this target resets the eRoT and the session lives in RAM. + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load("//target/ast10x0/tests/integration/mock_downstream_device:apps.bzl", "APPS", "SYSTEM_CONFIG", "TARGET_SRC") + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/mock_downstream_device/self_update:self_update_qemu_test +qemu_scenario( + name = "self_update_qemu", + apps = APPS, + cfgs = ["self_update"], + system_config = SYSTEM_CONFIG, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/mock_downstream_device/system.json5 b/target/ast10x0/tests/integration/mock_downstream_device/system.json5 new file mode 100644 index 000000000..356286964 --- /dev/null +++ b/target/ast10x0/tests/integration/mock_downstream_device/system.json5 @@ -0,0 +1,115 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +// AST10x0 mock-downstream-device integration QEMU test. +// +// Two processes standing in for two chips: +// +// orchestrator: drives the reset line, latches boot evidence +// mock_downstream_device: the managed device, reacts to reset and reports ready +// +// The two wires are IPC channels, not GPIO. QEMU models one chip, and both +// ends live inside it, so a GPIO block would connect to nothing. Commands +// go out orchestrator -> mock_downstream_device; evidence comes back the other way on its +// own channel, because EvidenceReader::read is synchronous and must not +// block, so the orchestrator has to hold a latch rather than ask. +// +// Memory map (AST10x0: 768 KB SRAM, no XIP, so code and data share it): +// 0x00000000 - 0x00000500 vector table (1280 B) +// 0x00000500 - 0x00020000 kernel flash (129792 B) +// 0x00020000 - 0x00060000 app flash (2 x 128 KB) +// 0x00060000 - 0x00080000 kernel RAM (128 KB) +// 0x00080000 - 0x000C0000 app RAM (256 KB region; 32 KB per process used) +// +// The kernel's flash size is 129792 bytes, which is 0x20000 minus the 0x500 +// vector table, not a round 128 KB. That puts app flash at 0x20000, so each +// 128 KB app starts on a 128 KB boundary. The MPU wants a region power-of-2 +// sized and aligned; an app starting at 0x20500 would be given a region from +// 0x20000 whose last subregions reach into the next app, and neither would be +// protected from the other. +// +// App flash is then 0x20000 to 0x60000, where kernel RAM starts, so 256 KB. +// Two apps at 128 KB fill it exactly. A third at that size is placed over +// kernel RAM and still builds, with only PMSAv7 subregion overlap warnings to +// say the protection is wrong. Three apps need 84 KB each, four need 63 KB. +// The hardware firmware-update card already runs pldm_fd and i2c_server at +// 64 KB, so that is a normal size rather than a squeeze. +{ + arch: { + type: "armv7m", + vector_table_start_address: 0x00000000, + vector_table_size_bytes: 1280, + }, + kernel: { + flash_start_address: 0x00000500, + flash_size_bytes: 129792, + ram_start_address: 0x00060000, + ram_size_bytes: 131072, + }, + apps: [ + { + name: "mock_downstream_device", + flash_size_bytes: 131072, + processes: [ + { + name: "mock_downstream_device_process", + ram_size_bytes: 32768, + objects: [ + { + name: "wg", + type: "wait_group", + }, + { + // Orchestrator -> device: assert or release reset. + name: "reset_cmd", + type: "channel_handler", + }, + { + // Device -> orchestrator: the ready line changed. + name: "boot_evt", + type: "channel_initiator", + handler_process: "orchestrator_process", + handler_object_name: "boot_evt", + }, + { + type: "thread", + name: "mock_downstream_device_thread", + kernel_stack_size_bytes: 4096, + }, + ], + }, + ], + }, + { + name: "orchestrator", + flash_size_bytes: 131072, + processes: [ + { + name: "orchestrator_process", + ram_size_bytes: 32768, + objects: [ + { + name: "wg", + type: "wait_group", + }, + { + name: "boot_evt", + type: "channel_handler", + }, + { + name: "reset_cmd", + type: "channel_initiator", + handler_process: "mock_downstream_device_process", + handler_object_name: "reset_cmd", + }, + { + type: "thread", + name: "orchestrator_thread", + kernel_stack_size_bytes: 4096, + }, + ], + }, + ], + }, + ], +} diff --git a/target/ast10x0/tests/integration/mock_downstream_device/target.rs b/target/ast10x0/tests/integration/mock_downstream_device/target.rs new file mode 100644 index 000000000..347499928 --- /dev/null +++ b/target/ast10x0/tests/integration/mock_downstream_device/target.rs @@ -0,0 +1,40 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Kernel target for the mock-BMC integration QEMU test. +//! +//! The orchestrator app reports the result with +//! `syscall::debug_shutdown(Ok(()) | Err(..))`, which lands here and writes +//! the UART sentinel qemu_runner.py greps for. + +#![no_std] +#![no_main] + +use console_backend::console_backend_write_all; +use entry as _; +use target_common::{declare_target, TargetInterface}; + +pub struct Target {} + +impl TargetInterface for Target { + const NAME: &'static str = "AST10x0 mock-BMC integration test"; + + fn main() -> ! { + codegen::start(); + #[expect(clippy::empty_loop)] + loop {} + } + + fn shutdown(code: u32) -> ! { + let sentinel: &[u8] = if code == 0 { + b"TEST_RESULT:PASS\n" + } else { + b"TEST_RESULT:FAIL\n" + }; + let _ = console_backend_write_all(sentinel); + #[expect(clippy::empty_loop)] + loop {} + } +} + +declare_target!(Target); diff --git a/target/ast10x0/tests/integration/pldm_update/BUILD.bazel b/target/ast10x0/tests/integration/pldm_update/BUILD.bazel new file mode 100644 index 000000000..38c205ed5 --- /dev/null +++ b/target/ast10x0/tests/integration/pldm_update/BUILD.bazel @@ -0,0 +1,50 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_python//python:py_binary.bzl", "py_binary") +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load(":apps.bzl", "APPS", "FLASH", "SYSTEM_CONFIG", "TARGET_DEPS", "TARGET_SRC") + +package(default_visibility = ["//target/ast10x0/tests/integration:__subpackages__"]) + +filegroup( + name = "system_config", + srcs = ["system.json5"], +) + +exports_files([ + "target.rs", + "mctp_bus_main.rs", + "orchestrator_main.rs", + "pldm_fd_main.rs", + "pldm_ua_main.rs", +]) + +py_binary( + name = "make_staged_image", + srcs = ["make_staged_image.py"], +) + +# What the device's flash must hold once the update is through. Only the +# happy path checks it: a scenario that refuses the update is asserting +# the image did not land, and its guest-side verdict says that already. +genrule( + name = "staged_image", + outs = ["staged_image.bin"], + cmd = "$(location :make_staged_image) $@", + tools = [":make_staged_image"], +) + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/pldm_update:pldm_update_qemu_test +qemu_scenario( + name = "pldm_update_qemu", + apps = APPS, + flash = dict( + FLASH, + cs1_expect = ":staged_image", + cs1_expect_offset = 0x100000, + ), + system_config = SYSTEM_CONFIG, + target_deps = TARGET_DEPS, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/pldm_update/apps.bzl b/target/ast10x0/tests/integration/pldm_update/apps.bzl new file mode 100644 index 000000000..cb787e456 --- /dev/null +++ b/target/ast10x0/tests/integration/pldm_update/apps.bzl @@ -0,0 +1,104 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +"""The apps in the update scenario, shared with its negative cases. + +Labels rather than file names, because each negative scenario is a package +of its own and builds the same sources from there. +""" + +HERE = "//target/ast10x0/tests/integration/pldm_update:" + +APPS = [ + # Both MCTP servers and the loopback between them: the wire. + { + "deps": [ + "//services/mctp/api:mctp_api", + "//services/mctp/server:mctp_server_lib", + "//services/mctp/transport-loopback:mctp_transport_loopback", + "//target/ast10x0/tests/clock", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + "@pigweed//pw_status/rust:pw_status", + "@rust_crates//:mctp", + ], + "name": "mctp_bus", + "src": HERE + "mctp_bus_main.rs", + }, + # The RoT the Firmware Device answers to. + { + "deps": [ + "//services/orchestrator/adapters/walk:orchestrator_checkpoint_walk", + "//services/orchestrator/capabilities:orchestrator_capabilities", + "//services/orchestrator/config:orchestrator_config", + "//services/orchestrator/driver:orchestrator_driver", + "//services/orchestrator/sm:orchestrator_sm", + "//services/orchestrator/test:stubs", + "//services/pldm/api:pldm_api", + "//services/pldm/client:pldm_client", + "//util/io", + "//util/ipc:ipc", + "//target/ast10x0/tests/clock", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + "@pigweed//pw_status/rust:pw_status", + ], + "name": "orchestrator", + "src": HERE + "orchestrator_main.rs", + }, + # The DSP0267 Firmware Device, staging into flash on CS1. + { + "deps": [ + "//hal/blocking/flash", + "//services/mctp/client-ipc:mctp_client_ipc", + "//services/pldm:pldm_service", + "//services/pldm/api:pldm_api", + "//services/pldm/server:pldm_server", + "//target/ast10x0/backend/flash:flash_backend_ast10x0", + "//util/error", + "//util/region", + "//target/ast10x0/tests/clock", + "//target/ast10x0/tests/fd_ops", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + "@pigweed//pw_status/rust:pw_status", + "@rust_crates//:pldm-common", + "@rust_crates//:pldm-interface", + ], + "name": "pldm_fd", + "regions": True, + "src": HERE + "pldm_fd_main.rs", + }, + # The Update Agent, the BMC's half of the update. + { + "deps": [ + "//services/mctp/client-ipc:mctp_client_ipc", + "//services/pldm:pldm_service", + "//target/ast10x0/tests/clock", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + "@pigweed//pw_status/rust:pw_status", + "@rust_crates//:pldm-common", + ], + "name": "pldm_ua", + "src": HERE + "pldm_ua_main.rs", + }, +] + +# The kernel applies the FMC pinmux before any process starts, so it needs +# the SoC's registers. +TARGET_DEPS = ["//target/ast10x0/peripherals"] + +# Two chip selects, because with both present the FMC aperture splits and +# CS1 lands at 0x88000000, which is the address the Firmware Device maps. +# w25q512jv is the 64 MiB part; the default 1 MiB model refuses a backing +# file this size. +FLASH = { + "cs0_image": "cs0.img", + "cs1_image": "cs1.img", + "flash_size": 64 * 1024 * 1024, + "fmc_model": "w25q512jv", +} + +SYSTEM_CONFIG = HERE + "system_config" +TARGET_SRC = HERE + "target.rs" diff --git a/target/ast10x0/tests/integration/pldm_update/cancel_mid_transfer/BUILD.bazel b/target/ast10x0/tests/integration/pldm_update/cancel_mid_transfer/BUILD.bazel new file mode 100644 index 000000000..2f881cfca --- /dev/null +++ b/target/ast10x0/tests/integration/pldm_update/cancel_mid_transfer/BUILD.bazel @@ -0,0 +1,23 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +# The update scenario with the Update Agent changing its mind: it sends +# CancelUpdate two chunks into the transfer. +# +# Not a failure. The update is withdrawn by the side that asked for it, +# so the state machine drops what was staged and goes back to Ready, +# and the device waits to be acknowledged before letting the session go. + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load("//target/ast10x0/tests/integration/pldm_update:apps.bzl", "APPS", "FLASH", "SYSTEM_CONFIG", "TARGET_DEPS", "TARGET_SRC") + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/pldm_update/cancel_mid_transfer:cancel_mid_transfer_qemu_test +qemu_scenario( + name = "cancel_mid_transfer_qemu", + apps = APPS, + cfgs = ["cancel_mid_transfer"], + flash = FLASH, + system_config = SYSTEM_CONFIG, + target_deps = TARGET_DEPS, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/pldm_update/corrupt_image/BUILD.bazel b/target/ast10x0/tests/integration/pldm_update/corrupt_image/BUILD.bazel new file mode 100644 index 000000000..8bd2632cd --- /dev/null +++ b/target/ast10x0/tests/integration/pldm_update/corrupt_image/BUILD.bazel @@ -0,0 +1,23 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +# The update scenario's negative case: the Update Agent sends one wrong +# byte. +# +# It passes when the device catches that byte and the update does not go +# through. Failing for any other reason fails the test, so a green here +# says the content check is what stopped it. + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load("//target/ast10x0/tests/integration/pldm_update:apps.bzl", "APPS", "FLASH", "SYSTEM_CONFIG", "TARGET_DEPS", "TARGET_SRC") + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/pldm_update/corrupt_image:corrupt_image_qemu_test +qemu_scenario( + name = "corrupt_image_qemu", + apps = APPS, + cfgs = ["corrupt_image"], + flash = FLASH, + system_config = SYSTEM_CONFIG, + target_deps = TARGET_DEPS, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/pldm_update/make_staged_image.py b/target/ast10x0/tests/integration/pldm_update/make_staged_image.py new file mode 100644 index 000000000..80049edc1 --- /dev/null +++ b/target/ast10x0/tests/integration/pldm_update/make_staged_image.py @@ -0,0 +1,25 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +"""Writes the image the Update Agent hands over, for the host to compare +the device's flash against after a run. + +This repeats `expected_byte` in the three Rust apps, and the repetition is +the point: the guest cannot read a host file and the host cannot run guest +code, so an independent check needs its own copy of the rule. Change one +and this fails, which is the behaviour wanted. Keep it to one line so +there is nothing else to keep in step. +""" + +import sys + +SIZE = 1024 + + +def main() -> None: + with open(sys.argv[1], "wb") as f: + f.write(bytes(offset % 251 for offset in range(SIZE))) + + +if __name__ == "__main__": + main() diff --git a/target/ast10x0/tests/integration/pldm_update/mctp_bus_main.rs b/target/ast10x0/tests/integration/pldm_update/mctp_bus_main.rs new file mode 100644 index 000000000..5e08a5cf6 --- /dev/null +++ b/target/ast10x0/tests/integration/pldm_update/mctp_bus_main.rs @@ -0,0 +1,297 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The wire between the two endpoints, with an MCTP server at each end. +//! +//! On a board each card runs its own MCTP server over +//! `services/mctp/transport-i2c`, and the cards are joined by I2C. QEMU +//! models one chip and has no I2C, so this app holds both servers and joins +//! them with `services/mctp/transport-loopback`: what one server's router +//! fragments is fed to the other's `inbound`. +//! +//! Only the bottom of the stack changes. The Firmware Device and the update +//! agent still reach their server as `IpcMctpClient` over a channel, which +//! is the same call path they use on hardware, and EID routing, +//! fragmentation and reassembly are the shipped code. +//! +//! ```text +//! pldm_fd ──IPC── [ server EID 8 ] ──loopback── [ server EID 42 ] ──IPC── pldm_ua +//! ``` +//! +//! A blocking `Recv` is answered when a message arrives, not when it is +//! asked for. The asking channel is dropped from the wait group until then, +//! so the loop does not spin on a transaction it cannot yet complete. This +//! mirrors `target/ast10x0/tests/mctp/server/main.rs`, which defers the +//! same way while it waits for I2C. + +#![no_main] +#![no_std] + +use openprot_mctp_api::wire::{ + self, MctpOp, MctpRequestHeader, MctpResponseHeader, MAX_REQUEST_SIZE, MAX_RESPONSE_SIZE, +}; +use openprot_mctp_api::{Handle, ResponseCode}; +use openprot_mctp_server::dispatch::{self, DispatchOutcome}; +use openprot_mctp_server::Server; +use openprot_mctp_transport_loopback::{LoopbackQueue, LoopbackSender}; +use userspace::syscall::Signals; +use userspace::time::{Clock, Duration, Instant, SystemClock}; +use userspace::{entry, syscall}; + +use app_mctp_bus::handle; + +/// The endpoint id the Firmware Device answers on. +const EID_FD: u8 = 8; + +/// The endpoint id the Update Agent uses. +const EID_UA: u8 = 42; + +/// Outstanding requests each server tracks. +const OUTSTANDING: usize = 16; + +/// Fragments that may sit on one side's queue between drains. Each costs +/// the MTU plus a header, and both queues are locals on this app's thread +/// stack, so raising this means raising `kernel_stack_size_bytes` with it. +const QUEUE_DEPTH: usize = 8; + +/// Largest payload either side reassembles. +const MAX_PAYLOAD_SIZE: usize = 1024; + +type BusServer<'q> = Server, OUTSTANDING>; + +/// A `Recv` that could not be answered yet: which handle asked, and when +/// to give up on it. +struct PendingRecv { + handle: Handle, + deadline: Instant, +} + +/// One endpoint: its channel, its server, and any deferred receive. +struct Side<'q> { + channel: u32, + user_data: usize, + server: BusServer<'q>, + pending: Option, +} + +/// Answers `pending` from whatever the server now holds, if anything, and +/// puts the channel back in the wait group. Returns true if it answered. +fn satisfy(side: &mut Side<'_>, recv_buf: &mut [u8], response: &mut [u8]) -> bool { + let Some(p) = side.pending.as_ref() else { + return false; + }; + let Some(meta) = side.server.try_recv(p.handle, recv_buf) else { + return false; + }; + + let len = wire::encode_recv_response( + response, + meta.msg_type, + meta.msg_ic, + meta.remote_eid, + meta.msg_tag, + &recv_buf[..meta.payload_size], + ) + .unwrap_or_else(|_| { + wire::encode_error_response(response, ResponseCode::InternalError).unwrap_or(0) + }); + let _ = syscall::channel_respond(side.channel, &response[..len]); + + side.pending = None; + let _ = syscall::wait_group_add(handle::WG, side.channel, Signals::READABLE, side.user_data); + true +} + +/// Answers `pending` with a timeout and puts the channel back. +fn time_out(side: &mut Side<'_>, response: &mut [u8]) { + if side.pending.take().is_none() { + return; + } + let err = MctpResponseHeader::error(ResponseCode::TimedOut); + response[..MctpResponseHeader::SIZE].copy_from_slice(&err.to_bytes()); + let _ = syscall::channel_respond(side.channel, &response[..MctpResponseHeader::SIZE]); + let _ = syscall::wait_group_add(handle::WG, side.channel, Signals::READABLE, side.user_data); +} + +/// Reads one request and answers it, deferring a `Recv` that has nothing +/// waiting. +fn serve(side: &mut Side<'_>, recv_buf: &mut [u8], response: &mut [u8]) { + let mut request = [0u8; MAX_REQUEST_SIZE]; + let Ok(len) = syscall::channel_read(side.channel, 0usize, &mut request) else { + return; + }; + + if len < MctpRequestHeader::SIZE { + let err = MctpResponseHeader::error(ResponseCode::BadArgument); + response[..MctpResponseHeader::SIZE].copy_from_slice(&err.to_bytes()); + let _ = syscall::channel_respond(side.channel, &response[..MctpResponseHeader::SIZE]); + return; + } + + let header = MctpRequestHeader::from_bytes(&request[..len]); + let is_recv = header + .and_then(|h| h.operation()) + .is_some_and(|op| matches!(op, MctpOp::Recv)); + + if is_recv { + let header = header.expect("a Recv op implies a parsed header"); + let payload = wire::get_request_payload(&request[..len]); + if payload.len() < 4 { + let err = MctpResponseHeader::error(ResponseCode::BadArgument); + response[..MctpResponseHeader::SIZE].copy_from_slice(&err.to_bytes()); + let _ = syscall::channel_respond(side.channel, &response[..MctpResponseHeader::SIZE]); + return; + } + let timeout_millis = u32::from_le_bytes(payload[..4].try_into().unwrap()); + let recv_handle = Handle(header.handle); + + // Park the ask. Dropping the channel from the wait group stops the + // loop re-firing on a transaction that is still open. + side.pending = Some(PendingRecv { + handle: recv_handle, + deadline: if timeout_millis == 0 { + Instant::MAX + } else { + SystemClock::now() + .checked_add_duration(Duration::from_millis(timeout_millis as u64)) + .unwrap_or(Instant::MAX) + }, + }); + let _ = syscall::wait_group_remove(handle::WG, side.channel); + + // It may already be satisfiable, in which case this answers at once. + satisfy(side, recv_buf, response); + return; + } + + let len = match dispatch::dispatch_mctp_op( + &request[..len], + response, + &mut side.server, + recv_buf, + 0, + ) { + DispatchOutcome::Reply(n) => n, + DispatchOutcome::Pending { .. } => unreachable!("Recv is handled above"), + }; + let _ = syscall::channel_respond(side.channel, &response[..len]); +} + +#[entry] +fn entry() { + // Each side's outbox. What one queues, the other receives. + let out_fd: LoopbackQueue = LoopbackQueue::new(); + let out_ua: LoopbackQueue = LoopbackQueue::new(); + + let mut fd = Side { + channel: handle::FD, + user_data: 0, + server: Server::new(mctp::Eid(EID_FD), 0, LoopbackSender::new(&out_fd)), + pending: None, + }; + let mut ua = Side { + channel: handle::UA, + user_data: 1, + server: Server::new(mctp::Eid(EID_UA), 0, LoopbackSender::new(&out_ua)), + pending: None, + }; + + if syscall::wait_group_add(handle::WG, fd.channel, Signals::READABLE, fd.user_data).is_err() + || syscall::wait_group_add(handle::WG, ua.channel, Signals::READABLE, ua.user_data).is_err() + { + loop {} + } + + let mut recv_buf = [0u8; MAX_PAYLOAD_SIZE]; + let mut response = [0u8; MAX_RESPONSE_SIZE]; + + loop { + // Parking removes a channel from the wait group, so both sides + // parked leaves it empty, and object_wait on an empty group + // returns InvalidArgument at once rather than blocking. + // + // So with both parked there is nothing to wait on, and the loop + // watches the clock instead, answering each side when its own + // deadline passes. Answering the nearer one straight away would be + // simpler and is wrong: a receive that still has seconds to run + // gets a timeout it did not earn, and the client reports the + // transfer failed. Nothing can arrive while both sides are parked + // anyway, because neither can send with its transaction open, so + // the spin ends at the first real deadline. + if fd.pending.is_some() && ua.pending.is_some() { + let now = SystemClock::now(); + if fd.pending.as_ref().is_some_and(|p| p.deadline <= now) { + time_out(&mut fd, &mut response); + } + if ua.pending.as_ref().is_some_and(|p| p.deadline <= now) { + time_out(&mut ua, &mut response); + } + if fd.pending.is_some() && ua.pending.is_some() { + continue; + } + } + + // Wake no later than the nearer of the two parked receives. + let deadline = match (fd.pending.as_ref(), ua.pending.as_ref()) { + (Some(a), Some(b)) => a.deadline.min(b.deadline), + (Some(a), None) => a.deadline, + (None, Some(b)) => b.deadline, + (None, None) => Instant::MAX, + }; + + match syscall::object_wait(handle::WG, Signals::READABLE, deadline) { + Ok(ev) => { + if ev.user_data == fd.user_data { + serve(&mut fd, &mut recv_buf, &mut response); + } else { + serve(&mut ua, &mut recv_buf, &mut response); + } + } + Err(pw_status::Error::DeadlineExceeded) => { + let now = SystemClock::now(); + if fd.pending.as_ref().is_some_and(|p| p.deadline <= now) { + time_out(&mut fd, &mut response); + } + if ua.pending.as_ref().is_some_and(|p| p.deadline <= now) { + time_out(&mut ua, &mut response); + } + continue; + } + Err(e) => { + pw_log::error!("BUS: object_wait error {}", e as u32); + continue; + } + } + + // Carry the wire. One side's fragments are the other's inbound, + // and draining here rather than inside the router keeps the + // borrow straight. + while let Some(pkt) = out_fd.take() { + let _ = ua.server.inbound(&pkt); + } + while let Some(pkt) = out_ua.take() { + let _ = fd.server.inbound(&pkt); + } + + // A full queue drops silently, and a missing fragment stalls + // reassembly forever, which looks like anything but a dropped + // packet. Say so instead. + if out_fd.dropped() > 0 || out_ua.dropped() > 0 { + pw_log::error!( + "BUS: dropped fragments, fd={} ua={}", + out_fd.dropped() as u32, + out_ua.dropped() as u32 + ); + } + + // Whatever just crossed may be what a parked receive was waiting + // for. + satisfy(&mut fd, &mut recv_buf, &mut response); + satisfy(&mut ua, &mut recv_buf, &mut response); + } +} + +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + loop {} +} diff --git a/target/ast10x0/tests/integration/pldm_update/offer_before_supervising/BUILD.bazel b/target/ast10x0/tests/integration/pldm_update/offer_before_supervising/BUILD.bazel new file mode 100644 index 000000000..9f3ef0d58 --- /dev/null +++ b/target/ast10x0/tests/integration/pldm_update/offer_before_supervising/BUILD.bazel @@ -0,0 +1,23 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +# The update scenario with the offer arriving too early: the device +# offers an update to a RoT that is supervising nothing. +# +# Nothing may be updated while the platform has no chain under it. The RoT +# turns the offer down as busy, which is a different refusal from the +# policy one in refused_update and has to be told apart from it. + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load("//target/ast10x0/tests/integration/pldm_update:apps.bzl", "APPS", "FLASH", "SYSTEM_CONFIG", "TARGET_DEPS", "TARGET_SRC") + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/pldm_update/offer_before_supervising:offer_before_supervising_qemu_test +qemu_scenario( + name = "offer_before_supervising_qemu", + apps = APPS, + cfgs = ["offer_before_supervising"], + flash = FLASH, + system_config = SYSTEM_CONFIG, + target_deps = TARGET_DEPS, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/pldm_update/orchestrator_main.rs b/target/ast10x0/tests/integration/pldm_update/orchestrator_main.rs new file mode 100644 index 000000000..59bd35c32 --- /dev/null +++ b/target/ast10x0/tests/integration/pldm_update/orchestrator_main.rs @@ -0,0 +1,749 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The RoT in the PLDM update scenario. +//! +//! Runs the shipped state machine and platform driver, and answers the Firmware +//! Device over IPC. The Firmware Device never decides anything: it reports what +//! the Update Agent requested and what came of it, and this app says whether +//! the update may go on. That is the gatekeeper shape the design calls for, and +//! it only means anything across a process boundary, which is why the +//! orchestrator is its own app rather than a core inside the FD. +//! +//! The exchange is three messages, each answered with one byte, 1 for +//! accepted and 0 for refused: +//! +//! 1. `UpdateRequested`, with the candidate's length. Accepted when the +//! machine is supervised and the staging region can hold it. +//! 2. `VerifyOutcome`, carrying the device's verdict. +//! 3. `Activated`, which stands in for the updated device coming back up. +//! +//! What this does not yet prove: the driver's `Updatable` stages nothing, +//! because in this flow the Firmware Device pulls its own bytes from the +//! Update Agent, out of the orchestrator's sight. Closing that is the next +//! step, and until then `activate` is the only side of the seam with a real +//! caller. + +#![no_main] +#![no_std] + +use core::convert::Infallible; +use core::sync::atomic::{AtomicBool, Ordering}; + +use openprot_orchestrator_driver::{ + bring_up, Board, BoardCapabilities, ComponentWiring, Report, ReportSink, SvnFloorBinding, +}; +// Only the accepting path records a job or pumps it, so the scenario that +// refuses every request needs neither. +#[cfg(not(refused_update))] +use openprot_orchestrator_driver::request_update; +use openprot_orchestrator_sm::{ + ComponentAttrs, ComponentId, Effect, Event, Platform, PowerOnResult, +}; +// Only the accepting path checks the state it reached. +use board_stubs::{BoardFault, StubImage, StubVerifier}; +#[cfg(not(refused_update))] +use openprot_orchestrator_sm::State; +use orchestrator_capabilities::{ + AuthenticatedImage, BootControl, BootStatus, EvidenceReader, IncrementalVerifier, PollOutcome, + StageProgress, Svn, SvnFloor, Updatable, UpdateError, VerifySession, +}; +use orchestrator_checkpoint_walk::CheckpointWalk; +use orchestrator_config::{ + assert_retry_reaches_every_image, chain_of, BootCheckpoint, ChainEntries, DeviceConfig, +}; +use pldm_api::wire::{MAX_REQUEST_SIZE, MAX_RESPONSE_SIZE}; +use pldm_api::{FdStatus, RejectReason}; +use pldm_client::{ClientError, FdIpcClient, Reply}; +use util_io::{ByteReadError, ByteSource}; + +use board_clock::deadline_in; +use userspace::syscall::Signals; +// Only the accepting path pumps the update, so only it reads the clock. +#[cfg(not(refused_update))] +use board_clock::now_millis; +use userspace::{entry, syscall}; + +use util_ipc::{AsyncChannelTransport, IpcHandle}; + +use app_orchestrator::handle; + +/// The PLDM IPC buffers this process lends the kernel, sized to the +/// protocol's own maxima. +static mut SEND_BUF: [u8; MAX_REQUEST_SIZE] = [0; MAX_REQUEST_SIZE]; +static mut RECV_BUF: [u8; MAX_RESPONSE_SIZE] = [0; MAX_RESPONSE_SIZE]; + +type Fd = FdIpcClient>; + +/// The component the Firmware Device updates. One device, so its id is +/// fixed rather than carried in the messages. Position 1 because the eRoT +/// holds position 0 in every device table. +const TARGET: ComponentId = ComponentId::new(1); + +/// Whether the Update Agent sends UpdateSecurityRevision. Where it does +/// not, `activate` dispatches the event itself. +const AGENT_COMMITS_SVN: bool = cfg!(svn_commit) || cfg!(svn_commit_refused); + +/// Chain capacity and the core's effect-sink cap (`E >= 2*N + 2`). `N` +/// counts the device table below, so the two cannot disagree. +const N: usize = DEVICES.len(); +const E: usize = 2 * N + 2; +const MAX_RETRY: u8 = 3; + +/// Size of the candidate the Update Agent hands over. Must match the image +/// the Firmware Device holds, because the staging region is sized from it. +const IMAGE_SIZE: usize = 1024; + +/// Where the device is told to stage. It stages into its own flash and +/// ignores this, but the offer carries it, so the value has to be the one +/// the device actually uses or the message would be a lie. +const STAGING_BASE: u32 = 0x10_0000; + +/// How long the device may take to answer a command. It serves its channel +/// whenever it is waiting on the RoT, so this bounds a device that stopped +/// serving, not one that is busy. +const DEVICE_TIMEOUT_MILLIS: u64 = 10_000; + +/// How many device steps one update may take. A full run is four, so this +/// only catches a device that reports the same step forever. +const MAX_DEVICE_STEPS: usize = 16; + +/// The device table. No device boots in this image, so the window is +/// nominal: what is being proven is the update path, not a boot walk. +/// Chain position 0 is the eRoT itself. It is addressable but never +/// supervised. This image does not update the eRoT, so the entry carries no +/// layout. +static DEVICES: [DeviceConfig; 2] = [ + DeviceConfig::erot("erot", None), + DeviceConfig::new( + "device", + 0, + &[BootCheckpoint::new( + "ready", + 1, + core::time::Duration::from_millis(1_000), + )], + None, + ComponentAttrs::passive_required(), + ), +]; + +static CHAIN: ChainEntries = chain_of(&DEVICES); + +const _: () = assert_retry_reaches_every_image(MAX_RETRY, &DEVICES); + +/// Set when the RoT's own verifier authenticates the candidate. The device +/// verifies its image too, and the update only goes through when both say +/// so, so this records one half of that. +static ROT_AUTHENTICATED: AtomicBool = AtomicBool::new(false); + +/// Set when the driver actually calls `Updatable::activate`. The board sits +/// inside the driver, so this is how the run loop sees that activation +/// reached the device rather than only passing through the state machine. +static ACTIVATED: AtomicBool = AtomicBool::new(false); + +/// The byte the candidate carries at `offset`. Offset-dependent, matching +/// what the Firmware Device expects, so a staging region that served the +/// wrong bytes would be caught rather than accepted. +fn expected_byte(offset: usize) -> u8 { + (offset % 251) as u8 +} + +/// No reset line in this image: the update targets the device the Firmware +/// Device runs on, and nothing here holds it. +struct NoReset; + +impl BootControl for NoReset { + type Error = BoardFault; + + fn hold_in_reset(&mut self) -> Result<(), BoardFault> { + Ok(()) + } + + fn release(&mut self) -> Result<(), BoardFault> { + Ok(()) + } +} + +/// No device reports boot evidence here, so the walk is satisfied at once. +/// A boot scenario is what proves the walk; this one proves the update. +struct AlwaysBooted; + +impl EvidenceReader for AlwaysBooted { + type Error = Infallible; + + fn read(&mut self, _probe: &u8) -> Result { + Ok(BootStatus::Booted) + } +} + +/// The device keeps its own SVN floor: a PLDM Firmware Device commits +/// internally, so the eRoT holds no second one. +struct NoFloor; + +impl SvnFloor for NoFloor { + type Error = BoardFault; + + fn floor(&self) -> Result { + Err(BoardFault) + } + + fn advance(&mut self, _to: Svn) -> Result<(), BoardFault> { + Err(BoardFault) + } +} + +/// The Firmware Device as the driver sees it. +/// +/// Staging is already done by the time the orchestrator hears about it: the +/// device pulled its own chunks from the Update Agent, which is what DSP0267 +/// has it do. So `poll_stage` reports the payload is already in place rather +/// than pushing it, and `activate` is the one call that reaches the device +/// for real. Replacing this stub with an IPC call to the Firmware Device is +/// the next step; what it would prove is the push direction, which this +/// flow does not use. +struct FdUpdatable; + +impl Updatable for FdUpdatable { + fn poll_stage(&mut self, _payload: &dyn ByteSource) -> Result { + Ok(StageProgress::Ready) + } + + fn abandon(&mut self) {} + + fn activate(&mut self) -> Result<(), UpdateError> { + ACTIVATED.store(true, Ordering::Relaxed); + Ok(()) + } +} + +/// The staging region, as big as the candidate and carrying the same bytes +/// the Firmware Device expects. Nothing reads it while the device stages +/// itself, but its length is what bounds the candidate at submit time, so a +/// candidate too large for the board is refused before an update starts. +struct PatternStaging; + +impl ByteSource for PatternStaging { + fn len(&self) -> u64 { + IMAGE_SIZE as u64 + } + + fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<(), ByteReadError> { + let end = offset + .checked_add(buf.len() as u64) + .ok_or(ByteReadError::OutOfRange)?; + if end > self.len() { + return Err(ByteReadError::OutOfRange); + } + for (i, slot) in buf.iter_mut().enumerate() { + *slot = expected_byte(offset as usize + i); + } + Ok(()) + } +} + +/// The RoT's own check of the staged candidate. +/// +/// Signature checking belongs to the crypto service and is stubbed until +/// the service exists, so this reads the staging region and compares it with the +/// pattern the Update Agent is expected to have sent. That makes the RoT's +/// verdict depend on the bytes rather than on nothing, which is what keeps +/// the authenticated path from passing vacuously. +/// +/// One poll does the whole image. The trait asks for bounded steps so a long +/// check cannot stall the loop; at a kilobyte that does not arise. +struct PatternVerifier; + +struct PatternSession; + +impl IncrementalVerifier for PatternVerifier { + type Error = BoardFault; + type Session = PatternSession; + + fn start(self) -> PatternSession { + PatternSession + } +} + +impl VerifySession for PatternSession { + type Verifier = PatternVerifier; + type Error = BoardFault; + + fn poll(self, payload: &dyn ByteSource) -> PollOutcome { + let len = payload.len() as usize; + if len == 0 { + // An empty payload is a fault, never a vacuous pass. + return PollOutcome::Fault(PatternVerifier, BoardFault); + } + + let mut chunk = [0u8; 64]; + let mut offset = 0usize; + while offset < len { + let take = core::cmp::min(chunk.len(), len - offset); + if payload.read_at(offset as u64, &mut chunk[..take]).is_err() { + return PollOutcome::Fault(PatternVerifier, BoardFault); + } + for (i, byte) in chunk[..take].iter().enumerate() { + if *byte != expected_byte(offset + i) { + return PollOutcome::Rejected(PatternVerifier); + } + } + offset += take; + } + + ROT_AUTHENTICATED.store(true, Ordering::Relaxed); + PollOutcome::Authenticated { + verifier: PatternVerifier, + image: AuthenticatedImage { + // The pattern check reads a synthetic image: no manifest + // and no digest. + svn: None, + measurement: None, + }, + } + } + + fn abandon(self) -> PatternVerifier { + PatternVerifier + } +} + +/// Reports go to the console, where the test reads them as an operator would. +struct LogSink; + +impl ReportSink for LogSink { + fn report(&mut self, report: Report) { + match report { + Report::Isolated(id) => { + pw_log::info!("ORCH: report, component {} isolated", id.get() as u32) + } + Report::RecoveryFailed(id) => pw_log::info!( + "ORCH: report, component {} out of recovery sources", + id.get() as u32 + ), + Report::BootFailed { id, checkpoint, .. } => pw_log::info!( + "ORCH: report, component {} failed at {}", + id.get() as u32, + checkpoint as &str + ), + _ => pw_log::info!("ORCH: report, unrecognised"), + } + } +} + +struct UpdateBoard; + +impl BoardCapabilities for UpdateBoard { + type Image = StubImage; + type Verifier = StubVerifier; + type BootControl = NoReset; + type BootWatch = CheckpointWalk; + type SvnFloor = NoFloor; + type ReportSink = LogSink; + type Updatable = FdUpdatable; + type Recovery = (); + type DeviceTrial = (); + type Staging = PatternStaging; + type UpdateVerifier = PatternVerifier; + type SelfUpdate = (); + type SelfReset = (); + type ResetSignal = u8; + type Probe = u8; +} + +fn board() -> Board { + Board { + // Built from the table index, so a component's parts cannot end + // up wired to a different slot than the one they sit in. + // + // Index 0 is the eRoT. The walk passes over it, so nothing reads + // or actuates that entry. Components are indexed by ComponentId, + // so index 0 still needs a value. + components: core::array::from_fn(|i| ComponentWiring { + device: &DEVICES[i], + image: StubImage, + boot_control: NoReset, + boot_watch: CheckpointWalk::new(AlwaysBooted, &DEVICES[i]), + svn_floor: SvnFloorBinding::SelfManaged, + updatable: FdUpdatable, + recovery: (), + trial: (), + }), + verifier: StubVerifier, + report_sink: LogSink, + update_staging: PatternStaging, + update_verifier: Some(PatternVerifier), + self_update: None, + update_stall_budget_millis: 5_000, + } +} + +type Core = openprot_orchestrator_sm::Orchestrator; +type Driver = openprot_orchestrator_driver::PlatformDriver; + +/// The negative scenario refuses before looking at anything, which is the +/// one refusal that cannot be mistaken for a judgement about the candidate. +#[cfg(refused_update)] +fn accept_update( + _core: &mut Core, + _driver: &mut Driver, + _candidate_len: u64, +) -> Option { + pw_log::info!("ORCH: refusing the update, as this scenario asks"); + Some(RejectReason::PolicyViolation) +} + +/// Records the job and walks it to authenticated. +/// +/// The pump's `UpdateVerified` is not dispatched here. It is the RoT's half +/// of the verdict; the device's half arrives as `ApplyPending`, and the +/// update only goes through when both agree. Eight rounds is slack: the pump +/// takes three to get from Submitted to Authenticated. +#[cfg(not(refused_update))] +fn accept_update(core: &mut Core, driver: &mut Driver, candidate_len: u64) -> Option { + // No updates until the platform knows what it has. Busy, not + // PolicyViolation: this says "not now", not "not this image". + if !core.state().is_supervised() { + pw_log::error!("ORCH: an update was offered while the platform was not supervising"); + return Some(RejectReason::Busy); + } + if request_update(core, driver, TARGET, candidate_len).is_err() { + pw_log::error!("ORCH: refused the update request"); + return Some(RejectReason::PolicyViolation); + } + if core.state() != State::Updating(TARGET) { + pw_log::error!("ORCH: the request did not reach Updating"); + return Some(RejectReason::PolicyViolation); + } + + let mut verified = false; + for _ in 0..8 { + let poll = driver.pump_update(now_millis()); + match poll.event { + Some(Event::UpdateVerified) => { + verified = true; + break; + } + Some(event) => { + pw_log::error!("ORCH: the update pump gave up on the job"); + core.dispatch(driver, event); + return Some(RejectReason::PolicyViolation); + } + None => {} + } + } + + if !verified { + pw_log::error!("ORCH: the pump never produced UpdateVerified"); + return Some(RejectReason::PolicyViolation); + } + + if !ROT_AUTHENTICATED.load(Ordering::Relaxed) { + pw_log::error!("ORCH: the candidate never authenticated"); + return Some(RejectReason::PolicyViolation); + } + None +} + +#[entry] +fn entry() { + pw_log::info!("ORCH: app started"); + + // SAFETY: taken once, at this process's entry point, and handed + // straight to the transport that owns them from here on. + let send = unsafe { &mut *core::ptr::addr_of_mut!(SEND_BUF) }; + let recv = unsafe { &mut *core::ptr::addr_of_mut!(RECV_BUF) }; + let transport = AsyncChannelTransport::new(IpcHandle::new(handle::FD), send, recv); + let mut fd = FdIpcClient::new(transport); + + let (mut core, mut driver) = + bring_up::(&CHAIN, &DEVICES, board(), MAX_RETRY); + + // Power on and verify, which is what puts the machine in Ready. An + // update request arriving before that is refused, which is the point of + // the check rather than a race to avoid. + if cfg!(offer_before_supervising) { + // Skip PowerGood and VerificationPassed, so the machine is still + // unsupervised when the offer arrives. + pw_log::info!("ORCH: not supervising yet, waiting for the firmware device"); + } else { + core.dispatch(&mut driver, Event::PowerGood(PowerOnResult::Provisioned)); + core.dispatch(&mut driver, Event::VerificationPassed(TARGET)); + pw_log::info!("ORCH: supervising, waiting for the firmware device"); + } + + // The Firmware Device declares the run's verdict, as it did before: the + // runner greps one sentinel, and in a scenario where the RoT refuses, + // the RoT reaching a failure is what the test passes on. So this logs + // what it reached and parks. + if run(&mut core, &mut driver, &mut fd) { + pw_log::info!("ORCH: the update completed"); + } else { + pw_log::error!("ORCH: the update did not complete"); + } + #[expect(clippy::empty_loop)] + loop {} +} + +/// Drives one update, device step by device step. +/// +/// Asks what the device is waiting for, decides, commands, and asks again. +/// The device raises `Signals::USER` when it starts waiting, which this loop +/// does not need: a `QueryStatus` sits in the channel until the device next +/// serves it, and this orchestrator has nothing else to do meanwhile. An +/// orchestrator that did would wait on the signal instead of parking here. +fn run(core: &mut Core, driver: &mut Driver, fd: &mut Fd) -> bool { + for _ in 0..MAX_DEVICE_STEPS { + let Some(status) = query(fd) else { + return false; + }; + + match status { + FdStatus::OfferPending { total, .. } => { + if !offer(core, driver, fd, total) { + return false; + } + } + // Consent to start verifying, not a verdict: the device has + // not read its image back yet. + FdStatus::VerifyPending => { + if !command(fd, "PerformVerify", |fd| fd.perform_verify()) { + return false; + } + } + // The device only asks for apply once it has read the image + // back and found it whole, so this is its verdict. + FdStatus::ApplyPending => { + if !verified(core, driver, fd) { + return false; + } + } + FdStatus::ActivationPending => { + if !activate(core, driver, fd) { + return false; + } + // The agent may still ask for the security revision to be + // committed, which DSP0267 only takes once the device is + // idle. Nothing else follows an activation. + if !AGENT_COMMITS_SVN { + return true; + } + } + // Committing the revision is a decision of its own: the image + // is installed either way, and this is what stops the device + // being rolled back to what it replaced. + FdStatus::SvnCommitPending { component } => { + pw_log::info!( + "ORCH: the agent asked to commit component {}'s security revision", + component as u32 + ); + match svn_commit(core, driver, fd) { + Commit::Failed => return false, + // `svn_commit` sends one request and is done. + Commit::Granted if !cfg!(svn_commit_refused) => return true, + Commit::Granted => {} + // The second request in `svn_commit_refused`. + Commit::Refused if cfg!(svn_commit_refused) => return true, + Commit::Refused => { + pw_log::error!("ORCH: the revision commit was refused"); + return false; + } + } + } + FdStatus::PhaseFailed { phase, result_code } => { + pw_log::error!( + "ORCH: the device failed phase {} with code {}", + phase as u32, + result_code as u32 + ); + core.dispatch(driver, Event::UpdateRejected); + return false; + } + // The requester withdrew. Drop staged work, ack the cancel. + FdStatus::Cancelled => { + pw_log::info!("ORCH: the update was withdrawn"); + core.dispatch(driver, Event::UpdateCancelled); + // State is not imported when refused_update is set. + #[cfg(not(refused_update))] + if core.state() != State::Ready { + pw_log::error!("ORCH: the machine did not settle after the withdrawal"); + return false; + } + if !command(fd, "AckCancel", |fd| fd.ack_cancel()) { + return false; + } + return false; + } + FdStatus::Idle { .. } => { + pw_log::error!("ORCH: the device went idle mid-update"); + return false; + } + _ => { + pw_log::error!("ORCH: the device reported a status this scenario does not drive"); + return false; + } + } + } + + pw_log::error!("ORCH: the device never finished"); + false +} + +/// Records the job, walks it to authenticated, and answers the offer. +fn offer(core: &mut Core, driver: &mut Driver, fd: &mut Fd, total: u32) -> bool { + if let Some(reason) = accept_update(core, driver, u64::from(total)) { + let _ = fd.reject_offer(reason); + let _ = settle(fd); + pw_log::error!("ORCH: refused the offer"); + return false; + } + pw_log::info!("ORCH: update accepted, {} bytes", total as u32); + command(fd, "AcceptOffer", |fd| fd.accept_offer(STAGING_BASE)) +} + +/// The device says it verified. The update goes on only if the RoT's own +/// verifier agreed too. +fn verified(core: &mut Core, driver: &mut Driver, fd: &mut Fd) -> bool { + if !ROT_AUTHENTICATED.load(Ordering::Relaxed) { + pw_log::error!("ORCH: the device accepted a candidate the RoT did not"); + core.dispatch(driver, Event::UpdateRejected); + let _ = fd.reject_apply(RejectReason::PolicyViolation); + let _ = settle(fd); + return false; + } + + core.dispatch(driver, Event::UpdateVerified); + if !ACTIVATED.load(Ordering::Relaxed) { + pw_log::error!("ORCH: the verdict did not reach the device"); + return false; + } + pw_log::info!("ORCH: both verdicts agree, activating"); + command(fd, "PerformApply", |fd| fd.perform_apply()) +} + +/// Commands the activation and closes the commit window. +fn activate(core: &mut Core, driver: &mut Driver, fd: &mut Fd) -> bool { + if !command(fd, "PerformActivate", |fd| fd.perform_activate()) { + return false; + } + // Stands in for the updated device coming back up. Nothing in this + // image reboots, so the acknowledged activation is what this scenario + // treats as a healthy first boot. + core.dispatch(driver, Event::BootConfirmed(TARGET)); + // The SVN floor moves on the request the Update Agent sends, not on the + // boot. Where the Update Agent sends no UpdateSecurityRevision, + // `Event::SvnCommitRequest` stands in for it, as `BootConfirmed` above + // stands in for the reboot. + if !AGENT_COMMITS_SVN { + core.dispatch(driver, Event::SvnCommitRequest(TARGET)); + } + pw_log::info!("ORCH: update committed"); + true +} + +/// Grants or refuses the request the Update Agent sends to commit the +/// device's security revision. +/// +/// The machine drops `SvnCommitRequest` for a component with nothing +/// outstanding, and a dropped request emits no effect. So the grant waits +/// on `Effect::CommitSvnFloor` actually arriving: answering `perform` +/// without it would tell the Update Agent the RoT granted something it +/// never saw. +/// +/// `svn_commit_refused` sends a second request with nothing outstanding, +/// so the three answers have to be told apart. +fn svn_commit(core: &mut Core, driver: &mut Driver, fd: &mut Fd) -> Commit { + let mut granted = false; + core.dispatch_with(Event::SvnCommitRequest(TARGET), |effect| { + if effect == Effect::CommitSvnFloor(TARGET) { + granted = true; + } + driver.execute(effect) + }); + if !granted { + // Info, not error: `svn_commit_refused` arranges this refusal. + pw_log::info!("ORCH: nothing outstanding to commit a revision for"); + let _ = fd.reject_svn_commit(RejectReason::PolicyViolation); + let _ = settle(fd); + return Commit::Refused; + } + if !command(fd, "PerformSvnCommit", |fd| fd.perform_svn_commit()) { + return Commit::Failed; + } + Commit::Granted +} + +/// What the RoT answered one UpdateSecurityRevision request with. +enum Commit { + /// The floor took the SVN, and the RoT sent PerformSvnCommit. + Granted, + /// The state machine emitted no `Effect::CommitSvnFloor`, so the RoT + /// sent RejectSvnCommit. + Refused, + /// The exchange with the device did not complete. + Failed, +} + +/// Asks the device what it is waiting for. +fn query(fd: &mut Fd) -> Option { + if fd.query_status().is_err() { + pw_log::error!("ORCH: could not ask the device for its status"); + return None; + } + match settle(fd) { + Some(Reply::Status(status)) => Some(status), + Some(Reply::Acked) => { + pw_log::error!("ORCH: QueryStatus was acknowledged instead of answered"); + None + } + None => None, + } +} + +/// Sends one command and waits for the device to take it. +fn command( + fd: &mut Fd, + name: &str, + start: impl FnOnce(&mut Fd) -> Result<(), ClientError>, +) -> bool { + if start(fd).is_err() { + pw_log::error!("ORCH: could not send {}", name as &str); + return false; + } + match settle(fd) { + Some(Reply::Acked) => true, + Some(Reply::Status(_)) => { + pw_log::error!("ORCH: a command was answered with a status"); + false + } + None => false, + } +} + +/// Waits for the answer to whatever is in flight. +/// +/// The deadline is the one that matters in this scenario: a device that +/// stops serving its channel leaves this loop with a log line rather than +/// stalling the run until the harness times out. +fn settle(fd: &mut Fd) -> Option { + let deadline = deadline_in(DEVICE_TIMEOUT_MILLIS); + loop { + match fd.poll() { + Ok(Some(reply)) => return Some(reply), + Ok(None) => {} + Err(_) => { + pw_log::error!("ORCH: the device's answer did not decode"); + return None; + } + } + if syscall::object_wait(handle::FD, Signals::READABLE, deadline).is_err() { + pw_log::error!("ORCH: the device stopped answering"); + return None; + } + } +} + +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + loop {} +} diff --git a/target/ast10x0/tests/integration/pldm_update/pldm_fd_main.rs b/target/ast10x0/tests/integration/pldm_update/pldm_fd_main.rs new file mode 100644 index 000000000..1d99be282 --- /dev/null +++ b/target/ast10x0/tests/integration/pldm_update/pldm_fd_main.rs @@ -0,0 +1,1052 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The PLDM Firmware Device, running the real DSP0267 state machine. +//! +//! The same `FirmwareDevice` the production image ships, reached over the +//! same `IpcMctpClient` call path. What differs from the hardware card is one +//! layer at the bottom and one at the side: the wire is the loopback bus +//! rather than I2C, and the image is staged into RAM rather than SPI NOR. +//! +//! Staging into RAM keeps this app independent of the flash service, so +//! the first scenario proves the PLDM exchange on its own. A later +//! scenario that cares where the bytes land writes them through the +//! device server instead, which is also what makes "verify what is on +//! flash" mean anything. + +#![no_main] +#![no_std] + +use core::cell::{Cell, RefCell}; + +use board_clock::now_millis; +use flash_backend::{Backend, NoWaitBlocking}; +use hal_flash::{BlockingFlash, Flash, FlashAddress}; +use openprot_mctp_client_ipc::IpcMctpClient; +use openprot_pldm_service::firmware_device::{FirmwareDevice, RunTerminusResult}; +use openprot_pldm_service::{MctpPldmTransport, PldmServiceError}; +use pldm_api::{FdStatus, RejectReason, ResponseCode, TransferMode}; +use pldm_common::message::firmware_update::activate_pending_component::{ + PendingComponent, PendingComponentResult, +}; +use pldm_common::message::firmware_update::apply_complete::ApplyResult; +use pldm_common::message::firmware_update::get_fw_params::FirmwareParameters; +use pldm_common::message::firmware_update::get_status::ProgressPercent; +use pldm_common::message::firmware_update::request_cancel::{ + NonFunctioningComponentBitmap, NonFunctioningComponentIndication, +}; +use pldm_common::message::firmware_update::request_fw_data::MAX_TRANSFER_SIZE; +use pldm_common::message::firmware_update::transfer_complete::TransferResult; +use pldm_common::message::firmware_update::update_security_revision::{ + SecurityRevisionComponent, SecurityRevisionResult, +}; +use pldm_common::message::firmware_update::verify_complete::VerifyResult; +use pldm_common::protocol::base::PldmBaseCompletionCode; +use pldm_common::protocol::firmware_update::{ComponentResponseCode, Descriptor, PldmFdTime}; +use pldm_common::util::fw_component::FirmwareComponent; +use pldm_interface::firmware_device::fd_ops::{ComponentOperation, FdOps, FdOpsError}; +use pldm_server::{dispatch, FdIpcHandler}; +use pw_status::Error; +use userspace::syscall::Signals; +use userspace::time::{Clock, Instant, SystemClock}; +use userspace::{entry, syscall}; + +use util_error::ErrorCode; +use util_region::Region; + +use app_pldm_fd::handle; +use app_pldm_fd_regions::{take_mmaps, FmcCs0Window, FmcCs1Window, FmcRegs}; + +/// This device's endpoint id, matching the bus's firmware-device side. +const FD_EID: u8 = 8; + +/// The endpoint id the Update Agent uses, matching the bus's other side. +const UA_EID: u8 = 42; + +/// Bytes in the image the Update Agent offers. Small enough to stage in +/// this app's RAM and still take several transfers. +const IMAGE_SIZE: usize = 1024; + +/// Identifies this device to the Update Agent. Arbitrary, but it has to +/// match what the agent looks for. +const DEVICE_UUID: [u8; 16] = [ + 0x4f, 0x50, 0x52, 0x4f, 0x54, 0x2d, 0x51, 0x45, 0x4d, 0x55, 0x2d, 0x4d, 0x4f, 0x43, 0x4b, 0x01, +]; + +/// The one component this device advertises. +const COMP_IDENTIFIER: u16 = 0x0001; + +const ACTIVE_COMP_VERSION: &str = "v0.9"; +const ACTIVE_IMAGE_SET_VERSION: &str = "openprot-qemu-v0.9"; + +/// How long the device waits for the Update Agent to say anything before +/// giving up. Generous: a stuck test should fail on the harness timeout +/// with a log, not here with a bare error. +const IDLE_TIMEOUT_MILLIS: u32 = 30_000; + +/// Whether the Update Agent commits the security revision after the +/// update. +const AGENT_COMMITS_SVN: bool = cfg!(svn_commit) || cfg!(svn_commit_refused); + +/// How long a request the device itself makes may take to be answered. +const REQUESTER_TIMEOUT_MILLIS: u32 = 5_000; + +/// Working buffer for one PLDM message. +const FD_BUF_SIZE: usize = 1024; + +/// Where the image lands on CS1, standing in for the managed device's boot +/// flash. A scratch region, erased at startup and overwritten without +/// backup: holding the image is what this test is for. +const IMAGE_BASE: u32 = 0x10_0000; + +/// Readback chunk used by `verify`, one SPI NOR page. +const READBACK_CHUNK: usize = 256; + +/// The FMC backend bound to this process's register mapping. +type Backend_ = Backend; + +/// How long the device waits for the RoT to command it. The RoT is a local +/// process with nothing to do but answer, so this bounds a deadlock rather +/// than budgeting work. +const DECISION_TIMEOUT_MILLIS: u64 = 5_000; + +/// Largest IPC frame either way on the RoT's channel. +const IPC_BUF_SIZE: usize = 128; + +/// The component the RoT is asked about. A PLDM component identifier, not +/// an orchestrator `ComponentId`: the RoT maps one to the other, and this +/// side of the channel speaks PLDM. +const ORCH_TARGET: u16 = COMP_IDENTIFIER; + +/// Which way the RoT answered the decision the device was waiting on. +#[derive(Clone, Copy, PartialEq, Eq)] +enum Decision { + Perform, + Reject, +} + +/// Where the device is in the update, as `QueryStatus` reports it. +/// +/// The first four are points DSP0267 already lets the Firmware Device take +/// time at, which is why the device can sit at one serving its channel +/// instead of running the update. `Failed` is not a wait: the device has +/// already told the Update Agent the phase failed, and raises the signal +/// once so the RoT hears the same thing. +/// +/// There is no step for "verify succeeded". Asking for apply is that: the +/// device only reaches `Apply` after reading the image back and finding it +/// whole, so `ApplyPending` is the device's verdict and `PhaseFailed` is +/// the other half of it. +#[derive(Clone, Copy, PartialEq, Eq)] +enum Awaiting { + Nothing, + Offer, + Verify, + Apply, + Activation, + Failed, + /// The Update Agent withdrew. Waiting for the RoT to acknowledge. + Cancelled, + /// The Update Agent requested that the running image's security + /// revision be committed, and the RoT has not answered yet. + SvnCommit, +} + +impl Awaiting { + /// What `QueryStatus` answers at this step. + fn status(self, total: u32) -> FdStatus { + match self { + Awaiting::Nothing => FdStatus::Idle { reason: 0 }, + Awaiting::Offer => FdStatus::OfferPending { + target: ORCH_TARGET, + total, + // The device pulls its own chunks from the Update Agent, + // which is what DSP0267 has a Firmware Device do. + mode: TransferMode::InTransport, + svn_delayed: false, + }, + Awaiting::Verify => FdStatus::VerifyPending, + Awaiting::Apply => FdStatus::ApplyPending, + Awaiting::Activation => FdStatus::ActivationPending, + // All report_failure() callers are in verify today, so phase + // 0 is correct. If a non-verify caller appears, this needs a + // field on Awaiting::Failed. + Awaiting::Cancelled => FdStatus::Cancelled, + Awaiting::SvnCommit => FdStatus::SvnCommitPending { + component: ORCH_TARGET, + }, + Awaiting::Failed => FdStatus::PhaseFailed { + phase: 0, + result_code: 1, + }, + } + } +} + +/// The byte the Update Agent is expected to send at `offset`. Checking +/// the content, not just the length, is what makes a silent truncation +/// or a misordered window fail rather than pass. +fn expected_byte(offset: usize) -> u8 { + (offset % 251) as u8 +} + +/// Staging, plus what the run loop needs to judge the outcome afterwards. +struct QemuFdOps { + flash: RefCell>, + bytes_received: Cell, + corrupt: Cell, + /// The RoT acknowledged a cancel. Lets the device return to idle. + cancel_acked: Cell, + /// Why the RoT refused, if it did. + reject_reason: Cell>, + /// Set when the RoT lets the security revision commit go through. + svn_committed: Cell, + /// Set when the RoT turns a security revision commit down. + svn_refused: Cell, + /// Chunks requested vs. received. Off by one when a transfer aborts: + /// the device asked for one more chunk than it got. + chunks_requested: Cell, + chunks_received: Cell, + verified: Cell, + activated: Cell, + /// A rendezvous pair, not two independent flags: `awaiting` is the + /// step `QueryStatus` reports, `decision` is the answer the serve loop + /// ends on. One outstanding at a time, because the device is not + /// running the update while it waits. + awaiting: Cell, + decision: Cell>, + /// Set when the RoT asked what this device is doing. The failure path + /// waits for one of these rather than for a command, because there is + /// nothing to command once a phase has failed. + status_asked: Cell, + /// Set when the RoT rejected a step. The run fails on this even if + /// PLDM itself was happy, because an update the RoT refused must not + /// look like a success. + refused: Cell, + /// Set when the channel itself broke: no signal, no answer, a command + /// for the wrong step. Kept apart from `refused` so a scenario that + /// claims the RoT refused cannot pass on an IPC that never happened. + ipc_failed: Cell, +} + +impl QemuFdOps { + fn new(flash: BlockingFlash) -> Self { + Self { + flash: RefCell::new(flash), + bytes_received: Cell::new(0), + corrupt: Cell::new(false), + cancel_acked: Cell::new(false), + reject_reason: Cell::new(None), + svn_committed: Cell::new(false), + svn_refused: Cell::new(false), + chunks_requested: Cell::new(0), + chunks_received: Cell::new(0), + verified: Cell::new(false), + activated: Cell::new(false), + awaiting: Cell::new(Awaiting::Nothing), + decision: Cell::new(None), + status_asked: Cell::new(false), + refused: Cell::new(false), + ipc_failed: Cell::new(false), + } + } + + /// Asks the RoT to decide `step` and blocks until it answers. + /// + /// The device raises the peer's `USER` signal and then serves its own + /// channel until a command lands. It is not running the update while it + /// waits, so serving here costs nothing: the RoT's `QueryStatus` is + /// answered from the same loop that is waiting for its command. + fn await_decision(&self, step: Awaiting) -> Decision { + match self.await_answer(step) { + Some(decision) => { + if decision == Decision::Reject { + self.refused.set(true); + } + decision + } + // The channel broke. Stop the update as a refusal would, + // but leave `refused` clear: the RoT never said no, so a + // scenario asserting a refusal cannot pass on this. + None => Decision::Reject, + } + } + + /// Waits for the RoT's decision. `None` means the channel broke: + /// nothing arrived before the deadline, which `ipc_failed` records. + /// + /// Leaves `refused` alone: the verdicts read `refused` as "the RoT + /// rejected the update", and the security revision commit is a + /// separate decision, taken after the image is installed. + fn await_answer(&self, step: Awaiting) -> Option { + if !self.serve(step, |ops| ops.decision.get().is_some()) { + self.ipc_failed.set(true); + return None; + } + + Some(self.decision.get().unwrap_or(Decision::Reject)) + } + + /// Tells the RoT a phase failed, and waits only long enough for it to + /// ask. Nothing is commanded after a failure, so waiting for a command + /// would wait forever. + fn report_failure(&self) { + if !self.serve(Awaiting::Failed, |ops| ops.status_asked.get()) { + self.ipc_failed.set(true); + } + } + + /// Raises the RoT's signal, then answers its requests until `done` or + /// the deadline. Returns whether `done` came true. + /// + /// The device is not running the update while it sits here, so serving + /// the channel from this loop costs nothing: the RoT's `QueryStatus` + /// is answered by the same loop that is waiting for its command. + fn serve(&self, step: Awaiting, done: impl Fn(&Self) -> bool) -> bool { + self.awaiting.set(step); + self.decision.set(None); + self.status_asked.set(false); + + if syscall::object_set_peer_user_signal(handle::ORCH, true).is_err() { + pw_log::error!("FD: could not raise the RoT's signal"); + self.awaiting.set(Awaiting::Nothing); + return false; + } + + let deadline = Instant::from_ticks( + SystemClock::now().ticks() + + DECISION_TIMEOUT_MILLIS * SystemClock::TICKS_PER_SEC / 1000, + ); + let mut request = [0u8; IPC_BUF_SIZE]; + let mut response = [0u8; IPC_BUF_SIZE]; + let mut answered = false; + + while !done(self) { + if syscall::object_wait(handle::ORCH, Signals::READABLE, deadline).is_err() { + pw_log::error!("FD: the RoT never answered"); + break; + } + let Ok(len) = syscall::channel_read(handle::ORCH, 0usize, &mut request) else { + continue; + }; + let mut gate = OrchGate { ops: self }; + // dispatch only errors when even an error frame will not fit, + // which IPC_BUF_SIZE rules out. Answering nothing would leave + // the RoT reading a truncated frame, so say so instead. + let written = match dispatch(&mut gate, &request[..len], &mut response) { + Ok(written) => written, + Err(_) => { + pw_log::error!("FD: {} byte IPC buffer is too small", IPC_BUF_SIZE as u32); + break; + } + }; + let _ = syscall::channel_respond(handle::ORCH, &response[..written]); + answered = true; + } + + // Leaving with a request unanswered strands the RoT's transaction: + // its buffers stay lent to the kernel and its next command fails. + // The loop above answers whatever it read, so this only has to + // cover the deadline case, where nothing was read at all. + let settled = done(self); + if !settled && answered { + pw_log::error!("FD: giving up with the RoT mid-exchange"); + } + + let _ = syscall::object_set_peer_user_signal(handle::ORCH, false); + // Single-threaded: nothing reads these between the two writes. + self.awaiting.set(Awaiting::Nothing); + settled + } + + /// True when the RoT allowed every step it was asked about, and the + /// channel worked. + fn orchestrator_consented(&self) -> bool { + !self.refused.get() && !self.ipc_failed.get() + } + + fn image_is_good(&self) -> bool { + self.verified.get() && !self.corrupt.get() && self.bytes_received.get() == IMAGE_SIZE + } +} + +/// The RoT's view of this device: one method per command it can send. +/// +/// Every method records a decision and returns. Nothing here runs the +/// update; the `FdOps` call that is waiting picks the decision up and +/// carries on. +struct OrchGate<'a> { + ops: &'a QemuFdOps, +} + +impl OrchGate<'_> { + /// Records `decision` if the device is waiting on `step`, and refuses + /// otherwise. A command for a step the device is not at is a bug in + /// the RoT, not something to act on. + fn answer(&self, step: Awaiting, decision: Decision) -> Result<(), ResponseCode> { + if self.ops.awaiting.get() != step { + pw_log::error!("FD: a command arrived for a step this device is not at"); + self.ops.ipc_failed.set(true); + return Err(ResponseCode::InvalidOp); + } + self.ops.decision.set(Some(decision)); + Ok(()) + } + + /// The device never reaches this step in this scenario, so being + /// commanded here means the RoT thinks it is somewhere it is not. + fn not_reached(&self) -> Result<(), ResponseCode> { + pw_log::error!("FD: commanded a step this scenario never reaches"); + self.ops.ipc_failed.set(true); + Err(ResponseCode::InvalidOp) + } +} + +impl FdIpcHandler for OrchGate<'_> { + fn accept_offer(&mut self, _staging_base: u32) -> Result<(), ResponseCode> { + self.answer(Awaiting::Offer, Decision::Perform) + } + + fn reject_offer(&mut self, reason: RejectReason) -> Result<(), ResponseCode> { + self.ops.reject_reason.set(Some(reason)); + self.answer(Awaiting::Offer, Decision::Reject) + } + + fn perform_verify(&mut self) -> Result<(), ResponseCode> { + self.answer(Awaiting::Verify, Decision::Perform) + } + + fn reject_verify(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + self.answer(Awaiting::Verify, Decision::Reject) + } + + fn perform_apply(&mut self) -> Result<(), ResponseCode> { + self.answer(Awaiting::Apply, Decision::Perform) + } + + fn reject_apply(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + self.answer(Awaiting::Apply, Decision::Reject) + } + + fn perform_activate(&mut self) -> Result<(), ResponseCode> { + self.answer(Awaiting::Activation, Decision::Perform) + } + + fn reject_activate(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + self.answer(Awaiting::Activation, Decision::Reject) + } + + fn query_status(&mut self) -> Result { + self.ops.status_asked.set(true); + Ok(self.ops.awaiting.get().status(IMAGE_SIZE as u32)) + } + + fn ack_cancel(&mut self) -> Result<(), ResponseCode> { + if self.ops.awaiting.get() != Awaiting::Cancelled { + return self.not_reached(); + } + self.ops.cancel_acked.set(true); + Ok(()) + } + + fn perform_svn_commit(&mut self) -> Result<(), ResponseCode> { + self.answer(Awaiting::SvnCommit, Decision::Perform) + } + + fn reject_svn_commit(&mut self, _reason: RejectReason) -> Result<(), ResponseCode> { + self.answer(Awaiting::SvnCommit, Decision::Reject) + } +} + +impl FdOps for QemuFdOps { + fn get_device_identifiers( + &self, + device_identifiers: &mut [Descriptor], + ) -> Result { + board_fd_ops::device_identifiers(device_identifiers, &DEVICE_UUID) + } + + fn get_firmware_parms( + &self, + firmware_params: &mut FirmwareParameters, + ) -> Result<(), FdOpsError> { + board_fd_ops::firmware_parameters( + firmware_params, + COMP_IDENTIFIER, + ACTIVE_COMP_VERSION, + ACTIVE_IMAGE_SET_VERSION, + ) + } + + fn query_download_progress( + &self, + _component: &FirmwareComponent, + progress_percent: &mut ProgressPercent, + ) -> Result<(), FdOpsError> { + board_fd_ops::download_progress(self.bytes_received.get(), IMAGE_SIZE, progress_percent) + } + + fn get_xfer_size(&self, ua_transfer_size: usize) -> Result { + Ok(ua_transfer_size.min(MAX_TRANSFER_SIZE)) + } + + fn is_download_complete(&self, _component: &FirmwareComponent) -> bool { + self.bytes_received.get() >= IMAGE_SIZE + } + + fn handle_component( + &self, + component: &FirmwareComponent, + fw_params: &FirmwareParameters, + op: ComponentOperation, + ) -> Result { + let code = component.evaluate_update_eligibility(fw_params); + if code != ComponentResponseCode::CompCanBeUpdated { + pw_log::error!("FD: component refused, code {}", code as u32); + return Ok(code); + } + // The agent asks twice, once to pass the component table and once + // to start the component. The RoT is asked on the second: that is + // the one that commits to a transfer, and asking twice would have + // it record the job and then refuse its own job as already in + // flight. + if op == ComponentOperation::UpdateComponent + && self.await_decision(Awaiting::Offer) == Decision::Reject + { + pw_log::error!("FD: the RoT refused the offer"); + return Ok(ComponentResponseCode::CompNotSupported); + } + Ok(code) + } + + fn query_download_offset_and_length( + &self, + _component: &FirmwareComponent, + ) -> Result<(usize, usize), FdOpsError> { + // The state machine keeps no cursor of its own: whatever this + // returns is the offset of the next RequestFirmwareData. + self.chunks_requested.set(self.chunks_requested.get() + 1); + let done = self.bytes_received.get(); + Ok((done, IMAGE_SIZE - done)) + } + + fn download_fw_data( + &self, + offset: usize, + data: &[u8], + _component: &FirmwareComponent, + ) -> Result { + let done = self.bytes_received.get(); + if offset < done { + // A retry re-delivers a window already staged. Accepting it + // without rewriting keeps the cursor honest. + return Ok(TransferResult::TransferSuccess); + } + if offset > done { + self.corrupt.set(true); + pw_log::error!( + "FD: gap at offset {}, expected {}", + offset as u32, + done as u32 + ); + return Ok(TransferResult::FdAbortedTransfer); + } + if offset + data.len() > IMAGE_SIZE { + self.corrupt.set(true); + pw_log::error!("FD: window past the end of the image"); + return Ok(TransferResult::FdAbortedTransfer); + } + for (i, byte) in data.iter().enumerate() { + if *byte != expected_byte(offset + i) { + self.corrupt.set(true); + pw_log::error!("FD: byte {} is wrong", (offset + i) as u32); + return Ok(TransferResult::FdAbortedTransfer); + } + } + // Written only after the content check, so a wrong byte never + // reaches flash and the image on the device stays whatever it was. + if let Err(e) = self + .flash + .borrow_mut() + .program(FlashAddress::new(IMAGE_BASE + offset as u32), data) + { + self.corrupt.set(true); + pw_log::error!( + "FD: program at {} failed: {:08x}", + offset as u32, + e.0.get() as u32 + ); + return Ok(TransferResult::FdAbortedTransfer); + } + self.bytes_received.set(done + data.len()); + self.chunks_received.set(self.chunks_received.get() + 1); + Ok(TransferResult::TransferSuccess) + } + + fn verify( + &self, + _component: &FirmwareComponent, + _progress_percent: &mut ProgressPercent, + ) -> Result { + if self.corrupt.get() || self.bytes_received.get() < IMAGE_SIZE { + pw_log::error!( + "FD: image incomplete, {} bytes", + self.bytes_received.get() as u32 + ); + self.report_failure(); + return Ok(VerifyResult::VerifyGenericError); + } + + if self.await_decision(Awaiting::Verify) == Decision::Reject { + // No report: the RoT refused this itself and knows the outcome. + pw_log::error!("FD: the RoT refused the verify"); + return Ok(VerifyResult::VerifyGenericError); + } + + // Read the image back out of flash rather than trusting the + // running tally. A write that silently did not land, or landed + // somewhere else, fails here instead of passing. Signature + // checking belongs to the crypto service and is stubbed until + // until the crypto service exists, so this is a content check. + let mut flash = self.flash.borrow_mut(); + let mut chunk = [0u8; READBACK_CHUNK]; + for base in (0..IMAGE_SIZE).step_by(READBACK_CHUNK) { + if let Err(e) = flash.read(FlashAddress::new(IMAGE_BASE + base as u32), &mut chunk) { + pw_log::error!( + "FD: read at {} failed: {:08x}", + base as u32, + e.0.get() as u32 + ); + drop(flash); + self.report_failure(); + return Ok(VerifyResult::VerifyGenericError); + } + for (i, byte) in chunk.iter().enumerate() { + if *byte != expected_byte(base + i) { + pw_log::error!("FD: flash byte {} is wrong", (base + i) as u32); + drop(flash); + self.report_failure(); + return Ok(VerifyResult::VerifyGenericError); + } + } + } + + self.verified.set(true); + pw_log::info!("FD: image verified in flash, {} bytes", IMAGE_SIZE as u32); + Ok(VerifyResult::VerifySuccess) + } + + fn apply( + &self, + _component: &FirmwareComponent, + _progress_percent: &mut ProgressPercent, + ) -> Result { + if self.await_decision(Awaiting::Apply) == Decision::Reject { + pw_log::error!("FD: the RoT refused the apply"); + return Ok(ApplyResult::ApplyGenericError); + } + Ok(ApplyResult::ApplySuccess) + } + + fn activate( + &self, + _self_contained_activation: u8, + estimated_time: &mut u16, + ) -> Result { + // Nothing is deferred, so the Update Agent is told to expect no + // wait. + *estimated_time = 0; + if self.await_decision(Awaiting::Activation) == Decision::Reject { + pw_log::error!("FD: the RoT refused the activation"); + return Ok(PldmBaseCompletionCode::Error as u8); + } + self.activated.set(true); + pw_log::info!("FD: activated"); + Ok(PldmBaseCompletionCode::Success as u8) + } + + /// Nothing in this scenario has a pending image to activate. + fn handle_pending_component( + &self, + _component: &PendingComponent, + _fw_params: &FirmwareParameters, + ) -> Result { + Ok(PendingComponentResult::NotPermitted) + } + + /// The new image goes to staging, not over the running one, so the + /// component keeps working whatever happens to the update. + fn get_non_functional_component_info( + &self, + ) -> Result< + ( + NonFunctioningComponentIndication, + NonFunctioningComponentBitmap, + ), + FdOpsError, + > { + Ok(( + NonFunctioningComponentIndication::ComponentsFunctioning, + NonFunctioningComponentBitmap::new(0), + )) + } + + /// The agent asks the device to commit the security revision of what + /// it is running. The RoT owns that decision, so this waits for it the + /// way every other step does. + fn update_security_revision( + &self, + _component: &SecurityRevisionComponent, + _fw_params: &FirmwareParameters, + ) -> Result { + if self.await_answer(Awaiting::SvnCommit) != Some(Decision::Perform) { + // Info, not error: in `svn_commit_refused` this refusal is + // what the run passes on. + pw_log::info!("FD: the RoT refused the security revision commit"); + self.svn_refused.set(true); + return Ok(SecurityRevisionResult::NotPermitted); + } + self.svn_committed.set(true); + pw_log::info!("FD: the security revision was committed"); + Ok(SecurityRevisionResult::Updated) + } + + /// The agent withdrew. Reports Cancelled to the RoT and blocks until + /// acknowledged. The device is idle here, so serving the channel + /// inline is fine. + fn cancel_update_component(&self, _component: &FirmwareComponent) -> Result<(), FdOpsError> { + pw_log::info!("FD: the agent cancelled the update"); + if !self.serve(Awaiting::Cancelled, |ops| ops.cancel_acked.get()) { + pw_log::error!("FD: the RoT never acknowledged the cancel"); + self.ipc_failed.set(true); + } + Ok(()) + } + + /// The device's clock, which every FD timer is measured against. The + /// trait's default returns a constant, so without this the FD_T1 and + /// FD_T2 windows never elapse and a retry never comes. + fn now(&self) -> PldmFdTime { + now_millis() + } +} + +/// Brings up the FMC and erases the sector the image lands in. +/// +/// The kernel applied the FMC pinmux before any process started, so there +/// is no SCU access here. +fn init_flash( + fmc_regs: Region, + fmc_cs0_window: Region, + fmc_cs1_window: Region, +) -> Result, ErrorCode> { + let driver = Backend::new(fmc_regs, fmc_cs0_window, fmc_cs1_window)?; + let mut flash = BlockingFlash { + driver, + blocking: NoWaitBlocking, + }; + let (capacity, sector, _) = flash.geometry()?; + pw_log::info!( + "FD: CS1 is {} bytes, {} byte sectors", + capacity.get() as u32, + sector.get() as u32 + ); + flash.erase(FlashAddress::new(IMAGE_BASE), sector)?; + Ok(flash) +} + +#[entry] +fn entry() { + pw_log::info!("FD: app started"); + + // SAFETY: mints this process's memory mappings once, at its entry point. + let mmaps = unsafe { take_mmaps() }; + let flash = match init_flash(mmaps.fmc_regs, mmaps.fmc_cs0_window, mmaps.fmc_cs1_window) { + Ok(flash) => flash, + Err(e) => { + pw_log::error!("FD: flash init failed: {:08x}", e.0.get() as u32); + let _ = syscall::debug_shutdown(Err(Error::Internal)); + loop {} + } + }; + let fd_ops = QemuFdOps::new(flash); + + // Both transports reach the same MCTP server over the same channel. + // Nothing is in flight on both at once: run_terminus alternates its + // initiator and responder phases from this one thread. + let responder_transport = MctpPldmTransport::new(IpcMctpClient::new(handle::MCTP)); + let requester_transport = MctpPldmTransport::new(IpcMctpClient::new(handle::MCTP)); + + if responder_transport.stack().set_eid(FD_EID).is_err() { + pw_log::error!("FD: set_eid failed"); + let _ = syscall::debug_shutdown(Err(Error::Internal)); + loop {} + } + + let mut fd = FirmwareDevice::init( + &fd_ops, + &pldm_interface::config::PLDM_PROTOCOL_CAPABILITIES, + responder_transport, + requester_transport, + ); + + pw_log::info!("FD: waiting for the update agent at EID {}", UA_EID as u32); + + let mut buf = [0u8; FD_BUF_SIZE]; + match fd.run_terminus( + UA_EID, + &mut buf, + IDLE_TIMEOUT_MILLIS, + REQUESTER_TIMEOUT_MILLIS, + &mut (), + ) { + RunTerminusResult::Completed => {} + RunTerminusResult::StoppedByError(PldmServiceError::Mctp(e)) => { + pw_log::error!("FD: run_terminus stopped, MCTP code {}", e.code as u32); + } + RunTerminusResult::StoppedByError(_) => { + pw_log::error!("FD: run_terminus stopped on a PLDM error"); + } + } + + // `run_terminus` returns when the device leaves update mode, which the + // activation does. UpdateSecurityRevision is an idle-mode command, so + // the device calls `run_terminus` a second time to serve it. That call + // takes however many UpdateSecurityRevision requests the Update Agent + // sends, and ends on the idle timeout. + if AGENT_COMMITS_SVN { + pw_log::info!("FD: idle, waiting for the agent to commit the revision"); + let _ = fd.run_terminus( + UA_EID, + &mut buf, + IDLE_TIMEOUT_MILLIS, + REQUESTER_TIMEOUT_MILLIS, + &mut (), + ); + } + + let completed = + fd_ops.image_is_good() && fd_ops.activated.get() && fd_ops.orchestrator_consented(); + + // A scenario whose claim is about the device alone ends here. One + // whose claim is about what the RoT did with the device cannot: this + // app sees its own PLDM flow finish and nothing of the reset that + // follows, so it would report success while the RoT was still + // waiting. + if cfg!(rot_owns_verdict) { + if verdict(&fd_ops, completed) { + pw_log::info!("FD: the device's own flow is done"); + } else { + pw_log::error!("FD: the device's own flow did not complete"); + } + } else if verdict(&fd_ops, completed) { + let _ = syscall::debug_shutdown(Ok(())); + } else { + let _ = syscall::debug_shutdown(Err(Error::Internal)); + } + loop {} +} + +/// Whether the run did what this scenario asked of it. +/// +/// A negative scenario does not just expect the update to fail. It names +/// the failure it arranged, because a run that died of something else +/// would otherwise look like the thing being proven. +#[cfg(not(any( + corrupt_image, + refused_update, + transfer_error, + cancel_mid_transfer, + offer_before_supervising, + retry_chunk, + svn_commit, + svn_commit_refused +)))] +fn verdict(fd_ops: &QemuFdOps, completed: bool) -> bool { + if completed { + pw_log::info!("FD: update flow complete"); + return true; + } + pw_log::error!( + "FD: update flow did not complete, {} bytes received", + fd_ops.bytes_received.get() as u32 + ); + false +} + +/// One byte of the image the Update Agent sent was flipped, so the +/// device must have caught it and the update must not have gone through. +#[cfg(corrupt_image)] +fn verdict(fd_ops: &QemuFdOps, completed: bool) -> bool { + if completed { + pw_log::error!("FD: a corrupt image went through"); + return false; + } + if !fd_ops.corrupt.get() { + pw_log::error!("FD: the run failed, but not because of the corrupt byte"); + return false; + } + pw_log::info!("FD: the corrupt image was caught and the update refused"); + true +} + +/// The agent asked to commit the security revision after the update. The +/// update has to have completed, and the RoT has to have allowed the +/// commit. +#[cfg(svn_commit)] +fn verdict(fd_ops: &QemuFdOps, completed: bool) -> bool { + // Checked first, because this scenario is about the commit. A refused + // commit also fails the update's own check, and reporting that would + // point at the wrong thing. + if !fd_ops.svn_committed.get() { + pw_log::error!("FD: the security revision was not committed"); + return false; + } + if !completed { + pw_log::error!("FD: the revision was committed and the update was not"); + return false; + } + pw_log::info!("FD: the image was activated and its security revision committed"); + true +} + +/// The agent sent the request twice, as after a lost answer. The first +/// must be granted and the second refused: the floor already took the SVN. +#[cfg(svn_commit_refused)] +fn verdict(fd_ops: &QemuFdOps, completed: bool) -> bool { + if !fd_ops.svn_committed.get() { + pw_log::error!("FD: the first security revision commit was not granted"); + return false; + } + if !fd_ops.svn_refused.get() { + pw_log::error!("FD: the second security revision commit was not refused"); + return false; + } + if !completed { + pw_log::error!("FD: the revision was committed and the update was not"); + return false; + } + pw_log::info!("FD: the second commit of the same revision was refused"); + true +} + +/// The RoT was not supervising when the offer arrived. It must have refused +/// as Busy (not policy), and nothing may have been staged or activated. +#[cfg(offer_before_supervising)] +fn verdict(fd_ops: &QemuFdOps, completed: bool) -> bool { + if completed { + pw_log::error!("FD: the update went through with the RoT supervising nothing"); + return false; + } + if fd_ops.reject_reason.get() != Some(RejectReason::Busy) { + pw_log::error!("FD: the offer was turned down, but not as busy"); + return false; + } + if fd_ops.activated.get() { + pw_log::error!("FD: the offer was refused and the device activated anyway"); + return false; + } + pw_log::info!("FD: the RoT was not supervising and the offer was refused"); + true +} + +/// The agent withdrew mid-transfer. The device must have been cancelled, +/// reported it, and been acknowledged. +#[cfg(cancel_mid_transfer)] +fn verdict(fd_ops: &QemuFdOps, completed: bool) -> bool { + if completed { + pw_log::error!("FD: the update completed after it was cancelled"); + return false; + } + if !fd_ops.cancel_acked.get() { + pw_log::error!("FD: the run stopped without the RoT acknowledging a cancel"); + return false; + } + if fd_ops.activated.get() { + pw_log::error!("FD: the update was cancelled and the device activated anyway"); + return false; + } + pw_log::info!("FD: the cancel was acknowledged and nothing was activated"); + true +} + +/// The agent answered one RequestFirmwareData with RetryRequestFwData, so +/// the update must still have gone through. +#[cfg(retry_chunk)] +fn verdict(fd_ops: &QemuFdOps, completed: bool) -> bool { + // One more request than delivery: the retried window is asked for + // twice and answered with data once. + let requested = fd_ops.chunks_requested.get(); + let received = fd_ops.chunks_received.get(); + if requested != received + 1 { + pw_log::error!( + "FD: {} chunks asked for and {} received, so no window was requested twice", + requested as u32, + received as u32 + ); + return false; + } + if !completed { + pw_log::error!("FD: the retry was asked for and the update did not complete"); + return false; + } + pw_log::info!( + "FD: one window was requested twice and the update completed, {} chunks in all", + requested as u32 + ); + true +} + +/// The agent errored on one chunk. The device must have aborted the +/// transfer with one more chunk requested than received. +#[cfg(transfer_error)] +fn verdict(fd_ops: &QemuFdOps, completed: bool) -> bool { + if completed { + pw_log::error!("FD: the update went through with a chunk missing"); + return false; + } + let requested = fd_ops.chunks_requested.get(); + let received = fd_ops.chunks_received.get(); + if requested != received + 1 { + pw_log::error!( + "FD: the run failed with {} chunks asked for and {} received, which is not one short", + requested as u32, + received as u32 + ); + return false; + } + if fd_ops.corrupt.get() { + pw_log::error!("FD: the transfer ended on a content check, not the agent's error"); + return false; + } + if fd_ops.activated.get() { + pw_log::error!("FD: the transfer aborted and the device activated anyway"); + return false; + } + pw_log::info!( + "FD: the agent errored on chunk {} and the device aborted the transfer", + requested as u32 + ); + true +} + +/// The orchestrator refused, so nothing it was asked may have been +/// accepted, and the update must not have gone through. +#[cfg(refused_update)] +fn verdict(fd_ops: &QemuFdOps, completed: bool) -> bool { + if completed { + pw_log::error!("FD: the update went through without consent"); + return false; + } + if fd_ops.orchestrator_consented() { + pw_log::error!("FD: the orchestrator refused the request but agreed to something else"); + return false; + } + pw_log::info!("FD: the orchestrator withheld consent and the update did not happen"); + true +} + +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + loop {} +} diff --git a/target/ast10x0/tests/integration/pldm_update/pldm_ua_main.rs b/target/ast10x0/tests/integration/pldm_update/pldm_ua_main.rs new file mode 100644 index 000000000..546637985 --- /dev/null +++ b/target/ast10x0/tests/integration/pldm_update/pldm_ua_main.rs @@ -0,0 +1,768 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! The PLDM Update Agent: the BMC's half of the update. +//! +//! Stimulus for the Firmware Device, not a second root of trust. It walks +//! the whole DSP0267 sequence: it discovers the terminus with `GetPLDMTypes`, +//! `GetPLDMVersion` and `GetPLDMCommands`, identifies the device with +//! `QueryDeviceIdentifiers` and `GetFirmwareParameters`, hands over an image +//! with `RequestUpdate`, `PassComponentTable` and `UpdateComponent`, answers +//! the requests the Firmware Device raises on its own while it pulls the image +//! down, and finishes with `ActivateFirmware`. +//! +//! There is no Update Agent in the PLDM service (it is a Firmware Device only), +//! so the sequence below is written out by hand. +//! +//! Lifted from `target/ast10x0/tests/pldm/firmware_update/ua_main.rs`, which +//! does the same against a second card over I2C. Only the endpoint ids, the +//! device UUID and the channel differ; the sequence is the same because the +//! protocol is. + +#![no_main] +#![no_std] + +use core::cell::Cell; + +use openprot_mctp_client_ipc::IpcMctpClient; +use openprot_pldm_service::error::PldmMemError; +use openprot_pldm_service::{MctpPldmTransport, PldmServiceError}; +use pldm_common::codec::{PldmCodec, PldmCodecWithLifetime}; +use pldm_common::message::control::{ + is_bit_set, GetPldmCommandsRequest, GetPldmCommandsResponse, GetPldmTypeRequest, + GetPldmTypeResponse, GetPldmVersionRequest, GetPldmVersionResponse, +}; +use pldm_common::message::firmware_update::activate_fw::{ + ActivateFirmwareRequest, SelfContainedActivationRequest, +}; +use pldm_common::message::firmware_update::apply_complete::ApplyCompleteResponse; +use pldm_common::message::firmware_update::get_fw_params::{ + GetFirmwareParametersRequest, GetFirmwareParametersResponse, +}; +use pldm_common::message::firmware_update::pass_component::PassComponentTableRequest; +use pldm_common::message::firmware_update::query_devid::{ + QueryDeviceIdentifiersRequest, QueryDeviceIdentifiersResponse, +}; +use pldm_common::message::firmware_update::request_cancel::CancelUpdateRequest; +use pldm_common::message::firmware_update::request_fw_data::{ + RequestFirmwareDataRequest, RequestFirmwareDataResponse, MAX_TRANSFER_SIZE, +}; +use pldm_common::message::firmware_update::request_update::RequestUpdateRequest; +use pldm_common::message::firmware_update::transfer_complete::{ + TransferCompleteRequest, TransferCompleteResponse, TransferResult, +}; +use pldm_common::message::firmware_update::update_component::UpdateComponentRequest; +use pldm_common::message::firmware_update::update_security_revision::UpdateSecurityRevisionRequest; +use pldm_common::message::firmware_update::verify_complete::VerifyCompleteResponse; +use pldm_common::protocol::base::{ + PldmBaseCompletionCode, PldmControlCmd, PldmMsgHeader, PldmMsgType, PldmSupportedType, + TransferOperationFlag, TransferRespFlag, +}; +use pldm_common::protocol::firmware_update::{ + ComponentClassification, DescriptorType, FwUpdateCmd, PldmFirmwareString, UpdateOptionFlags, + VersionStringType, PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN, +}; +use pldm_common::protocol::version::Ver32; +use pw_status::Error; +use userspace::{entry, syscall}; + +use app_pldm_ua::handle; + +/// This card's EID, matching the MCTP server app underneath it. +const UA_EID: u8 = 42; +/// The EID the Firmware Device answers on, matching the other side of the +/// bus. +const FD_EID: u8 = 8; + +/// Size of the test image, in bytes. Must match the size the Firmware +/// Device expects. +const IMAGE_SIZE: u32 = 1024; + +/// The component the device offers, which is also the one whose security +/// revision the Update Agent requests to commit. Must match the identifier +/// the Firmware Device reports. +const COMP_IDENTIFIER: u16 = 0x0001; + +/// How many UpdateSecurityRevision requests this agent sends once the +/// update is done. The second is the retry after a lost answer, which the +/// device refuses. +const SVN_COMMIT_REQUESTS: usize = if cfg!(svn_commit_refused) { + 2 +} else if cfg!(svn_commit) { + 1 +} else { + 0 +}; + +/// The UUID this agent expects the Firmware Device to report. It only updates +/// a device it recognises. +const DEVICE_UUID: [u8; 16] = [ + 0x4f, 0x50, 0x52, 0x4f, 0x54, 0x2d, 0x51, 0x45, 0x4d, 0x55, 0x2d, 0x4d, 0x4f, 0x43, 0x4b, 0x01, +]; + +/// Comparison stamp offered for the new image. Must beat the stamp the device +/// reports for its running firmware or the component is refused. +const COMP_COMPARISON_STAMP: u32 = 1; + +/// Offset of the byte the negative scenario flips. Inside the image and +/// not on a window boundary, so it is the content check that catches it +/// rather than a length check. +#[cfg(corrupt_image)] +const CORRUPT_OFFSET: usize = 700; + +/// The byte the Update Agent actually sends at `offset`. The same +/// everywhere except in the negative scenario, which flips one, so the +/// device has something to catch. +#[cfg(not(corrupt_image))] +fn corrupted(_offset: usize, byte: u8) -> u8 { + byte +} + +#[cfg(corrupt_image)] +fn corrupted(offset: usize, byte: u8) -> u8 { + if offset == CORRUPT_OFFSET { + !byte + } else { + byte + } +} + +/// Returns an error code for a specific chunk, or `None` to send data. +#[cfg(not(any(transfer_error, retry_chunk)))] +fn chunk_error(_chunk: u32) -> Option { + None +} + +/// Answers chunk 2 with `RetryRequestFwData`, which is not a failure: the +/// device waits out FD_T2, asks for the same window again, and the update +/// goes through anyway. Chunk 2 puts the retry mid-transfer rather than at +/// either end, and it fires once because the re-request counts as a later +/// chunk. +#[cfg(retry_chunk)] +fn chunk_error(chunk: u32) -> Option { + use pldm_common::protocol::firmware_update::FwUpdateCompletionCode; + + (chunk == 2).then_some(FwUpdateCompletionCode::RetryRequestFwData as u8) +} + +/// Errors on chunk 2: not the first (the transfer has to be running), and +/// a plain error, not `RetryRequestFwData` (the device would just retry). +#[cfg(transfer_error)] +fn chunk_error(chunk: u32) -> Option { + (chunk == 2).then_some(PldmBaseCompletionCode::Error as u8) +} + +/// Returns true when the Update Agent should withdraw after this many +/// chunks. +#[cfg(not(cancel_mid_transfer))] +fn cancel_after(_chunk: u32) -> bool { + false +} + +/// Withdraws after chunk 2: far enough that the transfer is running, short +/// enough that there is something to cancel. +#[cfg(cancel_mid_transfer)] +fn cancel_after(chunk: u32) -> bool { + chunk == 2 +} + +/// How many times the Update Agent sends a discovery request before +/// giving up. The device may still be claiming its endpoint id on the +/// first try. +const DISCOVERY_ATTEMPTS: u32 = 5; + +/// Number of sends of UpdateSecurityRevision messages before giving up. +/// The device is not listening right after update mode, so the first +/// send can be dropped. +const SECURITY_REVISION_ATTEMPTS: u32 = 3; + +/// Lowest firmware-update version the Update Agent accepts: 1.3.0, +/// BCD-encoded. The sequence below uses this version's command set. +const MIN_FWUPDATE_VERSION: Ver32 = 0xF1F3F000; + +/// Firmware-update commands the sequence uses: six agent-initiated, four +/// device-initiated. All ten must be present before the Update Agent +/// starts. +const REQUIRED_FWUPDATE_CMDS: [u8; 10] = [ + FwUpdateCmd::QueryDeviceIdentifiers as u8, + FwUpdateCmd::GetFirmwareParameters as u8, + FwUpdateCmd::RequestUpdate as u8, + FwUpdateCmd::PassComponentTable as u8, + FwUpdateCmd::UpdateComponent as u8, + FwUpdateCmd::RequestFirmwareData as u8, + FwUpdateCmd::TransferComplete as u8, + FwUpdateCmd::VerifyComplete as u8, + FwUpdateCmd::ApplyComplete as u8, + FwUpdateCmd::ActivateFirmware as u8, +]; + +/// How long each UA-initiated request waits for the Firmware Device to +/// reply. +const REQUEST_TIMEOUT_MILLIS: u32 = 5_000; +/// How long the UA waits for each firmware-device-initiated request. +const SERVE_TIMEOUT_MILLIS: u32 = 30_000; + +/// Upper bound on firmware-device-initiated requests served before giving up. +/// A clean run is ceil(IMAGE_SIZE / MAX_TRANSFER_SIZE) RequestFirmwareData plus +/// TransferComplete, VerifyComplete, and ApplyComplete. +const MAX_SERVED_REQUESTS: u32 = 64; + +const UA_BUF_SIZE: usize = 1024; + +/// The byte the test image carries at `offset`. The Firmware Device generates +/// the same sequence and rejects anything that does not match. +fn expected_byte(offset: usize) -> u8 { + (offset % 251) as u8 +} + +/// Build a fixed-size PLDM firmware version string. +fn fw_string(s: &str) -> PldmFirmwareString { + let bytes = s.as_bytes(); + let mut str_data = [0u8; PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN]; + let len = bytes.len().min(PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN); + str_data[..len].copy_from_slice(&bytes[..len]); + PldmFirmwareString { + str_type: VersionStringType::Ascii as u8, + str_len: len as u8, + str_data, + } +} + +/// State the serving loop accumulates from the device's requests. +#[derive(Default)] +struct Served { + /// The device reported apply-complete. Ends the serving loop. + apply_complete: Cell, + /// The device aborted the transfer. Nothing to activate. + aborted: Cell, + /// Chunks answered so far. `chunk_error()` keys on this count. + chunks: Cell, +} + +/// Answer one firmware-device-initiated request in place. +/// +/// `framed_buf[0]` is the MCTP type byte and the request occupies +/// `framed_buf[1..req_total_len]`; the response is written back over +/// `framed_buf[1..]`. Returns the total response length including the type +/// byte, and updates `served` with what the device reported. +fn serve_fd_request( + framed_buf: &mut [u8], + req_total_len: usize, + served: &Served, +) -> Result { + let success = PldmBaseCompletionCode::Success as u8; + + // Decode to owned values first so the response can be written back over + // the same buffer. + let (instance_id, cmd, fw_window) = { + let payload = &framed_buf[1..req_total_len]; + let Ok(header) = PldmMsgHeader::<[u8; 3]>::decode(payload) else { + pw_log::error!("UA: could not decode FD request header"); + return Ok(0); + }; + let cmd = header.cmd_code(); + let fw_window = if cmd == FwUpdateCmd::RequestFirmwareData as u8 { + match RequestFirmwareDataRequest::decode(payload) { + Ok(req) => Some((req.offset as usize, req.length as usize)), + Err(_) => { + pw_log::error!("UA: could not decode RequestFirmwareData"); + return Ok(0); + } + } + } else { + None + }; + (header.instance_id(), cmd, fw_window) + }; + + let resp = &mut framed_buf[1..]; + let resp_len = match FwUpdateCmd::try_from(cmd) { + Ok(FwUpdateCmd::RequestFirmwareData) => { + let Some((offset, length)) = fw_window else { + return Ok(0); + }; + if length > MAX_TRANSFER_SIZE { + pw_log::error!("UA: FD asked for {} bytes, over the MTU", length as u32); + return Ok(0); + } + served.chunks.set(served.chunks.get() + 1); + if let Some(code) = chunk_error(served.chunks.get()) { + pw_log::info!( + "UA: answering chunk {} with completion code {:02x} instead of data", + served.chunks.get() as u32, + code as u32 + ); + let msg = RequestFirmwareDataResponse::new(instance_id, code, &[]); + PldmCodecWithLifetime::encode(&msg, resp) + } else { + let mut chunk = [0u8; MAX_TRANSFER_SIZE]; + for (i, byte) in chunk[..length].iter_mut().enumerate() { + *byte = corrupted(offset + i, expected_byte(offset + i)); + } + let msg = RequestFirmwareDataResponse::new(instance_id, success, &chunk[..length]); + PldmCodecWithLifetime::encode(&msg, resp) + } + } + Ok(FwUpdateCmd::TransferComplete) => { + // Always ack; what happens next depends on the transfer result. + match TransferCompleteRequest::decode(&framed_buf[1..req_total_len]) { + Ok(req) if req.tranfer_result != TransferResult::TransferSuccess as u8 => { + pw_log::error!( + "UA: the device aborted the transfer, result={}", + req.tranfer_result as u32 + ); + served.aborted.set(true); + } + Ok(_) => {} + Err(_) => pw_log::error!("UA: could not decode TransferComplete"), + } + let resp = &mut framed_buf[1..]; + TransferCompleteResponse::new(instance_id, success).encode(resp) + } + Ok(FwUpdateCmd::VerifyComplete) => { + VerifyCompleteResponse::new(instance_id, success).encode(resp) + } + Ok(FwUpdateCmd::ApplyComplete) => { + served.apply_complete.set(true); + ApplyCompleteResponse::new(instance_id, success).encode(resp) + } + _ => { + pw_log::error!("UA: unexpected FD request, cmd={}", cmd as u32); + return Ok(0); + } + }; + + match resp_len { + Ok(len) => Ok(len + 1), + Err(_) => { + pw_log::error!("UA: could not encode response to cmd={}", cmd as u32); + Ok(0) + } + } +} + +/// Sends one request and waits for the reply. Returns (completion code, +/// PLDM response length); the response starts at `buf[1]`. +fn transact( + transport: &MctpPldmTransport, + pldm_len: usize, + buf: &mut [u8], +) -> Result<(u8, usize), PldmServiceError> { + let resp_len = transport.send_request(FD_EID, pldm_len, buf, REQUEST_TIMEOUT_MILLIS)?; + // The completion code follows the 3-byte PLDM header. + Ok((if resp_len > 3 { buf[4] } else { 0xff }, resp_len)) +} + +/// Encodes `request` into `buf` after the 1-byte MCTP type, which is +/// where every request in this app goes. +fn encode_request(request: &R, buf: &mut [u8]) -> Result { + request + .encode(&mut buf[1..]) + .map_err(|_| PldmServiceError::PldmMem(PldmMemError::BufferTooSmall)) +} + +/// Encodes `request`, sends it, and checks the completion code. Answers +/// the response length, or `None` when the device rejected the command, +/// which is logged here under `name` so no caller repeats it. +fn send_command( + transport: &MctpPldmTransport, + name: &str, + request: &R, + buf: &mut [u8], +) -> Result, PldmServiceError> { + let len = encode_request(request, buf)?; + let (completion_code, resp_len) = transact(transport, len, buf)?; + if completion_code != 0 { + pw_log::error!( + "UA: {} rejected, completion code {}", + name as &str, + completion_code as u32 + ); + return Ok(None); + } + Ok(Some(resp_len)) +} + +/// Type 0 discovery: PLDM types, firmware-update version, supported +/// commands. Returns `Ok(false)` if the device answered but lacks the +/// right protocol. +/// +/// `GetPLDMTypes` is retried because the device might not have claimed +/// its endpoint id yet (apps start in any order). Later steps talk to a +/// device that already answered once, so a timeout there is a real +/// failure. +fn discover_terminus( + transport: &MctpPldmTransport, + buf: &mut [u8], + instance_id: &mut u8, +) -> Result { + // ---- GetPLDMTypes ---- + let mut attempt = 0; + let (completion_code, resp_len) = loop { + let get_types = GetPldmTypeRequest::new(*instance_id, PldmMsgType::Request); + let len = encode_request(&get_types, buf)?; + match transact(transport, len, buf) { + Ok(answer) => break answer, + Err(e) => { + attempt += 1; + if attempt >= DISCOVERY_ATTEMPTS { + pw_log::error!("UA: the device never answered GetPLDMTypes"); + return Err(e); + } + } + } + }; + if completion_code != 0 { + pw_log::error!( + "UA: GetPLDMTypes rejected, completion code {}", + completion_code as u32 + ); + return Ok(false); + } + let Ok(types) = GetPldmTypeResponse::decode(&buf[1..1 + resp_len]) else { + pw_log::error!("UA: could not decode GetPLDMTypes response"); + return Ok(false); + }; + // The response is packed, so copy the bitmap before referencing it. + let types_bitmap = types.pldm_types; + for pldm_type in [PldmSupportedType::Base, PldmSupportedType::FwUpdate] { + if !is_bit_set(&types_bitmap, pldm_type as u8) { + pw_log::error!( + "UA: the device does not report PLDM type {}", + pldm_type as u32 + ); + return Ok(false); + } + } + + // ---- GetPLDMVersion ---- + *instance_id += 1; + let get_version = GetPldmVersionRequest::new( + *instance_id, + PldmMsgType::Request, + 0, + TransferOperationFlag::GetFirstPart, + PldmSupportedType::FwUpdate, + ); + let Some(resp_len) = send_command(transport, "GetPLDMVersion", &get_version, buf)? else { + return Ok(false); + }; + let Ok(version) = GetPldmVersionResponse::decode(&buf[1..1 + resp_len]) else { + pw_log::error!("UA: could not decode GetPLDMVersion response"); + return Ok(false); + }; + if version.transfer_rsp_flag != TransferRespFlag::StartAndEnd as u8 { + pw_log::error!("UA: the device split the version list across transfers"); + return Ok(false); + } + let reported_version = version.version_data; + if reported_version < MIN_FWUPDATE_VERSION { + pw_log::error!( + "UA: the device speaks firmware update {:08x}, too old", + reported_version as u32 + ); + return Ok(false); + } + + // ---- GetPLDMCommands ---- + *instance_id += 1; + let get_cmds = GetPldmCommandsRequest { + hdr: PldmMsgHeader::new( + *instance_id, + PldmMsgType::Request, + PldmSupportedType::Base, + PldmControlCmd::GetPldmCommands as u8, + ), + pldm_type: PldmSupportedType::FwUpdate as u8, + protocol_version: reported_version, + }; + let Some(resp_len) = send_command(transport, "GetPLDMCommands", &get_cmds, buf)? else { + return Ok(false); + }; + let Ok(cmds) = GetPldmCommandsResponse::decode(&buf[1..1 + resp_len]) else { + pw_log::error!("UA: could not decode GetPLDMCommands response"); + return Ok(false); + }; + let cmds_bitmap = cmds.supported_cmds; + for cmd in REQUIRED_FWUPDATE_CMDS { + if !is_bit_set(&cmds_bitmap, cmd) { + pw_log::error!("UA: the device does not report command {:02x}", cmd as u32); + return Ok(false); + } + } + + pw_log::info!( + "UA: device speaks firmware update {:08x} with the commands this agent sends", + reported_version as u32 + ); + *instance_id += 1; + Ok(true) +} + +/// Drives the update; `Ok(true)` means the Firmware Device reported apply +/// complete and then accepted activation, which is this card's pass condition. +fn run_update(transport: &MctpPldmTransport) -> Result { + // Registered before UpdateComponent is sent: the Firmware Device starts + // issuing RequestFirmwareData the moment it answers that command, and the + // MCTP stack drops inbound requests with no listener bound. + let mut listener = transport.responder_listener(SERVE_TIMEOUT_MILLIS)?; + + let comp_ver = fw_string("v1.0"); + let mut buf = [0u8; UA_BUF_SIZE]; + let mut instance_id = 0u8; + + // ---- Type 0 discovery ---- + if !discover_terminus(transport, &mut buf, &mut instance_id)? { + return Ok(false); + } + + // ---- QueryDeviceIdentifiers: confirm which device answered ---- + let query_devid = QueryDeviceIdentifiersRequest::new(instance_id, PldmMsgType::Request); + let Some(resp_len) = send_command(transport, "QueryDeviceIdentifiers", &query_devid, &mut buf)? + else { + return Ok(false); + }; + let Ok(devid) = QueryDeviceIdentifiersResponse::decode(&buf[1..1 + resp_len]) else { + pw_log::error!("UA: could not decode QueryDeviceIdentifiers response"); + return Ok(false); + }; + let descriptor = devid.initial_descriptor; + if descriptor.descriptor_type != DescriptorType::Uuid as u16 + || descriptor.descriptor_data[..DEVICE_UUID.len()] != DEVICE_UUID + { + pw_log::error!("UA: device identifier does not match, refusing to update"); + return Ok(false); + } + pw_log::info!("UA: device identified by UUID"); + + // ---- GetFirmwareParameters: learn which component to offer ---- + instance_id += 1; + let get_params = GetFirmwareParametersRequest::new(instance_id, PldmMsgType::Request); + let Some(resp_len) = send_command(transport, "GetFirmwareParameters", &get_params, &mut buf)? + else { + return Ok(false); + }; + let Ok(params) = GetFirmwareParametersResponse::decode(&buf[1..1 + resp_len]) else { + pw_log::error!("UA: could not decode GetFirmwareParameters response"); + return Ok(false); + }; + let comp_count = params.parms.params_fixed.comp_count; + if comp_count != 1 { + pw_log::error!( + "UA: device reports {} components, expected 1", + comp_count as u32 + ); + return Ok(false); + } + let entry = ¶ms.parms.comp_param_table[0].comp_param_entry_fixed; + if entry.comp_classification != ComponentClassification::Firmware as u16 { + pw_log::error!( + "UA: component is not firmware, classification {}", + entry.comp_classification as u32 + ); + return Ok(false); + } + // The device is the source of truth for the identifier; this agent offers + // an update for whatever it reported. + let comp_identifier = entry.comp_identifier; + let comp_classification_index = entry.comp_classification_index; + pw_log::info!( + "UA: device offers component {} for update", + comp_identifier as u32 + ); + + // ---- RequestUpdate: move the Firmware Device out of Idle ---- + instance_id += 1; + let req_update = RequestUpdateRequest::new( + instance_id, + PldmMsgType::Request, + IMAGE_SIZE, // max_transfer_size + 1, // num_of_comp + 1, // max_outstanding_transfer_req + 0, // pkg_data_len + &comp_ver, + ); + if send_command(transport, "RequestUpdate", &req_update, &mut buf)?.is_none() { + return Ok(false); + } + + // ---- PassComponentTable: describe the single component ---- + instance_id += 1; + let pass_comp = PassComponentTableRequest::new( + instance_id, + PldmMsgType::Request, + TransferRespFlag::StartAndEnd, + ComponentClassification::Firmware, + comp_identifier, + comp_classification_index, + COMP_COMPARISON_STAMP, + &comp_ver, + ); + if send_command(transport, "PassComponentTable", &pass_comp, &mut buf)?.is_none() { + return Ok(false); + } + + // ---- UpdateComponent: the Firmware Device starts pulling the image ---- + instance_id += 1; + let update_comp = UpdateComponentRequest::new( + instance_id, + PldmMsgType::Request, + ComponentClassification::Firmware, + comp_identifier, + comp_classification_index, + COMP_COMPARISON_STAMP, + IMAGE_SIZE, + UpdateOptionFlags(0), + &comp_ver, + ); + if send_command(transport, "UpdateComponent", &update_comp, &mut buf)?.is_none() { + return Ok(false); + } + + pw_log::info!("UA: handing over {} bytes", IMAGE_SIZE as u32); + + let served = Served::default(); + for _ in 0..MAX_SERVED_REQUESTS { + transport.respond_once( + &mut listener, + &mut buf, + |framed_buf, req_total_len, _eid| serve_fd_request(framed_buf, req_total_len, &served), + )?; + if served.apply_complete.get() { + pw_log::info!("UA: firmware device reported apply complete"); + break; + } + // Abort or withdrawal: either way, send CancelUpdate so the device + // can leave update mode. + if served.aborted.get() || cancel_after(served.chunks.get()) { + if cancel_after(served.chunks.get()) { + pw_log::info!( + "UA: withdrawing the update after {} chunks", + served.chunks.get() as u32 + ); + } + instance_id += 1; + let cancel = CancelUpdateRequest::new(instance_id, PldmMsgType::Request); + if send_command(transport, "CancelUpdate", &cancel, &mut buf)?.is_some() { + pw_log::info!("UA: the device took the cancel"); + } + return Ok(false); + } + } + + if !served.apply_complete.get() { + pw_log::error!("UA: gave up after {} requests", MAX_SERVED_REQUESTS as u32); + return Ok(false); + } + + // ---- ActivateFirmware: the device runs the new image and goes Idle ---- + instance_id += 1; + let activate = ActivateFirmwareRequest::new( + instance_id, + PldmMsgType::Request, + SelfContainedActivationRequest::ActivateSelfContainedComponents, + ); + if send_command(transport, "ActivateFirmware", &activate, &mut buf)?.is_none() { + return Ok(false); + } + + pw_log::info!("UA: firmware activated, update complete"); + + // DSP0267 takes UpdateSecurityRevision only in IDLE, which the device + // is in now that it has activated. Committing the revision is a + // separate decision from installing the image, and this is where the + // agent asks for it. The second request is the retry after a lost + // answer: the floor has the SVN already, so the device refuses. + use pldm_common::protocol::firmware_update::FwUpdateCompletionCode; + + for request in 0..SVN_COMMIT_REQUESTS { + instance_id += 1; + let mut attempt = 0; + let (completion_code, _) = loop { + let commit = UpdateSecurityRevisionRequest::new( + instance_id, + PldmMsgType::Request, + ComponentClassification::Firmware, + COMP_IDENTIFIER, + 0, + ); + let len = encode_request(&commit, &mut buf)?; + match transact(transport, len, &mut buf) { + Ok(answer) => break answer, + Err(e) => { + attempt += 1; + if attempt >= SECURITY_REVISION_ATTEMPTS { + pw_log::error!("UA: the device never answered UpdateSecurityRevision"); + return Err(e); + } + pw_log::info!("UA: UpdateSecurityRevision timed out, asking again"); + } + } + }; + let expected = if request == 0 { + PldmBaseCompletionCode::Success as u8 + } else { + FwUpdateCompletionCode::UpdateSecurityRevisionNotPermitted as u8 + }; + if completion_code != expected { + pw_log::error!( + "UA: UpdateSecurityRevision answered {:02x}, expected {:02x}", + completion_code as u32, + expected as u32 + ); + return Ok(false); + } + if request == 0 { + pw_log::info!("UA: the security revision was committed"); + } else { + pw_log::info!("UA: the second request for the same revision was refused"); + } + } + + Ok(true) +} + +#[entry] +fn entry() { + pw_log::info!("UA: app started"); + let transport = MctpPldmTransport::new(IpcMctpClient::new(handle::MCTP)); + + if transport.stack().set_eid(UA_EID).is_err() { + pw_log::error!("UA: set_eid failed"); + let _ = syscall::debug_shutdown(Err(Error::Internal)); + loop {} + } + + pw_log::info!("UA: driving an update against EID {}", FD_EID as u32); + // The Update Agent never ends the run. pldm_fd owns the verdict, + // because the Update Agent finishing its sequence is the weaker + // claim: it says the messages were exchanged, not that the device + // holds a verified image. A scenario where the RoT refuses is one + // where the update the Update Agent offered fails and the test still + // passes, so an Update Agent that could shut the system down would + // race the device to the sentinel and sometimes win. + match run_update(&transport) { + Ok(true) => { + pw_log::info!("UA: sequence complete, leaving the verdict to the device"); + } + Ok(false) => { + pw_log::error!("UA: the update did not complete"); + } + Err(PldmServiceError::Mctp(e)) => { + pw_log::error!("UA: update flow failed, MCTP code {}", e.code as u32); + } + Err(_) => { + pw_log::error!("UA: update flow failed on a PLDM error"); + } + } + + #[expect(clippy::empty_loop)] + loop {} +} + +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + pw_log::error!("UA: panic"); + let _ = syscall::debug_shutdown(Err(Error::Internal)); + loop {} +} diff --git a/target/ast10x0/tests/integration/pldm_update/refused_update/BUILD.bazel b/target/ast10x0/tests/integration/pldm_update/refused_update/BUILD.bazel new file mode 100644 index 000000000..564a5195b --- /dev/null +++ b/target/ast10x0/tests/integration/pldm_update/refused_update/BUILD.bazel @@ -0,0 +1,22 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +# The update scenario's negative case: the RoT refuses the request. +# +# It passes when the orchestrator agrees to nothing and the update does +# not go through, which is what says the gate is a gate rather than a +# report. + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load("//target/ast10x0/tests/integration/pldm_update:apps.bzl", "APPS", "FLASH", "SYSTEM_CONFIG", "TARGET_DEPS", "TARGET_SRC") + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/pldm_update/refused_update:refused_update_qemu_test +qemu_scenario( + name = "refused_update_qemu", + apps = APPS, + cfgs = ["refused_update"], + flash = FLASH, + system_config = SYSTEM_CONFIG, + target_deps = TARGET_DEPS, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/pldm_update/retry_chunk/BUILD.bazel b/target/ast10x0/tests/integration/pldm_update/retry_chunk/BUILD.bazel new file mode 100644 index 000000000..e0e875dd3 --- /dev/null +++ b/target/ast10x0/tests/integration/pldm_update/retry_chunk/BUILD.bazel @@ -0,0 +1,24 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +# The update scenario with a retry in the middle of the transfer: the +# agent answers one RequestFirmwareData with RetryRequestFwData. +# +# Not a negative. The device has to wait out FD_T2, ask for the same +# window again, and finish the update. It is here because nothing else +# makes the device request a window twice, and the re-delivery branch in +# the device's download callback had no caller. + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load("//target/ast10x0/tests/integration/pldm_update:apps.bzl", "APPS", "FLASH", "SYSTEM_CONFIG", "TARGET_DEPS", "TARGET_SRC") + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/pldm_update/retry_chunk:retry_chunk_qemu_test +qemu_scenario( + name = "retry_chunk_qemu", + apps = APPS, + cfgs = ["retry_chunk"], + flash = FLASH, + system_config = SYSTEM_CONFIG, + target_deps = TARGET_DEPS, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/pldm_update/svn_commit/BUILD.bazel b/target/ast10x0/tests/integration/pldm_update/svn_commit/BUILD.bazel new file mode 100644 index 000000000..3e2ee0ef2 --- /dev/null +++ b/target/ast10x0/tests/integration/pldm_update/svn_commit/BUILD.bazel @@ -0,0 +1,23 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +# The update scenario followed by its anti-rollback commit: once the +# device is idle again, the Update Agent sends UpdateSecurityRevision. +# +# Installing an image and committing its security revision are two +# decisions. DSP0267 takes the second only in IDLE, so it lands after the +# activation, and the RoT grants it the way it grants every other step. + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load("//target/ast10x0/tests/integration/pldm_update:apps.bzl", "APPS", "FLASH", "SYSTEM_CONFIG", "TARGET_DEPS", "TARGET_SRC") + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/pldm_update/svn_commit:svn_commit_qemu_test +qemu_scenario( + name = "svn_commit_qemu", + apps = APPS, + cfgs = ["svn_commit"], + flash = FLASH, + system_config = SYSTEM_CONFIG, + target_deps = TARGET_DEPS, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/pldm_update/svn_commit_refused/BUILD.bazel b/target/ast10x0/tests/integration/pldm_update/svn_commit_refused/BUILD.bazel new file mode 100644 index 000000000..1b78e08b8 --- /dev/null +++ b/target/ast10x0/tests/integration/pldm_update/svn_commit_refused/BUILD.bazel @@ -0,0 +1,24 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +# The agent sends UpdateSecurityRevision twice, as it does when the answer +# to the first request is lost on the way back. +# +# The floor took the SVN on the first request and the window closed with +# it, so the second has nothing outstanding. The state machine drops the +# event, the RoT answers RejectSvnCommit, and the device reports +# UPDATE_SECURITY_REVISION_NOT_PERMITTED. + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load("//target/ast10x0/tests/integration/pldm_update:apps.bzl", "APPS", "FLASH", "SYSTEM_CONFIG", "TARGET_DEPS", "TARGET_SRC") + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/pldm_update/svn_commit_refused:svn_commit_refused_qemu_test +qemu_scenario( + name = "svn_commit_refused_qemu", + apps = APPS, + cfgs = ["svn_commit_refused"], + flash = FLASH, + system_config = SYSTEM_CONFIG, + target_deps = TARGET_DEPS, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/pldm_update/system.json5 b/target/ast10x0/tests/integration/pldm_update/system.json5 new file mode 100644 index 000000000..e865bfbe3 --- /dev/null +++ b/target/ast10x0/tests/integration/pldm_update/system.json5 @@ -0,0 +1,205 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +// AST10x0 PLDM update QEMU test. +// +// Four processes: the two endpoints of an update, the stack between them, +// and the RoT the Firmware Device answers to. +// +// pldm_ua: the Update Agent, the BMC's half of the update +// pldm_fd: the DSP0267 Firmware Device, staging into CS1 flash, +// and the IPC server the RoT commands it through +// mctp_bus: an MCTP server per endpoint, joined by the loopback +// orchestrator: the RoT, which decides whether the update may proceed +// +// PLDM reaches the wire the same way it does on hardware: each endpoint is +// an IpcMctpClient to an MCTP server. Only the bottom binding differs, +// transport-loopback instead of transport-i2c, so EID routing, +// fragmentation and reassembly are the shipped code. +// +// Its own image rather than a scenario inside the mock-BMC test. The runner +// greps one sentinel per run, so one scenario per image is what lets a +// failure name itself. +// +// Memory map (AST10x0: 768 KB SRAM, no XIP, so code and data share it): +// 0x00000000 - 0x00000500 vector table (1280 B) +// 0x00000500 - 0x00010000 kernel flash (64256 B) +// 0x00010000 - 0x00050000 app flash (4 x 64 KB) +// 0x00060000 - 0x00080000 kernel RAM (128 KB) +// 0x00080000 - 0x000C0000 app RAM (4 x 32 KB used of a 256 KB region) +// +// The kernel's flash size is 0x10000 minus the 0x500 vector table, not a +// round 64 KB, so that app flash starts at 0x10000. The MPU wants regions +// power-of-2 sized and aligned; apps starting at 0x10500 overlap each +// other's subregions however neatly their sizes divide the window. The +// upstream tests do the same thing with 129792, which is 0x20000 - 0x500. +// +// The kernel was holding 127 KB for 35 KB of code, so taking 64256 leaves +// 320 KB of window, and four apps at 64 KB use 256 KB of it. +// +// Oversizing and misalignment are both quiet: the image still builds and +// the only sign is a PMSAv7 subregion overlap warning saying the +// protection is wrong. Check for those after changing any size here. +{ + arch: { + type: "armv7m", + vector_table_start_address: 0x00000000, + vector_table_size_bytes: 1280, + }, + kernel: { + flash_start_address: 0x00000500, + flash_size_bytes: 64256, + ram_start_address: 0x00060000, + ram_size_bytes: 131072, + }, + apps: [ + { + name: "mctp_bus", + flash_size_bytes: 65536, + processes: [ + { + name: "mctp_bus_process", + ram_size_bytes: 32768, + objects: [ + { + name: "wg", + type: "wait_group", + }, + { + // The side of the wire the Firmware Device holds. + name: "fd", + type: "channel_handler", + }, + { + // The side the Update Agent uses. + name: "ua", + type: "channel_handler", + }, + { + type: "thread", + name: "mctp_bus_thread", + // Two packet queues live on this stack. At + // QUEUE_DEPTH 32 they overflowed 4 KB and the + // app died before its first log line, with no + // panic and no warning. + kernel_stack_size_bytes: 16384, + }, + ], + }, + ], + }, + { + name: "pldm_fd", + flash_size_bytes: 65536, + processes: [ + { + name: "pldm_fd_process", + ram_size_bytes: 32768, + objects: [ + { + name: "mctp", + type: "channel_initiator", + handler_process: "mctp_bus_process", + handler_object_name: "fd", + }, + { + // The RoT's channel into this device. The device + // answers; it does not command. + name: "orch", + type: "channel_handler", + }, + { + type: "thread", + name: "pldm_fd_thread", + // Staging reads a window back from flash on this + // stack, on top of the PLDM message buffer. + kernel_stack_size_bytes: 8192, + }, + ], + memory_mappings: [ + // The kernel applies the FMC pinmux before any + // process starts, so this one does not map the SCU. + { + // FMC controller registers. + name: "fmc_regs", + type: "device", + start_address: 0x7e620000, + size_bytes: 0x1000, + }, + { + // FMC CS0 memory-mapped flash read window (8 MiB). + // The backend takes both windows even though + // nothing here reads CS0. + name: "fmc_cs0_window", + type: "device", + start_address: 0x80000000, + size_bytes: 0x800000, + }, + { + // FMC CS1 memory-mapped flash read window (64 MiB), + // where the staged image lands. With both chip + // selects present the 256 MiB FMC aperture splits + // in half, which is why CS1 sits at 0x88000000. + name: "fmc_cs1_window", + type: "device", + start_address: 0x88000000, + size_bytes: 0x04000000, + }, + ], + }, + ], + }, + { + name: "orchestrator", + flash_size_bytes: 65536, + processes: [ + { + name: "orchestrator_process", + ram_size_bytes: 32768, + objects: [ + { + name: "wg", + type: "wait_group", + }, + { + // Into the Firmware Device: QueryStatus and the + // Perform and Reject commands. + name: "fd", + type: "channel_initiator", + handler_process: "pldm_fd_process", + handler_object_name: "orch", + }, + { + type: "thread", + name: "orchestrator_thread", + kernel_stack_size_bytes: 4096, + }, + ], + }, + ], + }, + { + name: "pldm_ua", + flash_size_bytes: 65536, + processes: [ + { + name: "pldm_ua_process", + ram_size_bytes: 32768, + objects: [ + { + name: "mctp", + type: "channel_initiator", + handler_process: "mctp_bus_process", + handler_object_name: "ua", + }, + { + type: "thread", + name: "pldm_ua_thread", + kernel_stack_size_bytes: 4096, + }, + ], + }, + ], + }, + ], +} diff --git a/target/ast10x0/tests/integration/pldm_update/target.rs b/target/ast10x0/tests/integration/pldm_update/target.rs new file mode 100644 index 000000000..475643427 --- /dev/null +++ b/target/ast10x0/tests/integration/pldm_update/target.rs @@ -0,0 +1,52 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Kernel target for the PLDM update QEMU test. +//! +//! The Firmware Device reports the result with +//! `syscall::debug_shutdown(Ok(()) | Err(..))`, which lands here and writes +//! the UART sentinel qemu_runner.py greps for. + +#![no_std] +#![no_main] + +use ast10x0_peripherals::scu::pinctrl::PINCTRL_FMC_QUAD; +use ast10x0_peripherals::scu::ScuRegisters; +use console_backend::console_backend_write_all; +use entry as _; +use target_common::{declare_target, TargetInterface}; + +pub struct Target {} + +impl TargetInterface for Target { + const NAME: &'static str = "AST10x0 PLDM update test"; + + fn main() -> ! { + // The Firmware Device stages into SPI NOR on CS1, so the pins have + // to be muxed before any process runs. Doing it here keeps SCU + // access out of userspace, where two tasks could race the shared + // pinctrl registers. + // + // SAFETY: kernel main() runs once, single-threaded, with exclusive + // hardware ownership. + let scu = unsafe { ScuRegisters::new_global_unlocked() }; + scu.apply_pinctrl_group(PINCTRL_FMC_QUAD); + + codegen::start(); + #[expect(clippy::empty_loop)] + loop {} + } + + fn shutdown(code: u32) -> ! { + let sentinel: &[u8] = if code == 0 { + b"TEST_RESULT:PASS\n" + } else { + b"TEST_RESULT:FAIL\n" + }; + let _ = console_backend_write_all(sentinel); + #[expect(clippy::empty_loop)] + loop {} + } +} + +declare_target!(Target); diff --git a/target/ast10x0/tests/integration/pldm_update/transfer_error/BUILD.bazel b/target/ast10x0/tests/integration/pldm_update/transfer_error/BUILD.bazel new file mode 100644 index 000000000..8a1629851 --- /dev/null +++ b/target/ast10x0/tests/integration/pldm_update/transfer_error/BUILD.bazel @@ -0,0 +1,24 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +# The update scenario's third negative: the Update Agent answers one +# RequestFirmwareData with an error completion code instead of data. +# +# This is a communication failure rather than a bad image: the bytes the +# device did receive were right, and what went wrong is the answer to one +# request. The device has to abort the transfer and leave nothing +# activated. + +load("//target/ast10x0/tests/integration:scenario.bzl", "qemu_scenario") +load("//target/ast10x0/tests/integration/pldm_update:apps.bzl", "APPS", "FLASH", "SYSTEM_CONFIG", "TARGET_DEPS", "TARGET_SRC") + +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/integration/pldm_update/transfer_error:transfer_error_qemu_test +qemu_scenario( + name = "transfer_error_qemu", + apps = APPS, + cfgs = ["transfer_error"], + flash = FLASH, + system_config = SYSTEM_CONFIG, + target_deps = TARGET_DEPS, + target_src = TARGET_SRC, +) diff --git a/target/ast10x0/tests/integration/scenario.bzl b/target/ast10x0/tests/integration/scenario.bzl new file mode 100644 index 000000000..e964c92cd --- /dev/null +++ b/target/ast10x0/tests/integration/scenario.bzl @@ -0,0 +1,191 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +"""One QEMU scenario: a kernel, its apps, the image and the test. + +Every scenario needs the same seven rules in the same order, and each +negative case needs them again with one `--cfg` added. Copied into each +package, the rules take an edit in one copy and miss the rest, so the +rules live here once. + +A negative scenario is a package of its own because the system config +names an app by its target name, and two targets in one package cannot +share a name. The negative package reuses the sources and config of the +positive scenario through labels, so the only thing it states is what +differs: the flag. +""" + +load("@pigweed//pw_kernel/tooling:rust_app.bzl", "rust_app") +load("@pigweed//pw_kernel/tooling:system_image.bzl", "system_image", "system_image_test") +load("@pigweed//pw_kernel/tooling:target_codegen.bzl", "target_codegen") +load("@pigweed//pw_kernel/tooling:target_linker_script.bzl", "target_linker_script") +load("@pigweed//pw_kernel/tooling/panic_detector:rust_binary_no_panics_test.bzl", "rust_binary_no_panics_test") +load("@rules_rust//rust:defs.bzl", "rust_binary") +load("//target/ast10x0:defs.bzl", "TARGET_COMPATIBLE_WITH", "flash_system_image_test") +load("//util/region:defs.bzl", "app_regions") + +# Every `--cfg` name any scenario in this tree uses. Declared on every +# build, not just the one that sets it, because an undeclared cfg name is +# a warning and warnings are errors here. A name goes in once and the +# scenario that sets it says so in its own BUILD file. +SCENARIO_CFGS = [ + "device_hangs", + "corrupt_image", + "refused_update", + "rot_owns_verdict", + "device_stays_down", + "recovery_preempts", + "transfer_error", + "cancel_mid_transfer", + "offer_before_supervising", + "retry_chunk", + "self_trial", + "self_update", + "measured", + "svn_commit", + "svn_commit_refused", + "recovery", + "recovery_exhausted", +] + +KERNEL_DEPS = [ + "//target/ast10x0:entry", + "@pigweed//pw_kernel/arch/arm_cortex_m:arch_arm_cortex_m", + "@pigweed//pw_kernel/kernel", + "@pigweed//pw_kernel/subsys/console:console_backend", + "@pigweed//pw_kernel/target:target_common", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", +] + +def qemu_scenario( + name, + system_config, + target_src, + apps, + cfgs = None, + target_deps = None, + flash = None, + test_tags = None): + """Builds one scenario image and the QEMU test that runs it. + + One scenario per package: `target.rs` in the kernel names the codegen + crate `codegen`, so the target name is fixed rather than derived. + + Args: + name: Image name. The test is `_test`. + system_config: Label of the system.json5 filegroup. + target_src: Label of the kernel `target.rs`. + apps: One dict per app, with `name` (which must match the app in + the system config), `src`, and `deps`. + cfgs: `--cfg` names set on every app, from `SCENARIO_CFGS`. A + scenario that inverts its own verdict reads these, so the + negative case passes when the failure is caught rather than + failing like a broken build. + target_deps: Extra kernel deps, for a scenario whose `target.rs` + touches the SoC (applying a pinmux, say). + flash: Set it and the test runs under `flash_system_image_test`, + so an app that maps the FMC has real flash underneath. The + dict is passed through to that rule: `cs0_image`, `cs1_image`, + `flash_size`, `fmc_model`, `cs1_contents`. + test_tags: Extra tags for the QEMU test. + """ + cfgs = cfgs or [] + for cfg in cfgs: + if cfg not in SCENARIO_CFGS: + fail("unknown scenario cfg {}; add it to SCENARIO_CFGS".format(cfg)) + + rustc_flags = ["--check-cfg=cfg({})".format(c) for c in SCENARIO_CFGS] + rustc_flags += ["--cfg={}".format(c) for c in cfgs] + + target_codegen( + name = "codegen", + arch = "@pigweed//pw_kernel/arch/arm_cortex_m:arch_arm_cortex_m", + system_config = system_config, + target_compatible_with = TARGET_COMPATIBLE_WITH, + ) + + target_linker_script( + name = "linker_script", + system_config = system_config, + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + template = "//target/ast10x0:linker_script_template", + ) + + rust_binary( + name = "target", + srcs = [target_src], + edition = "2024", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + deps = [ + ":codegen", + ":linker_script", + ] + KERNEL_DEPS + (target_deps or []), + ) + + app_labels = [] + for app in apps: + deps = list(app["deps"]) + + # An app that maps MMIO gets the generated regions crate its + # take_mmaps comes from. Generated per scenario, because it is + # built from the system config of that scenario. + if app.get("regions"): + regions = "app_" + app["name"] + "_regions" + app_regions( + name = regions, + app_name = app["name"], + edition = "2024", + system_config = system_config, + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + ) + deps.append(":" + regions) + + rust_app( + name = app["name"], + srcs = [app["src"]], + codegen_crate_name = "app_" + app["name"], + edition = "2024", + rustc_flags = rustc_flags, + system_config = system_config, + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + deps = deps, + ) + app_labels.append(":" + app["name"]) + + system_image( + name = name, + apps = app_labels, + kernel = ":target", + platform = "//target/ast10x0", + system_config = system_config, + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + visibility = ["//visibility:public"], + ) + + if flash: + flash_system_image_test( + name = name + "_test", + image = ":" + name, + tags = ["qemu_only"] + (test_tags or []), + target_compatible_with = TARGET_COMPATIBLE_WITH, + **flash + ) + else: + system_image_test( + name = name + "_test", + image = ":" + name, + tags = ["qemu_only"] + (test_tags or []), + target_compatible_with = TARGET_COMPATIBLE_WITH, + ) + + rust_binary_no_panics_test( + name = name + "_no_panics_test", + binary = ":" + name, + tags = ["kernel"], + ) diff --git a/target/ast10x0/tests/mctp/server/BUILD.bazel b/target/ast10x0/tests/mctp/server/BUILD.bazel index e955524d0..a536099f9 100644 --- a/target/ast10x0/tests/mctp/server/BUILD.bazel +++ b/target/ast10x0/tests/mctp/server/BUILD.bazel @@ -8,6 +8,16 @@ load("@pigweed//pw_kernel/tooling:target_linker_script.bzl", "target_linker_scri load("@rules_rust//rust:defs.bzl", "rust_binary") load("//target/ast10x0:defs.bzl", "TARGET_COMPATIBLE_WITH", "system_image_test") +# The I2C and MCTP server apps are role-agnostic infrastructure: any two-card +# test that needs an MCTP link builds its own `rust_app` from these sources +# against its own system config. +exports_files([ + "i2c_server_main.rs", + "i2c_server_main_peer.rs", + "main.rs", + "main_peer.rs", +]) + filegroup( name = "system_config", srcs = ["system.json5"], diff --git a/target/ast10x0/tests/mctp/server/i2c_server_main.rs b/target/ast10x0/tests/mctp/server/i2c_server_main.rs index 40f295d85..d8e2e4549 100644 --- a/target/ast10x0/tests/mctp/server/i2c_server_main.rs +++ b/target/ast10x0/tests/mctp/server/i2c_server_main.rs @@ -7,6 +7,7 @@ #![no_std] use app_i2c_server::{handle, signals}; +use ast10x0_peripherals::create_pins; use ast10x0_peripherals::i2c::{ClockConfig, I2cConfig, I2cSpeed, I2cXferMode}; use i2c_server_runtime::{run, Bus}; use userspace::entry; @@ -20,25 +21,27 @@ const SLAVE_CFG: I2cConfig = I2cConfig { clock_config: ClockConfig::ast1060_default(), }; -#[unsafe(link_section = ".ram_nc")] -static mut MASTER_DMA_BUF: [u8; 4096] = [0u8; 4096]; -#[unsafe(link_section = ".ram_nc")] -static mut SLAVE_DMA_BUF: [u8; 256] = [0u8; 256]; - #[entry] fn entry() { - // SAFETY: board init ran init_bus(2) in the kernel; buffers are non-cached and owned here. - let master_dma_buf: &'static mut [u8] = - unsafe { &mut *core::ptr::addr_of_mut!(MASTER_DMA_BUF) }; - let slave_dma_buf: &'static mut [u8] = unsafe { &mut *core::ptr::addr_of_mut!(SLAVE_DMA_BUF) }; - let driver = - match unsafe { i2c_backend::open_bus_dma(2, &SLAVE_CFG, master_dma_buf, slave_dma_buf) } { - Ok(d) => d, - Err(_) => { - pw_log::error!("open_bus_dma(2) failed"); - loop {} - } - }; + // The kernel routed Bus 2's pins at the SCU before starting us; userspace has no SCU grant, so + // we bind the already-routed pins rather than re-muxing them. + // SAFETY: sole pin creation site in this binary, at boot; the pins! table is this chip's true pin map. + let pins = unsafe { create_pins() }; + let (scl, sda) = (pins.scu418_0, pins.scu418_1); + + let (Some(master_dma_buf), Some(slave_dma_buf)) = ( + i2c_backend::non_cached_buf!(4096), + i2c_backend::non_cached_buf!(512), + ) else { + pw_log::error!("i2c DMA buffers already taken"); + loop {} + }; + // Bind Bus 2's already-muxed pins and bring the controller up (init + DMA wrap) in one step. + let Ok(driver) = i2c_backend::open_bus_dma(scl, sda, &SLAVE_CFG, master_dma_buf, slave_dma_buf) + else { + pw_log::error!("i2c bus open failed"); + loop {} + }; pw_log::info!("I2C server ready on Bus 2"); diff --git a/target/ast10x0/tests/mctp/server/i2c_server_main_peer.rs b/target/ast10x0/tests/mctp/server/i2c_server_main_peer.rs index f2bba75e8..94f8e0218 100644 --- a/target/ast10x0/tests/mctp/server/i2c_server_main_peer.rs +++ b/target/ast10x0/tests/mctp/server/i2c_server_main_peer.rs @@ -7,6 +7,7 @@ #![no_std] use app_i2c_server_peer::{handle, signals}; +use ast10x0_peripherals::create_pins; use ast10x0_peripherals::i2c::{ClockConfig, I2cConfig, I2cSpeed, I2cXferMode}; use i2c_server_runtime::{run, Bus}; use userspace::entry; @@ -20,25 +21,27 @@ const SLAVE_CFG: I2cConfig = I2cConfig { clock_config: ClockConfig::ast1060_default(), }; -#[unsafe(link_section = ".ram_nc")] -static mut MASTER_DMA_BUF: [u8; 4096] = [0u8; 4096]; -#[unsafe(link_section = ".ram_nc")] -static mut SLAVE_DMA_BUF: [u8; 256] = [0u8; 256]; - #[entry] fn entry() { - // SAFETY: board init ran init_bus(2) in the kernel; buffers are non-cached and owned here. - let master_dma_buf: &'static mut [u8] = - unsafe { &mut *core::ptr::addr_of_mut!(MASTER_DMA_BUF) }; - let slave_dma_buf: &'static mut [u8] = unsafe { &mut *core::ptr::addr_of_mut!(SLAVE_DMA_BUF) }; - let driver = - match unsafe { i2c_backend::open_bus_dma(2, &SLAVE_CFG, master_dma_buf, slave_dma_buf) } { - Ok(d) => d, - Err(_) => { - pw_log::error!("open_bus_dma(2) failed"); - loop {} - } - }; + // The kernel routed Bus 2's pins at the SCU before starting us; userspace has no SCU grant, so + // we bind the already-routed pins rather than re-muxing them. + // SAFETY: sole pin creation site in this binary, at boot; the pins! table is this chip's true pin map. + let pins = unsafe { create_pins() }; + let (scl, sda) = (pins.scu418_0, pins.scu418_1); + + let (Some(master_dma_buf), Some(slave_dma_buf)) = ( + i2c_backend::non_cached_buf!(4096), + i2c_backend::non_cached_buf!(256), + ) else { + pw_log::error!("i2c DMA buffers already taken"); + loop {} + }; + // Bind Bus 2's already-muxed pins and bring the controller up (init + DMA wrap) in one step. + let Ok(driver) = i2c_backend::open_bus_dma(scl, sda, &SLAVE_CFG, master_dma_buf, slave_dma_buf) + else { + pw_log::error!("i2c bus open failed"); + loop {} + }; pw_log::info!("I2C server peer ready on Bus 2"); diff --git a/target/ast10x0/tests/mctp/server/target.rs b/target/ast10x0/tests/mctp/server/target.rs index ed4f0348e..3f24951dd 100644 --- a/target/ast10x0/tests/mctp/server/target.rs +++ b/target/ast10x0/tests/mctp/server/target.rs @@ -4,8 +4,7 @@ #![no_std] #![no_main] -use ast10x0_board::{Ast10x0Board, Ast10x0BoardDescriptor, I2cBusCfg}; -use ast10x0_peripherals::i2c::{ClockConfig, I2cConfig, I2cSpeed, I2cXferMode}; +use ast10x0_board::{Ast10x0Board, Ast10x0BoardDescriptor}; use ast10x0_peripherals::scu::pinctrl; use console_backend::console_backend_write_all; use entry as _; @@ -13,20 +12,7 @@ use target_common::{declare_target, TargetInterface}; pub struct Target; -const I2C2_CFG: I2cConfig = I2cConfig { - speed: I2cSpeed::Standard, - xfer_mode: I2cXferMode::DmaMode, - multi_master: false, - smbus_timeout: false, - smbus_alert: false, - clock_config: ClockConfig::ast1060_default(), -}; - static PINCTRL_GROUPS: [&[ast10x0_peripherals::scu::PinctrlPin]; 1] = [pinctrl::PINCTRL_I2C2]; -static I2C_BUSES: [I2cBusCfg; 1] = [I2cBusCfg { - bus: 2, - config: I2C2_CFG, -}]; impl TargetInterface for Target { const NAME: &'static str = "AST10x0 MCTP Server"; @@ -36,7 +22,6 @@ impl TargetInterface for Target { if unsafe { Ast10x0Board::new(Ast10x0BoardDescriptor { pinctrl_groups: &PINCTRL_GROUPS, - i2c_buses: &I2C_BUSES, }) .init() } diff --git a/target/ast10x0/tests/orchestrator/runtime/BUILD.bazel b/target/ast10x0/tests/orchestrator/runtime/BUILD.bazel index d8d6a98f5..f1f90cb9c 100644 --- a/target/ast10x0/tests/orchestrator/runtime/BUILD.bazel +++ b/target/ast10x0/tests/orchestrator/runtime/BUILD.bazel @@ -39,6 +39,7 @@ rust_binary( ":codegen", ":linker_script", "//target/ast10x0:entry", + "//target/ast10x0/tests/clock", "@pigweed//pw_kernel/arch/arm_cortex_m:arch_arm_cortex_m", "@pigweed//pw_kernel/kernel", "@pigweed//pw_kernel/subsys/console:console_backend", @@ -48,10 +49,12 @@ rust_binary( ], ) -# Test app: drives the real orchestrator-sm core through the server runtime -# (BootWatchdogs) — arming boot watchdogs, blocking in object_wait on -# wait_deadline, and feeding poll_expired events back into the core. -# debug_shutdown(Ok|Err) reports. +# Test app: drives the real orchestrator-sm core three ways: CheckpointWalk +# judging per-checkpoint windows directly against object_wait (scenarios 1-3), +# the server runtime (BootWatchdogs) multiplexing boot/commit watchdogs via +# wait_deadline/poll_expired (scenarios 4-6), and recovery end to end under +# real kernel deadlines (scenarios 7-8), feeding the resulting events back +# into the core. debug_shutdown(Ok|Err) reports. rust_app( name = "test_runtime", srcs = ["main.rs"], @@ -61,9 +64,12 @@ rust_app( tags = ["kernel"], target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ + "//services/orchestrator/adapters/walk:orchestrator_checkpoint_walk", + "//services/orchestrator/capabilities:orchestrator_capabilities", "//services/orchestrator/config:orchestrator_config", "//services/orchestrator/server:orchestrator_server", "//services/orchestrator/sm:orchestrator_sm", + "//target/ast10x0/tests/clock", "@pigweed//pw_kernel/userspace", "@pigweed//pw_log/rust:pw_log", "@pigweed//pw_status/rust:pw_status", diff --git a/target/ast10x0/tests/orchestrator/runtime/main.rs b/target/ast10x0/tests/orchestrator/runtime/main.rs index ce2f3ad58..f424a4b21 100644 --- a/target/ast10x0/tests/orchestrator/runtime/main.rs +++ b/target/ast10x0/tests/orchestrator/runtime/main.rs @@ -1,41 +1,43 @@ // Licensed under the Apache-2.0 license // SPDX-License-Identifier: Apache-2.0 -//! Orchestrator integration QEMU test: all four subcomponents wired end to end -//! under the kernel — the pure core ([`Orchestrator`], `orchestrator-sm`), the -//! server runtime ([`BootWatchdogs`], `orchestrator-server`) which wraps the -//! watchdog keeper (`orchestrator-timer`), and the board device table -//! ([`DeviceConfig`], `orchestrator-config`). +//! Orchestrator integration QEMU test: the pure core (`Orchestrator`, +//! `orchestrator-sm`), the server runtime (`BootWatchdogs`, +//! `orchestrator-server`), the device table (`DeviceConfig`, +//! `orchestrator-config`), and the checkpoint walker (`CheckpointWalk`, +//! `orchestrator-checkpoint-walk`) wired end to end under the kernel. //! -//! The runtime owns the clock and the mapping, so the platform driver stays -//! thin: -//! - boot windows come from the device table ([`BootCheckpoint::timeout`]); -//! the platform driver only converts `core::time::Duration` to the -//! kernel's [`Duration`] at the arm site. -//! - [`BootWatchdogs::arm_boot`] takes that *relative* window; the runtime -//! computes the absolute deadline. -//! - [`BootWatchdogs::wait_deadline`] is handed straight to `object_wait`. -//! - [`BootWatchdogs::poll_expired`] yields the `Event`s the core consumes — -//! no mapping in the platform driver. +//! Scenarios 1-3 exercise `CheckpointWalk` end to end: the walk judges +//! per-checkpoint windows via `poll(now_millis)` and an `EvidenceReader`, +//! the runtime converts `deadline_millis` to kernel ticks via `object_wait`, +//! and a `DeadlineExceeded` re-poll proves the timeout path. Scenario 3 +//! drives a device-reported fault, not just silence, through that path. //! -//! Coverage: the *inner checkpoint walk* (`bl1` → `kernel`, re-armed through the -//! runtime) for a single component, the *outer component walk* across a -//! multi-component chain (nearest-of-many deadlines, correct-id recovery), and -//! the commit watchdog. The interrupt object (IRQ 44, self-fired) stands in for -//! a component reaching a checkpoint. +//! Scenarios 4-5 exercise `BootWatchdogs` multiplexing across a +//! multi-component chain (nearest-of-many deadlines, correct-id recovery). +//! Scenario 6 covers the commit watchdog. +//! +//! Scenarios 7-8 exercise recovery end to end under real kernel deadlines. +//! Scenario 7: a timeout triggers recovery, the platform restores the +//! image, the re-walk succeeds, and the component is released a second +//! time. Scenario 8: recovery reports source exhaustion immediately, and +//! the required component locks the platform down. #![no_main] #![no_std] use app_test_runtime::{constants, handle, signals}; +use board_clock::{millis_to_ticks, ticks_to_millis}; use openprot_orchestrator_server::BootWatchdogs; use openprot_orchestrator_sm::{ - Chain, ComponentAttrs, ComponentId, Effect, EffectError, Event, Orchestrator, Platform, - PowerOnResult, State, + BootFailureKind, Chain, ComponentAttrs, ComponentId, Effect, EffectError, Event, Orchestrator, + Platform, PowerOnResult, State, }; -use orchestrator_config::{BootCheckpoint, DeviceConfig}; +use orchestrator_capabilities::{BootStatus, BootWatch, EvidenceReader, FailureCause, WalkVerdict}; +use orchestrator_checkpoint_walk::CheckpointWalk; +use orchestrator_config::{assert_retry_reaches_every_image, BootCheckpoint, DeviceConfig}; use pw_status::{Error, Result}; -use userspace::time::Duration; +use userspace::time::{Clock, Duration, Instant, SystemClock}; use userspace::{entry, syscall}; /// The components this test supervises. @@ -47,6 +49,8 @@ const N: usize = 4; const E: usize = 2 * N + 2; const MAX_RETRY: u8 = 3; +const _: () = assert_retry_reaches_every_image(MAX_RETRY, &[SOC]); + /// Commit watchdog window. Not a boot window, so it stays a local constant /// rather than coming from the device table. const COMMIT_WINDOW: Duration = Duration::from_millis(50); @@ -56,14 +60,19 @@ type Watchdogs = BootWatchdogs; /// The device table: per-checkpoint windows, exactly as a board would declare /// them. Two checkpoints so the inner walk exercises re-arm-on-progress -/// (`bl1` then `kernel`). +/// (`bl1` then `kernel`). Probe ids are progress thresholds: the reader +/// reports `Booted` once its internal level reaches the threshold. const SOC: DeviceConfig = DeviceConfig::new( "soc", 0, &[ - BootCheckpoint::new("bl1", 0, core::time::Duration::from_millis(50)), - BootCheckpoint::new("kernel", 0, core::time::Duration::from_millis(50)), + BootCheckpoint::new("bl1", 1, core::time::Duration::from_millis(500)), + BootCheckpoint::new("kernel", 2, core::time::Duration::from_millis(500)), ], + // The boot walk never looks at images; no layout is legal. + None, + // Same attrs new_core gives every component in the chain. + ComponentAttrs::passive_required(), ); /// The device table speaks `core::time::Duration`; the runtime speaks the @@ -72,29 +81,118 @@ fn window(timeout: core::time::Duration) -> Duration { Duration::from_millis(timeout.as_millis() as u64) } +/// Progress-register reader for the walk: probe N is `Booted` once +/// `level >= N`. Mirrors the ProgressReader archetype in the evidence tests, +/// including its fault channel: a device that reports its own verdict reads +/// that verdict for every probe, whichever checkpoint is being awaited. +struct ProgressReader { + level: u8, + fault: Option, +} + +impl ProgressReader { + const fn new() -> Self { + Self { + level: 0, + fault: None, + } + } +} + +impl EvidenceReader for ProgressReader { + type Error = core::convert::Infallible; + + fn read(&mut self, probe: &u8) -> core::result::Result { + if let Some(fault) = self.fault { + return Ok(fault); + } + Ok(if self.level >= *probe { + BootStatus::Booted + } else { + BootStatus::Booting + }) + } +} + +/// What the simulated device does when given an opportunity to report. +#[derive(Clone, Copy)] +enum DeviceBehavior { + /// Reports progress for the first `reached` opportunities, then goes + /// quiet: `reached == len` boots, anything less times out. + Progresses { reached: usize }, + /// Reports this fault on the very first opportunity, instead of + /// progress. Exercises `CheckpointWalk`'s `FailedRetriable`/`FailedFatal` + /// arms through the real interrupt/`object_wait` path, not just through + /// `CheckpointWalk`'s own host unit tests. + Faults(BootStatus), +} + +fn failure_kind(cause: FailureCause) -> BootFailureKind { + match cause { + FailureCause::TimedOut => BootFailureKind::TimedOut, + FailureCause::DeviceRetriable => BootFailureKind::DeviceRetriable, + FailureCause::DeviceFatal => BootFailureKind::DeviceFatal, + } +} + /// A fake [`Platform`] for the run loop. It records the `ReleaseReset(id)` -/// effects that open each component's boot supervision; every other effect is -/// accepted so the core can settle. +/// effects that open each component's boot supervision and optionally +/// responds to `RecoverComponent` with restore outcomes. Every other effect +/// is accepted so the core can settle. struct FakePlatform { released: heapless::Vec, + /// Number of recovery sources the fake device has. `None` means + /// recovery always returns `Ok(None)` (scenarios that do not exercise + /// recovery). `Some(n)` returns `Restored` for `attempt < n` and + /// `RecoveryUnavailable` for `attempt >= n`. + recovery_sources: Option, + /// Attempts the SM sent, in order, for post-hoc assertions. + recovery_attempts: heapless::Vec, } impl FakePlatform { const fn new() -> Self { Self { released: heapless::Vec::new(), + recovery_sources: None, + recovery_attempts: heapless::Vec::new(), + } + } + + fn with_recovery_sources(sources: u8) -> Self { + Self { + released: heapless::Vec::new(), + recovery_sources: Some(sources), + recovery_attempts: heapless::Vec::new(), } } fn was_released(&self, id: ComponentId) -> bool { self.released.contains(&id) } + + fn release_count(&self, id: ComponentId) -> usize { + self.released.iter().filter(|&&c| c == id).count() + } } impl Platform for FakePlatform { fn execute(&mut self, effect: Effect) -> core::result::Result, EffectError> { - if let Effect::ReleaseReset(id) = effect { - let _ = self.released.push(id); + match effect { + Effect::ReleaseReset(id) => { + let _ = self.released.push(id); + } + Effect::RecoverComponent { id, attempt } => { + assert!(self.recovery_attempts.push(attempt).is_ok()); + if let Some(sources) = self.recovery_sources { + return if attempt < sources { + Ok(Some(Event::Restored(id))) + } else { + Ok(Some(Event::RecoveryUnavailable(id))) + }; + } + } + _ => {} } Ok(None) } @@ -125,47 +223,64 @@ fn drive_releases(core: &mut Core, plat: &mut FakePlatform, ids: &[ComponentId]) Ok(()) } -/// Run one component's inner checkpoint walk through the runtime and return its -/// single terminal event. `reached` simulates the device: it fires its progress -/// signal for the first `reached` checkpoints, then goes quiet — so -/// `reached == len` boots, anything less times out at checkpoint `reached`. -fn checkpoint_walk( - wd: &mut Watchdogs, +/// Run one component's inner checkpoint walk through `CheckpointWalk` and +/// return its final verdict as an event. `behavior` simulates the device: +/// it either advances its progress register or reports a fault. +/// +/// The walk judges per-checkpoint windows; the runtime (`object_wait`) just +/// sleeps until the walk's deadline or a device signal. +fn walk_device( + walk: &mut CheckpointWalk, id: ComponentId, - checkpoints: &[BootCheckpoint], - reached: usize, + behavior: DeviceBehavior, ) -> Result { + walk.start(); let mut k = 0usize; - wd.arm_boot(id, window(checkpoints[k].timeout())) - .map_err(|_| Error::ResourceExhausted)?; - loop { - // Simulated device reaching checkpoint `k`: latch its progress signal - // before the wait (interrupt objects hold it pending, so no race). - if k < reached { - syscall::debug_trigger_interrupt(constants::BOOT_PROGRESS)?; - } - let deadline = wd.wait_deadline(); - match syscall::object_wait(handle::BOOT_SIGNAL, signals::BOOT_PROGRESS, deadline) { - Ok(wait) => { - if !wait.pending_signals.contains(signals::BOOT_PROGRESS) { - return Err(Error::Internal); + loop { + let now = ticks_to_millis(SystemClock::now().ticks()); + match walk.poll(now) { + WalkVerdict::Waiting { deadline_millis } => { + // Simulate the device after the poll returned Waiting, so + // every trigger pairs with a wait+ack below. + let triggered = match behavior { + DeviceBehavior::Progresses { reached } if k < reached => { + walk.reader_mut().level = (k + 1) as u8; + true + } + DeviceBehavior::Faults(status) if k == 0 => { + walk.reader_mut().fault = Some(status); + true + } + _ => false, + }; + if triggered { + syscall::debug_trigger_interrupt(constants::BOOT_PROGRESS)?; } - syscall::interrupt_ack(handle::BOOT_SIGNAL, signals::BOOT_PROGRESS)?; - k += 1; - if k == checkpoints.len() { - wd.cancel_boot(id); - return Ok(Event::Booted(id)); + + let deadline = Instant::from_ticks(millis_to_ticks(deadline_millis)); + match syscall::object_wait(handle::BOOT_SIGNAL, signals::BOOT_PROGRESS, deadline) { + Ok(wait) => { + if !wait.pending_signals.contains(signals::BOOT_PROGRESS) { + return Err(Error::Internal); + } + syscall::interrupt_ack(handle::BOOT_SIGNAL, signals::BOOT_PROGRESS)?; + k += 1; + } + Err(Error::DeadlineExceeded) => { + // Deadline lapsed; re-poll and the walk will judge timeout. + } + Err(e) => return Err(e), } - // Forward progress: re-arm the next checkpoint through the runtime. - wd.arm_boot(id, window(checkpoints[k].timeout())) - .map_err(|_| Error::ResourceExhausted)?; } - Err(Error::DeadlineExceeded) => { - // The window lapsed: the runtime already mapped it to an `Event`. - return wd.poll_expired().ok_or(Error::Internal); + WalkVerdict::Complete => return Ok(Event::Booted(id)), + WalkVerdict::Failed { checkpoint, cause } => { + return Ok(Event::BootFailed { + id, + checkpoint, + kind: failure_kind(cause), + }); } - Err(e) => return Err(e), } } } @@ -192,14 +307,12 @@ fn confirm(wd: &mut Watchdogs, id: ComponentId) -> Result<()> { } /// Inner walk, happy path: a single component passes every checkpoint (windows -/// from the device table, re-armed through the runtime), the walk yields -/// `Booted`, and the core stays `Ready`. A late `Timeout` is then a no-op — the -/// watchdog was retired by the confirmation. +/// from the device table, judged by `CheckpointWalk`), the walk yields +/// `Booted`, and the core stays `Ready`. A late `Timeout` is then a no-op. fn scenario_checkpoint_confirmed() -> Result<()> { pw_log::info!("scenario 1: checkpoint walk confirmed"); let mut core = new_core(&[C0])?; let mut plat = FakePlatform::new(); - let mut wd = Watchdogs::new(); drive_releases(&mut core, &mut plat, &[C0])?; if core.state() != State::Ready { @@ -207,18 +320,21 @@ fn scenario_checkpoint_confirmed() -> Result<()> { return Err(Error::Internal); } - let terminal = checkpoint_walk(&mut wd, C0, SOC.checkpoints(), SOC.checkpoints().len())?; - if terminal != Event::Booted(C0) { + let mut walk = CheckpointWalk::new(ProgressReader::new(), &SOC); + let reached = SOC.checkpoints().len(); + let final_event = walk_device(&mut walk, C0, DeviceBehavior::Progresses { reached })?; + if final_event != Event::Booted(C0) { pw_log::error!("scenario 1: walk did not confirm boot"); return Err(Error::Internal); } - core.dispatch(&mut plat, terminal); + + core.dispatch(&mut plat, final_event); if core.state() != State::Ready { pw_log::error!("scenario 1: core left Ready after boot confirmed"); return Err(Error::Internal); } - // The watchdog is retired: a stale timeout must not re-open recovery. + // A stale timeout must not re-open recovery. core.dispatch(&mut plat, Event::Timeout(C0)); if core.state() != State::Ready { pw_log::error!("scenario 1: stale timeout re-opened recovery"); @@ -230,21 +346,28 @@ fn scenario_checkpoint_confirmed() -> Result<()> { } /// Inner walk, timeout path: the device never signals, the first checkpoint's -/// window lapses, the runtime surfaces `Timeout`, and the core recovers. +/// window lapses (judged by `CheckpointWalk`), and the walk surfaces +/// `BootFailed` with `TimedOut`. The core recovers from the walk's verdict. fn scenario_checkpoint_timeout() -> Result<()> { pw_log::info!("scenario 2: checkpoint walk timeout drives recovery"); let mut core = new_core(&[C0])?; let mut plat = FakePlatform::new(); - let mut wd = Watchdogs::new(); drive_releases(&mut core, &mut plat, &[C0])?; - let terminal = checkpoint_walk(&mut wd, C0, SOC.checkpoints(), 0)?; - if terminal != Event::Timeout(C0) { - pw_log::error!("scenario 2: walk did not time out"); + let mut walk = CheckpointWalk::new(ProgressReader::new(), &SOC); + let final_event = walk_device(&mut walk, C0, DeviceBehavior::Progresses { reached: 0 })?; + let is_boot_failed = matches!( + final_event, + Event::BootFailed { id, checkpoint: "bl1", kind, .. } + if id == C0 && kind == BootFailureKind::TimedOut + ); + if !is_boot_failed { + pw_log::error!("scenario 2: walk did not produce BootFailed"); return Err(Error::Internal); } - core.dispatch(&mut plat, terminal); + + core.dispatch(&mut plat, final_event); if core.state() != State::Recovering(C0) { pw_log::error!("scenario 2: core did not enter recovery"); return Err(Error::Internal); @@ -254,17 +377,69 @@ fn scenario_checkpoint_timeout() -> Result<()> { Ok(()) } +/// Inner walk, device-fault path: the device is up enough to report its own +/// verdict. The walk surfaces `BootFailed` with `DeviceFatal`, and — the point +/// of the scenario — it does so *early*, without burning the checkpoint's +/// window, which is what distinguishes a reported fault from silence. +fn scenario_checkpoint_device_fault() -> Result<()> { + pw_log::info!("scenario 3: device-reported fault ends the wait early"); + let mut core = new_core(&[C0])?; + let mut plat = FakePlatform::new(); + + drive_releases(&mut core, &mut plat, &[C0])?; + + let mut walk = CheckpointWalk::new(ProgressReader::new(), &SOC); + let start = ticks_to_millis(SystemClock::now().ticks()); + let final_event = walk_device( + &mut walk, + C0, + DeviceBehavior::Faults(BootStatus::FailedFatal), + )?; + let elapsed = ticks_to_millis(SystemClock::now().ticks()).saturating_sub(start); + + let is_fatal = matches!( + final_event, + Event::BootFailed { id, checkpoint: "bl1", kind, .. } + if id == C0 && kind == BootFailureKind::DeviceFatal + ); + if !is_fatal { + pw_log::error!("scenario 3: walk did not surface the device's fatal verdict"); + return Err(Error::Internal); + } + + // The checkpoint's window is 500ms; a fault-ended wait should finish in a + // small fraction of that. A silence-driven timeout (scenario 2) can only + // finish once the full window lapses, so this margin is generous enough to + // distinguish the two without being flaky. + if elapsed >= 100 { + pw_log::error!( + "scenario 3: fault took {}ms, did not end the wait early", + elapsed as u32 + ); + return Err(Error::Internal); + } + + core.dispatch(&mut plat, final_event); + if core.state() != State::Recovering(C0) { + pw_log::error!("scenario 3: core did not enter recovery"); + return Err(Error::Internal); + } + + pw_log::info!("scenario 3: PASS"); + Ok(()) +} + /// Outer walk, all confirm: a two-component chain, both boot watchdogs armed at /// once, both components report in, the core reaches `Ready`. fn scenario_chain_all_confirm() -> Result<()> { - pw_log::info!("scenario 3: multi-component chain all confirm"); + pw_log::info!("scenario 4: multi-component chain all confirm"); let mut core = new_core(&[C0, C1])?; let mut plat = FakePlatform::new(); let mut wd = Watchdogs::new(); drive_releases(&mut core, &mut plat, &[C0, C1])?; if core.state() != State::Ready { - pw_log::error!("scenario 3: chain did not reach Ready on release"); + pw_log::error!("scenario 4: chain did not reach Ready on release"); return Err(Error::Internal); } @@ -281,11 +456,11 @@ fn scenario_chain_all_confirm() -> Result<()> { core.dispatch(&mut plat, Event::Booted(C1)); if core.state() != State::Ready { - pw_log::error!("scenario 3: core left Ready after both booted"); + pw_log::error!("scenario 4: core left Ready after both booted"); return Err(Error::Internal); } - pw_log::info!("scenario 3: PASS"); + pw_log::info!("scenario 4: PASS"); Ok(()) } @@ -293,7 +468,7 @@ fn scenario_chain_all_confirm() -> Result<()> { /// quiet. With only `C1` left, the runtime's nearest deadline is `C1`'s; it /// lapses and `poll_expired` surfaces `Timeout(C1)`, recovering the right one. fn scenario_chain_one_timeout() -> Result<()> { - pw_log::info!("scenario 4: multi-component chain, one times out"); + pw_log::info!("scenario 5: multi-component chain, one times out"); let mut core = new_core(&[C0, C1])?; let mut plat = FakePlatform::new(); let mut wd = Watchdogs::new(); @@ -316,13 +491,13 @@ fn scenario_chain_one_timeout() -> Result<()> { wd.wait_deadline(), ) { Ok(_) => { - pw_log::error!("scenario 4: unexpected signal, C1's device is quiet"); + pw_log::error!("scenario 5: unexpected signal, C1's device is quiet"); return Err(Error::Internal); } Err(Error::DeadlineExceeded) => { let event = wd.poll_expired().ok_or(Error::Internal)?; if event != Event::Timeout(C1) { - pw_log::error!("scenario 4: runtime timed out the wrong component"); + pw_log::error!("scenario 5: runtime timed out the wrong component"); return Err(Error::Internal); } core.dispatch(&mut plat, event); @@ -331,11 +506,11 @@ fn scenario_chain_one_timeout() -> Result<()> { } if core.state() != State::Recovering(C1) { - pw_log::error!("scenario 4: core did not recover C1"); + pw_log::error!("scenario 5: core did not recover C1"); return Err(Error::Internal); } - pw_log::info!("scenario 4: PASS"); + pw_log::info!("scenario 5: PASS"); Ok(()) } @@ -343,7 +518,7 @@ fn scenario_chain_one_timeout() -> Result<()> { /// against the real clock, and confirm the runtime surfaces `CommitTimeout` /// (and nothing more). fn scenario_commit_timeout() -> Result<()> { - pw_log::info!("scenario 5: commit watchdog surfaces CommitTimeout"); + pw_log::info!("scenario 6: commit watchdog surfaces CommitTimeout"); let mut wd = Watchdogs::new(); wd.arm_commit(COMMIT_WINDOW); @@ -353,12 +528,12 @@ fn scenario_commit_timeout() -> Result<()> { wd.wait_deadline(), ) { Ok(_) => { - pw_log::error!("scenario 5: unexpected signal, no device is armed"); + pw_log::error!("scenario 6: unexpected signal, no device is armed"); return Err(Error::Internal); } Err(Error::DeadlineExceeded) => { if wd.poll_expired() != Some(Event::CommitTimeout) { - pw_log::error!("scenario 5: runtime did not surface CommitTimeout"); + pw_log::error!("scenario 6: runtime did not surface CommitTimeout"); return Err(Error::Internal); } } @@ -367,20 +542,133 @@ fn scenario_commit_timeout() -> Result<()> { // One-shot: the watchdog is drained, nothing more is due. if wd.poll_expired().is_some() { - pw_log::error!("scenario 5: commit watchdog fired twice"); + pw_log::error!("scenario 6: commit watchdog fired twice"); return Err(Error::Internal); } - pw_log::info!("scenario 5: PASS"); + pw_log::info!("scenario 6: PASS"); + Ok(()) +} + +/// Timeout → recovery → re-walk → confirmed. The point of this scenario is +/// that the whole recovery cycle, re-verification, second release, and +/// re-walked boot all run under real kernel deadlines, not just in the pure +/// SM unit tests. The sharp check is that C0 is released twice: once during +/// the initial walk and again after recovery. +fn scenario_recovery_succeeds() -> Result<()> { + pw_log::info!("scenario 7: recovery succeeds, re-walk confirms boot"); + let mut core = new_core(&[C0])?; + let mut plat = FakePlatform::with_recovery_sources(1); + + drive_releases(&mut core, &mut plat, &[C0])?; + + let mut walk = CheckpointWalk::new(ProgressReader::new(), &SOC); + let final_event = walk_device(&mut walk, C0, DeviceBehavior::Progresses { reached: 0 })?; + let is_timeout = matches!( + final_event, + Event::BootFailed { id, kind, .. } if id == C0 && kind == BootFailureKind::TimedOut + ); + if !is_timeout { + pw_log::error!("scenario 7: expected timeout"); + return Err(Error::Internal); + } + + // Dispatch the timeout. The SM enters Recovering(C0), emits + // RecoverComponent { attempt: 0 }, and FakePlatform returns + // Restored(C0). The SM then re-enters PreSupervision, emits + // ReadFirmware + VerifyFirmware. All in one dispatch cycle. + core.dispatch(&mut plat, final_event); + if core.state() != State::PreSupervision { + pw_log::error!("scenario 7: expected PreSupervision after restore"); + return Err(Error::Internal); + } + + if plat.recovery_attempts.as_slice() != &[0] { + pw_log::error!("scenario 7: expected one attempt at index 0"); + return Err(Error::Internal); + } + + // Re-verify: the SM already emitted VerifyFirmware(C0) during the + // PreSupervision entry, so the platform is waiting for the verdict. + core.dispatch(&mut plat, Event::VerificationPassed(C0)); + if plat.release_count(C0) != 2 { + pw_log::error!( + "scenario 7: expected two releases for C0, got {}", + plat.release_count(C0) as u32 + ); + return Err(Error::Internal); + } + if core.state() != State::Ready { + pw_log::error!("scenario 7: core did not reach Ready after re-release"); + return Err(Error::Internal); + } + + // Re-walk: the device boots this time. + walk = CheckpointWalk::new(ProgressReader::new(), &SOC); + let reached = SOC.checkpoints().len(); + let final_event = walk_device(&mut walk, C0, DeviceBehavior::Progresses { reached })?; + if final_event != Event::Booted(C0) { + pw_log::error!("scenario 7: re-walk did not confirm boot"); + return Err(Error::Internal); + } + core.dispatch(&mut plat, final_event); + if core.state() != State::Ready { + pw_log::error!("scenario 7: core left Ready after re-walk boot"); + return Err(Error::Internal); + } + + pw_log::info!("scenario 7: PASS"); + Ok(()) +} + +/// Recovery source exhausted immediately → required component locks down. +/// Uses `RecoveryUnavailable` (zero sources) so the path settles in one +/// dispatch cycle without burning MAX_RETRY × 500ms walk windows. +fn scenario_recovery_exhausted_locks() -> Result<()> { + pw_log::info!("scenario 8: recovery exhausted, required component locks"); + let mut core = new_core(&[C0])?; + let mut plat = FakePlatform::with_recovery_sources(0); + + drive_releases(&mut core, &mut plat, &[C0])?; + + let mut walk = CheckpointWalk::new(ProgressReader::new(), &SOC); + let final_event = walk_device(&mut walk, C0, DeviceBehavior::Progresses { reached: 0 })?; + let is_timeout = matches!( + final_event, + Event::BootFailed { id, kind, .. } if id == C0 && kind == BootFailureKind::TimedOut + ); + if !is_timeout { + pw_log::error!("scenario 8: expected timeout"); + return Err(Error::Internal); + } + + // Dispatch the timeout. RecoverComponent { attempt: 0 } → + // RecoveryUnavailable(C0) → exhaust_recovery → ReportRecoveryFailed → + // RecoveryFailed → Locked. All in one dispatch cycle. + core.dispatch(&mut plat, final_event); + if core.state() != State::Locked { + pw_log::error!("scenario 8: expected Locked after exhaustion"); + return Err(Error::Internal); + } + + if plat.recovery_attempts.as_slice() != &[0] { + pw_log::error!("scenario 8: expected one attempt at index 0"); + return Err(Error::Internal); + } + + pw_log::info!("scenario 8: PASS"); Ok(()) } fn run_test() -> Result<()> { scenario_checkpoint_confirmed()?; scenario_checkpoint_timeout()?; + scenario_checkpoint_device_fault()?; scenario_chain_all_confirm()?; scenario_chain_one_timeout()?; scenario_commit_timeout()?; + scenario_recovery_succeeds()?; + scenario_recovery_exhausted_locks()?; Ok(()) } diff --git a/target/ast10x0/tests/peripherals/gpio/gpio_irq/BUILD.bazel b/target/ast10x0/tests/peripherals/gpio/gpio_irq/BUILD.bazel index c2ae98ac5..353573e4e 100644 --- a/target/ast10x0/tests/peripherals/gpio/gpio_irq/BUILD.bazel +++ b/target/ast10x0/tests/peripherals/gpio/gpio_irq/BUILD.bazel @@ -8,6 +8,7 @@ load("@pigweed//pw_kernel/tooling:target_linker_script.bzl", "target_linker_scri load("@pigweed//pw_kernel/tooling/panic_detector:rust_binary_no_panics_test.bzl", "rust_binary_no_panics_test") load("@rules_rust//rust:defs.bzl", "rust_binary") load("//target/ast10x0:defs.bzl", "TARGET_COMPATIBLE_WITH", "system_image_test") +load("//util/region:defs.bzl", "app_regions") package(default_visibility = ["//visibility:public"]) @@ -40,6 +41,7 @@ rust_binary( deps = [ ":codegen", ":linker_script", + "//hal", "//target/ast10x0:entry", "//target/ast10x0/peripherals", "@pigweed//pw_kernel/arch/arm_cortex_m:arch_arm_cortex_m", @@ -50,6 +52,15 @@ rust_binary( ], ) +app_regions( + name = "app_gpio_irq_server_regions", + app_name = "gpio_irq_server", + edition = "2024", + system_config = ":system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, +) + rust_app( name = "gpio_irq_server", srcs = ["gpio_irq_server_main.rs"], @@ -59,6 +70,7 @@ rust_app( tags = ["kernel"], target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ + ":app_gpio_irq_server_regions", "//target/ast10x0/peripherals", "@ast1060_pac", "@pigweed//pw_kernel/userspace", diff --git a/target/ast10x0/tests/peripherals/gpio/gpio_irq/gpio_irq_server_main.rs b/target/ast10x0/tests/peripherals/gpio/gpio_irq/gpio_irq_server_main.rs index 95cea55f2..d4a497664 100644 --- a/target/ast10x0/tests/peripherals/gpio/gpio_irq/gpio_irq_server_main.rs +++ b/target/ast10x0/tests/peripherals/gpio/gpio_irq/gpio_irq_server_main.rs @@ -7,13 +7,13 @@ #![no_std] use app_gpio_irq_server::{handle, signals}; -use ast10x0_peripherals::gpio::{gpioa, GpioExt, InterruptMode}; +use app_gpio_irq_server_regions::take_mmaps; +use ast10x0_peripherals::create_pins; +use ast10x0_peripherals::gpio::{bind_gpio, GpioBlock, IntTrigger}; use pw_status::Error; use userspace::entry; use userspace::syscall; -const GPIOA0_MASK: u32 = 1; - macro_rules! fail { ($($arg:tt)*) => {{ pw_log::error!($($arg)*); @@ -25,10 +25,14 @@ macro_rules! fail { #[entry] fn entry() { - // SAFETY: this process exclusively owns the GPIO device mapping declared - // in system.json5. - let gpioa = unsafe { gpioa::GPIOA::new_global().split() }; - let mut pa0 = gpioa.pa0.into_pull_down_input(); + // The kernel side routed this pin at the SCU before starting us; userspace has no SCU grant, so + // we bind the already-routed pin rather than re-muxing it. + // SAFETY: sole pin creation site in this binary, at boot; the pins! table is this chip's true pin map. + let pins = unsafe { create_pins() }; + // SAFETY: mints this process's mappings once, at its entry point. + let mmaps = unsafe { take_mmaps() }; + let gpio = GpioBlock::new(mmaps.gpio_regs); + let a0 = bind_gpio(pins.scu410_0, &gpio).into_input(); if syscall::wait_group_add( handle::WG, @@ -41,37 +45,29 @@ fn entry() { fail!("wait_group_add failed"); } - pa0.clear_interrupt(); - pa0.set_interrupt_mode(InterruptMode::EdgeBoth); + a0.ack(a0.map().int_status); + a0.enable_interrupt(IntTrigger::Both); if syscall::interrupt_ack(handle::GPIO_IRQ, signals::GPIO).is_err() { fail!("initial interrupt_ack failed"); } - // SAFETY: the GPIO register block is mapped exclusively into this process. - let registers = unsafe { &*ast1060_pac::Gpio::ptr() }; - let int_en = registers.gpio008().read().bits(); - let sensitivity2 = registers.gpio014().read().bits(); - let int_status = registers.gpio018().read().bits(); + let int_en = a0.read(a0.map().int_enable); + let both_edge = a0.read(a0.map().sense_both); + let pending = a0.read(a0.map().int_status); pw_log::info!( - "GPIO IRQ state: int_en=0x{:08x} sensitivity2=0x{:08x} status=0x{:08x}", + "GPIO IRQ state: int_en={} sensitivity2={} status={}", int_en as u32, - sensitivity2 as u32, - int_status as u32, + both_edge as u32, + pending as u32, ); - if int_en & GPIOA0_MASK != GPIOA0_MASK { - fail!( - "GPIOA0 interrupt not enabled: int_en=0x{:08x}", - int_en as u32 - ); + if !int_en { + fail!("GPIOA0 interrupt not enabled"); } - if sensitivity2 & GPIOA0_MASK != GPIOA0_MASK { - fail!( - "GPIOA0 both-edge sensitivity not configured: sensitivity2=0x{:08x}", - sensitivity2 as u32 - ); + if !both_edge { + fail!("GPIOA0 both-edge sensitivity not configured"); } pw_log::info!("PASS: GPIO IRQ configuration verified"); diff --git a/target/ast10x0/tests/peripherals/gpio/gpio_irq/target.rs b/target/ast10x0/tests/peripherals/gpio/gpio_irq/target.rs index 09133de81..692dead52 100644 --- a/target/ast10x0/tests/peripherals/gpio/gpio_irq/target.rs +++ b/target/ast10x0/tests/peripherals/gpio/gpio_irq/target.rs @@ -6,7 +6,9 @@ #![no_std] #![no_main] -use ast10x0_peripherals::scu::{pinctrl, ScuRegisters}; +use ast10x0_peripherals::aperture::take_aperture; +use ast10x0_peripherals::gpio::{GpioBlock, IntoGpio}; +use ast10x0_peripherals::scu::{self, create_pins}; use console_backend::console_backend_write_all; use entry as _; use target_common::{declare_target, TargetInterface}; @@ -17,11 +19,13 @@ impl TargetInterface for Target { const NAME: &'static str = "AST10x0 GPIO IRQ Bringup"; fn main() -> ! { - // SAFETY: single call at boot with exclusive access to SCU global registers. - unsafe { - let scu = ScuRegisters::new_global_unlocked(); - scu.apply_pinctrl_group(pinctrl::PINCTRL_GPIOA0); - } + // Create the pin, bind it to GPIO, and route it; its `COALESCED` route folds at compile time. + // SAFETY: sole pin creation site in this binary, at boot; the pins! table is this chip's true pin map. + let pins = unsafe { create_pins() }; + // SAFETY: kernel-only binary, minted once; no process holds a conflicting grant. + let gpio = GpioBlock::new(unsafe { take_aperture() }); + let _gpio = pins.scu410_0.into_gpio(&gpio); + scu::route(&_gpio); codegen::start(); #[expect(clippy::empty_loop)] diff --git a/target/ast10x0/tests/peripherals/gpio/gpio_smoke/BUILD.bazel b/target/ast10x0/tests/peripherals/gpio/gpio_smoke/BUILD.bazel index f246cc0fe..43f9c3a4e 100644 --- a/target/ast10x0/tests/peripherals/gpio/gpio_smoke/BUILD.bazel +++ b/target/ast10x0/tests/peripherals/gpio/gpio_smoke/BUILD.bazel @@ -36,6 +36,7 @@ rust_binary( deps = [ ":codegen", ":linker_script", + "//hal", "//target/ast10x0:entry", "//target/ast10x0/peripherals", "@pigweed//pw_kernel/arch/arm_cortex_m:arch_arm_cortex_m", diff --git a/target/ast10x0/tests/peripherals/gpio/gpio_smoke/target.rs b/target/ast10x0/tests/peripherals/gpio/gpio_smoke/target.rs index 15e9192b8..d0891ee8e 100644 --- a/target/ast10x0/tests/peripherals/gpio/gpio_smoke/target.rs +++ b/target/ast10x0/tests/peripherals/gpio/gpio_smoke/target.rs @@ -6,65 +6,71 @@ #![no_std] #![no_main] -use ast10x0_peripherals::gpio::{gpioa, ActiveLow, GpioExt}; -use ast10x0_peripherals::scu::{pinctrl, ScuRegisters}; +use ast10x0_peripherals::aperture::take_aperture; +use ast10x0_peripherals::create_pins; +use ast10x0_peripherals::gpio::{GpioBlock, IntoGpio, OutputPin}; +use ast10x0_peripherals::scu; use console_backend::console_backend_write_all; -use embedded_hal::digital::{InputPin, OutputPin, StatefulOutputPin}; use target_common::{declare_target, TargetInterface}; use {console_backend as _, entry as _}; pub struct Target {} fn run_gpioa_test() -> bool { - // SAFETY: this kernel-only test is the sole owner of the SCU and GPIO peripherals. - let gpioa = unsafe { - let scu = ScuRegisters::new_global_unlocked(); - scu.apply_pinctrl_group(pinctrl::PINCTRL_GPIOA0); - scu.apply_pinctrl_group(pinctrl::PINCTRL_GPIOA1); - scu.apply_pinctrl_group(pinctrl::PINCTRL_GPIOA3); - scu.apply_pinctrl_group(pinctrl::PINCTRL_GPIOA4); - gpioa::GPIOA::new_global().split() - }; + // SAFETY: created once, exclusive SoC access; the pins! table is this chip's true pin map. + let pins = unsafe { create_pins() }; + // SAFETY: kernel-only binary, minted once; no process holds a conflicting grant. + let gpio = GpioBlock::new(unsafe { take_aperture() }); + let a0 = pins.scu410_0.into_gpio(&gpio); + let a1 = pins.scu410_1.into_gpio(&gpio); + let a3 = pins.scu410_3.into_gpio(&gpio); + let a4 = pins.scu410_4.into_gpio(&gpio); + // Each handle carries its route at the type level; the tuple's `COALESCED` folds them to the + // minimal set of RMWs at compile time — apply once. + scu::route(&(&a0, &a1, &a3, &a4)); pw_log::info!("=== AST10x0 GPIOA smoke test ==="); - // AST1060 does not provide internal pull-up or pull-down control for these - // GPIO inputs. Their sampled levels are determined by external connections, - // so either 0 or 1 is valid in this configuration test. - let mut pa0 = gpioa.pa0.into_pull_down_input(); - let pa0_level = pa0.is_high().unwrap_or(false); + // AST1060 has no internal pull control on these inputs, so their sampled level is set by external + // wiring — either value is valid. Configure as input and log the live level; do not assert. + let a0 = a0.into_input(); pw_log::info!( - "GPIOA0 input configured; sampled level={}", - pa0_level as u32 + "GPIOA0 input sampled level={}", + a0.read(a0.map().in_level) as u32 ); - let mut pa1 = gpioa.pa1.into_pull_up_input(); - let pa1_level = pa1.is_high().unwrap_or(false); + let a1 = a1.into_input(); pw_log::info!( - "GPIOA1 input configured; sampled level={}", - pa1_level as u32 + "GPIOA1 input sampled level={}", + a1.read(a1.map().in_level) as u32 ); - let mut pa3 = gpioa.pa3.into_open_drain_output::(); - if pa3.set_low().is_err() || !pa3.is_set_low().unwrap_or(false) { + // Outputs are verified against the output latch (`OUT_LEVEL`), which is wiring-independent — an + // open-drain high floats the pin, so reading the live level would depend on an external pull-up. + let mut a3 = a3.into_output(); + let _ = a3.set_low(); + if a3.read(a3.map().out_level) { pw_log::error!("GPIOA3 open-drain output did not latch low"); return false; } pw_log::info!("GPIOA3 open-drain output latched low"); - if pa3.set_high().is_err() || !pa3.is_set_high().unwrap_or(false) { + let _ = a3.set_high(); + if !a3.read(a3.map().out_level) { pw_log::error!("GPIOA3 open-drain output did not latch high"); return false; } pw_log::info!("GPIOA3 open-drain output latched high"); - let mut pa4 = gpioa.pa4.into_push_pull_output(); - if pa4.set_low().is_err() || !pa4.is_set_low().unwrap_or(false) { + let mut a4 = a4.into_output(); + let _ = a4.set_low(); + if a4.read(a4.map().out_level) { pw_log::error!("GPIOA4 push-pull output did not latch low"); return false; } pw_log::info!("GPIOA4 push-pull output latched low"); - if pa4.set_high().is_err() || !pa4.is_set_high().unwrap_or(false) { + let _ = a4.set_high(); + if !a4.read(a4.map().out_level) { pw_log::error!("GPIOA4 push-pull output did not latch high"); return false; } diff --git a/target/ast10x0/tests/peripherals/gpio/gpioi_loopback/BUILD.bazel b/target/ast10x0/tests/peripherals/gpio/gpioi_loopback/BUILD.bazel index 23a6f6b35..7b9afabeb 100644 --- a/target/ast10x0/tests/peripherals/gpio/gpioi_loopback/BUILD.bazel +++ b/target/ast10x0/tests/peripherals/gpio/gpioi_loopback/BUILD.bazel @@ -36,6 +36,7 @@ rust_binary( deps = [ ":codegen", ":linker_script", + "//hal", "//target/ast10x0:entry", "//target/ast10x0/peripherals", "@pigweed//pw_kernel/arch/arm_cortex_m:arch_arm_cortex_m", @@ -44,7 +45,6 @@ rust_binary( "@pigweed//pw_kernel/target:target_common", "@pigweed//pw_log/rust:pw_log", "@rust_crates//:cortex-m", - "@rust_crates//:embedded-hal", ], ) diff --git a/target/ast10x0/tests/peripherals/gpio/gpioi_loopback/target.rs b/target/ast10x0/tests/peripherals/gpio/gpioi_loopback/target.rs index dca15d638..b19e63946 100644 --- a/target/ast10x0/tests/peripherals/gpio/gpioi_loopback/target.rs +++ b/target/ast10x0/tests/peripherals/gpio/gpioi_loopback/target.rs @@ -6,10 +6,11 @@ #![no_std] #![no_main] -use ast10x0_peripherals::gpio::{gpioi, GpioExt, InterruptMode}; -use ast10x0_peripherals::scu::{pinctrl, ScuRegisters}; +use ast10x0_peripherals::aperture::take_aperture; +use ast10x0_peripherals::create_pins; +use ast10x0_peripherals::gpio::{GpioBlock, IntTrigger, IntoGpio, OutputPin}; +use ast10x0_peripherals::scu; use console_backend::console_backend_write_all; -use embedded_hal::digital::{InputPin, OutputPin}; use target_common::{declare_target, TargetInterface}; use {console_backend as _, entry as _}; @@ -18,42 +19,38 @@ pub struct Target {} const GPIO_LEVEL_DELAY_CYCLES: u32 = 200_000_000; fn test_gpio_loopback() -> bool { - // The loopback requires a jumper between the fixture board's exposed - // GPIOI0/I2C2 SCL pin and GPIOI1/I2C2 SDA pin. - let gpioi = unsafe { - let scu = ScuRegisters::new_global_unlocked(); - scu.apply_pinctrl_group(pinctrl::PINCTRL_GPIOI0); - scu.apply_pinctrl_group(pinctrl::PINCTRL_GPIOI1); - gpioi::GPIOI::new_global().split() - }; + // Jumper: GPIOH4/SCL1 <-> GPIOH5/SDA1 (J16 pins 1-4, rot-ast-ctrl); other teams swap to GPIOI0/I1 (scu418_0/scu418_1). + // SAFETY: created once at boot, exclusive SoC access; the pins! table is this chip's true pin map. + let pins = unsafe { create_pins() }; + // SAFETY: kernel-only binary, minted once; no process holds a conflicting grant. + let gpio = GpioBlock::new(unsafe { take_aperture() }); + let output = pins.scu414_28.into_gpio(&gpio); + let input = pins.scu414_29.into_gpio(&gpio); + scu::route(&(&output, &input)); pw_log::info!("--- GPIOI loopback test ---"); - let mut output = gpioi.pi0.into_push_pull_output(); - let mut input = gpioi.pi1.into_pull_down_input(); + let mut output = output.into_output(); + let input = input.into_input(); let interrupt_cases = [ - ("level-high", InterruptMode::LevelHigh, false, true), - ("level-low", InterruptMode::LevelLow, true, false), - ("rising-edge", InterruptMode::EdgeRising, false, true), - ("falling-edge", InterruptMode::EdgeFalling, true, false), - ("both-edge rising", InterruptMode::EdgeBoth, false, true), - ("both-edge falling", InterruptMode::EdgeBoth, true, false), + ("level-high", IntTrigger::LevelHigh, false, true), + ("level-low", IntTrigger::LevelLow, true, false), + ("rising-edge", IntTrigger::Rising, false, true), + ("falling-edge", IntTrigger::Falling, true, false), + ("both-edge rising", IntTrigger::Both, false, true), + ("both-edge falling", IntTrigger::Both, true, false), ]; for (name, mode, initial_high, trigger_high) in interrupt_cases { pw_log::info!("=== Testing GPIOI1 {} interrupt ===", name as &str); - input.set_interrupt_mode(InterruptMode::Disabled); - input.clear_interrupt(); + input.disable_interrupt(); + input.ack(input.map().int_status); - let initial_result = if initial_high { - output.set_high() + if initial_high { + let _ = output.set_high(); } else { - output.set_low() - }; - if initial_result.is_err() { - pw_log::error!("{}: GPIOI0 could not drive initial level", name as &str); - return false; + let _ = output.set_low(); } let initial_level = if initial_high { "high" } else { "low" }; pw_log::info!( @@ -64,9 +61,9 @@ fn test_gpio_loopback() -> bool { cortex_m::asm::delay(GPIO_LEVEL_DELAY_CYCLES); let input_matches = if initial_high { - input.is_high().unwrap_or(false) + input.read(input.map().in_level) } else { - input.is_low().unwrap_or(false) + !input.read(input.map().in_level) }; if !input_matches { pw_log::error!("{}: input and output GPIO level mismatch", name as &str); @@ -78,23 +75,18 @@ fn test_gpio_loopback() -> bool { initial_level as &str ); - input.clear_interrupt(); - input.set_interrupt_mode(mode); - if input.get_interrupt_status() { + input.ack(input.map().int_status); + input.enable_interrupt(mode); + if input.read(input.map().int_status) { pw_log::error!("{}: interrupt pending before trigger", name as &str); - input.set_interrupt_mode(InterruptMode::Disabled); + input.disable_interrupt(); return false; } - let trigger_result = if trigger_high { - output.set_high() + if trigger_high { + let _ = output.set_high(); } else { - output.set_low() - }; - if trigger_result.is_err() { - pw_log::error!("{}: GPIOI0 could not drive trigger level", name as &str); - input.set_interrupt_mode(InterruptMode::Disabled); - return false; + let _ = output.set_low(); } let trigger_level = if trigger_high { "high" } else { "low" }; pw_log::info!( @@ -105,13 +97,13 @@ fn test_gpio_loopback() -> bool { cortex_m::asm::delay(GPIO_LEVEL_DELAY_CYCLES); let input_matches = if trigger_high { - input.is_high().unwrap_or(false) + input.read(input.map().in_level) } else { - input.is_low().unwrap_or(false) + !input.read(input.map().in_level) }; if !input_matches { pw_log::error!("{}: input and output GPIO level mismatch", name as &str); - input.set_interrupt_mode(InterruptMode::Disabled); + input.disable_interrupt(); return false; } pw_log::info!( @@ -120,18 +112,18 @@ fn test_gpio_loopback() -> bool { trigger_level as &str ); - if !input.get_interrupt_status() { + if !input.read(input.map().int_status) { pw_log::error!("{}: interrupt status was not set", name as &str); - input.set_interrupt_mode(InterruptMode::Disabled); + input.disable_interrupt(); return false; } pw_log::info!("GPIOI1 {} interrupt status set", name as &str); // Disable level-sensitive modes before clearing so an active level // cannot immediately reassert the status bit. - input.set_interrupt_mode(InterruptMode::Disabled); - input.clear_interrupt(); - if input.get_interrupt_status() { + input.disable_interrupt(); + input.ack(input.map().int_status); + if input.read(input.map().int_status) { pw_log::error!("{}: interrupt status did not clear", name as &str); return false; } @@ -142,7 +134,7 @@ fn test_gpio_loopback() -> bool { fn run_gpioi_loopback_test() -> bool { pw_log::info!("=== AST10x0 GPIOI loopback test ==="); - // connect a jumper between the exposed GPIOI0/I2C2 SCL and GPIOI1/I2C2 SDA pins to verify the loopback. + // connect a jumper between GPIOH4/SCL1 and GPIOH5/SDA1 (or GPIOI0/I1 for other teams) to verify the loopback. test_gpio_loopback() } diff --git a/target/ast10x0/tests/peripherals/hace/hace_aes/target.rs b/target/ast10x0/tests/peripherals/hace/hace_aes/target.rs index 60fc8d8ba..379bdf657 100644 --- a/target/ast10x0/tests/peripherals/hace/hace_aes/target.rs +++ b/target/ast10x0/tests/peripherals/hace/hace_aes/target.rs @@ -93,7 +93,6 @@ fn run_hace_aes_kats() -> Result<(), &'static str> { let board = Ast10x0Board::new(Ast10x0BoardDescriptor { pinctrl_groups: &[], - i2c_buses: &[], }); // SAFETY: test runs once at boot with exclusive access to the board. unsafe { diff --git a/target/ast10x0/tests/peripherals/hace/hace_sha256/target.rs b/target/ast10x0/tests/peripherals/hace/hace_sha256/target.rs index 5bec4b8f8..e760cdf97 100644 --- a/target/ast10x0/tests/peripherals/hace/hace_sha256/target.rs +++ b/target/ast10x0/tests/peripherals/hace/hace_sha256/target.rs @@ -138,7 +138,6 @@ fn run_hace_sha2_kats() -> Result<(), &'static str> { let board = Ast10x0Board::new(Ast10x0BoardDescriptor { pinctrl_groups: &[], - i2c_buses: &[], }); // SAFETY: test runs once at boot with exclusive access to the board. unsafe { diff --git a/target/ast10x0/tests/peripherals/i2c/i2c_dma_abort/master_target.rs b/target/ast10x0/tests/peripherals/i2c/i2c_dma_abort/master_target.rs index 7f0677c4d..188346de9 100644 --- a/target/ast10x0/tests/peripherals/i2c/i2c_dma_abort/master_target.rs +++ b/target/ast10x0/tests/peripherals/i2c/i2c_dma_abort/master_target.rs @@ -8,7 +8,7 @@ //! //! - **Phase 1 (commit / no-op):** a DMA `write()` to a responsive slave `0x42` //! completes with `Ok`. The transfer's `wait_completion` returns cleanly, so the -//! guard is `commit()`ed and its teardown never runs — the happy path still works +//! guard is forgotten and its teardown never runs — the happy path still works //! and the engine is not spuriously reset. //! - **Phase 2 (timeout → auto-teardown):** device B stops servicing and holds SCL //! low. The DMA `write()` cannot complete, `wait_completion` times out, and the @@ -24,6 +24,7 @@ #![no_main] use ast10x0_board::{Ast10x0Board, Ast10x0BoardDescriptor}; +use ast10x0_peripherals::create_pins; use ast10x0_peripherals::i2c::{ Ast1060I2c, Ast1060I2cRegisters, ClockConfig, I2cConfig, I2cError, I2cSpeed, I2cXferMode, }; @@ -97,14 +98,14 @@ fn run_master() -> Result<(), &'static str> { let board = Ast10x0Board::new(Ast10x0BoardDescriptor { pinctrl_groups: &[pinctrl::PINCTRL_I2C2], - i2c_buses: &[], }); // SAFETY: single call at boot with exclusive access to SCU/I2C global regs. unsafe { board.init() }.map_err(|_| "board init failed")?; - // SAFETY: I2C2 registers accessed only through `master` for this test. - let mmio = - unsafe { Ast1060I2cRegisters::new(ast1060_pac::I2c2::ptr(), ast1060_pac::I2cbuff2::ptr()) }; + // SAFETY: sole pin creation site in this binary, at boot; the pins! table is this chip's true pin map. + let pins = unsafe { create_pins() }; + // Naming Bus 2's SCL/SDA pins binds that controller's registers at compile time. + let mmio = Ast1060I2cRegisters::from_pins(&pins.scu418_0, &pins.scu418_1); // SAFETY: both buffers are non-cached SRAM statics uniquely owned by this // driver for the test's lifetime. let master_dma_buf: &'static mut [u8] = diff --git a/target/ast10x0/tests/peripherals/i2c/i2c_dma_abort/target.rs b/target/ast10x0/tests/peripherals/i2c/i2c_dma_abort/target.rs index 21ab25f0a..8446c01c9 100644 --- a/target/ast10x0/tests/peripherals/i2c/i2c_dma_abort/target.rs +++ b/target/ast10x0/tests/peripherals/i2c/i2c_dma_abort/target.rs @@ -22,7 +22,8 @@ #![no_std] #![no_main] -use ast10x0_board::{Ast10x0Board, Ast10x0BoardDescriptor, I2cBusCfg}; +use ast10x0_board::{Ast10x0Board, Ast10x0BoardDescriptor}; +use ast10x0_peripherals::create_pins; use ast10x0_peripherals::i2c::{ClockConfig, I2cConfig, I2cError, I2cSpeed, I2cXferMode}; use ast10x0_peripherals::scu::pinctrl; use codegen as _; @@ -69,19 +70,18 @@ fn setup_and_serve_one() -> Result { let board = Ast10x0Board::new(Ast10x0BoardDescriptor { pinctrl_groups: &[pinctrl::PINCTRL_I2C2], - i2c_buses: &[I2cBusCfg { - bus: 2, - config: SLAVE_CFG, - }], }); // SAFETY: single call at boot with exclusive access to the board. unsafe { board.init() }.map_err(|_| "board init failed")?; - // SAFETY: board.init() ran init_bus(2); we are the sole owner of Bus 2. - let mut driver = unsafe { i2c_backend::open_bus(2, &SLAVE_CFG) }.map_err(|e| { - pw_log::error!("open_bus failed: {}", i2c_error_str(e) as &str); - "open_bus failed" - })?; + // SAFETY: sole pin creation site in this binary, at boot; the pins! table is this chip's true pin map. + let pins = unsafe { create_pins() }; + // Buffer-mode slave: no DMA buffers, so this driver cannot master a DMA transfer. + let mut driver = + i2c_backend::open_bus(pins.scu418_0, pins.scu418_1, &SLAVE_CFG).map_err(|e| { + pw_log::error!("open_bus failed: {}", i2c_error_str(e) as &str); + "open_bus failed" + })?; driver .configure_slave_address(SLAVE_ADDR) diff --git a/target/ast10x0/tests/peripherals/i2c/i2c_init/target.rs b/target/ast10x0/tests/peripherals/i2c/i2c_init/target.rs index bd8185759..3c0194a0f 100644 --- a/target/ast10x0/tests/peripherals/i2c/i2c_init/target.rs +++ b/target/ast10x0/tests/peripherals/i2c/i2c_init/target.rs @@ -9,6 +9,7 @@ use ast10x0_peripherals::i2c::{ Ast1060I2c, Ast1060I2cRegisters, ClockConfig, I2cConfig, I2cError, I2cSpeed, I2cXferMode, }; use ast10x0_peripherals::scu::pinctrl; +use ast10x0_peripherals::{create_pins, PinTokens}; use codegen as _; use console_backend::console_backend_write_all; use entry as _; @@ -314,13 +315,15 @@ fn run_i2c_init_smoke_test() -> Result<(), &'static str> { let board = Ast10x0Board::new(Ast10x0BoardDescriptor { pinctrl_groups: &[pinctrl::PINCTRL_I2C1], - i2c_buses: &[], }); // SAFETY: Test target runs once at boot with exclusive access to the board. unsafe { board.init() }.expect("board init failed"); pw_log::info!("Board-level I2C global init complete"); + // SAFETY: sole pin creation site in this binary, at boot; the pins! table is this chip's true pin map. + let pins = unsafe { create_pins() }; + run_init_case( "standard", I2cConfig { @@ -331,6 +334,7 @@ fn run_i2c_init_smoke_test() -> Result<(), &'static str> { smbus_alert: false, clock_config: ClockConfig::ast1060_default(), }, + &pins, )?; run_init_case( "fast", @@ -342,6 +346,7 @@ fn run_i2c_init_smoke_test() -> Result<(), &'static str> { smbus_alert: false, clock_config: ClockConfig::ast1060_default(), }, + &pins, )?; run_init_case( "fast-plus", @@ -353,6 +358,7 @@ fn run_i2c_init_smoke_test() -> Result<(), &'static str> { smbus_alert: false, clock_config: ClockConfig::ast1060_default(), }, + &pins, )?; run_init_case_dma( "dma-fast", @@ -364,20 +370,18 @@ fn run_i2c_init_smoke_test() -> Result<(), &'static str> { smbus_alert: false, clock_config: ClockConfig::ast1060_default(), }, + &pins, )?; pw_log::info!("=== AST10x0 I2C init smoke test complete ==="); Ok(()) } -fn run_init_case(name: &str, config: I2cConfig) -> Result<(), &'static str> { +fn run_init_case(name: &str, config: I2cConfig, pins: &PinTokens) -> Result<(), &'static str> { pw_log::info!("Instantiating controller 1 in {} mode", name as &str); - // SAFETY: single MMIO-pointer perimeter — the test owns I2C1 for the process lifetime. - let result = unsafe { - let mmio = Ast1060I2cRegisters::new(ast1060_pac::I2c1::ptr(), ast1060_pac::I2cbuff1::ptr()); - Ast1060I2c::new(mmio, &config, |_| core::hint::spin_loop()) - }; + let mmio = Ast1060I2cRegisters::from_pins(&pins.scu414_30, &pins.scu414_31); + let result = Ast1060I2c::new(mmio, &config, |_| core::hint::spin_loop()); match result { Ok(_i2c) => { @@ -394,7 +398,7 @@ fn run_init_case(name: &str, config: I2cConfig) -> Result<(), &'static str> { } } -fn run_init_case_dma(name: &str, config: I2cConfig) -> Result<(), &'static str> { +fn run_init_case_dma(name: &str, config: I2cConfig, pins: &PinTokens) -> Result<(), &'static str> { pw_log::info!( "Instantiating controller 1 in {} mode (new_with_dma)", name as &str @@ -403,9 +407,8 @@ fn run_init_case_dma(name: &str, config: I2cConfig) -> Result<(), &'static str> let mut master_dma_buf = [0u8; 64]; let mut slave_dma_buf = [0u8; 64]; - // SAFETY: single MMIO-pointer perimeter — the test owns I2C1 for the process lifetime. - let result = unsafe { - let mmio = Ast1060I2cRegisters::new(ast1060_pac::I2c1::ptr(), ast1060_pac::I2cbuff1::ptr()); + let mmio = Ast1060I2cRegisters::from_pins(&pins.scu414_30, &pins.scu414_31); + let result = { Ast1060I2c::new_with_dma( mmio, &config, diff --git a/target/ast10x0/tests/peripherals/i2c/i2c_irq/slave_target.rs b/target/ast10x0/tests/peripherals/i2c/i2c_irq/slave_target.rs index bf3f9a79a..11bb54468 100644 --- a/target/ast10x0/tests/peripherals/i2c/i2c_irq/slave_target.rs +++ b/target/ast10x0/tests/peripherals/i2c/i2c_irq/slave_target.rs @@ -13,12 +13,10 @@ #![no_std] #![no_main] -use ast10x0_board::{Ast10x0Board, Ast10x0BoardDescriptor}; +use ast10x0_board::Pins; use ast10x0_peripherals::i2c::{ - Ast1060I2c, Ast1060I2cRegisters, ClockConfig, I2cConfig, I2cSpeed, I2cXferMode, SlaveConfig, - SlaveEvent, + Ast1060I2c, ClockConfig, I2cConfig, I2cSpeed, I2cXferMode, SlaveConfig, SlaveEvent, }; -use ast10x0_peripherals::scu::pinctrl; use codegen as _; use console_backend::console_backend_write_all; use entry as _; @@ -61,19 +59,12 @@ fn run_slave() -> Result<(), &'static str> { SLAVE_ADDR as u32 ); - let board = Ast10x0Board::new(Ast10x0BoardDescriptor { - pinctrl_groups: &[pinctrl::PINCTRL_I2C2], - i2c_buses: &[], - }); - // SAFETY: single call at boot with exclusive access to SCU/I2C global regs. - unsafe { board.init() }.expect("board init failed"); - - // SAFETY: single MMIO-pointer perimeter — the test owns I2C2 for the process lifetime. - let mut slave = unsafe { - let mmio = Ast1060I2cRegisters::new(ast1060_pac::I2c2::ptr(), ast1060_pac::I2cbuff2::ptr()); - Ast1060I2c::new(mmio, &i2c2_config(), |_| core::hint::spin_loop()) - } - .map_err(|_| "slave I2C2 init failed")?; + // SAFETY: single call at boot with exclusive SoC access; routes Bus 2's pins and brings up I2C. + let pins = unsafe { Pins::take() }; + let mut slave = pins + .i2c2 + .open(&i2c2_config()) + .map_err(|_| "slave I2C2 init failed")?; let slave_cfg = SlaveConfig::new(SLAVE_ADDR).map_err(|_| "SlaveConfig::new failed")?; diff --git a/target/ast10x0/tests/peripherals/i2c/i2c_irq/target.rs b/target/ast10x0/tests/peripherals/i2c/i2c_irq/target.rs index 0c73ab838..32bd2dca8 100644 --- a/target/ast10x0/tests/peripherals/i2c/i2c_irq/target.rs +++ b/target/ast10x0/tests/peripherals/i2c/i2c_irq/target.rs @@ -19,11 +19,8 @@ #![no_std] #![no_main] -use ast10x0_board::{Ast10x0Board, Ast10x0BoardDescriptor}; -use ast10x0_peripherals::i2c::{ - Ast1060I2c, Ast1060I2cRegisters, ClockConfig, I2cConfig, I2cSpeed, I2cXferMode, -}; -use ast10x0_peripherals::scu::pinctrl; +use ast10x0_board::Pins; +use ast10x0_peripherals::i2c::{ClockConfig, I2cConfig, I2cSpeed, I2cXferMode}; use codegen as _; use console_backend::console_backend_write_all; use entry as _; @@ -49,19 +46,12 @@ fn run_master() -> Result<(), &'static str> { pw_log::info!("=== I2C slave IRQ test: MASTER (device A) ==="); pw_log::info!("J15 must be connected. Load slave image on device B first."); - let board = Ast10x0Board::new(Ast10x0BoardDescriptor { - pinctrl_groups: &[pinctrl::PINCTRL_I2C2], - i2c_buses: &[], - }); - // SAFETY: single call at boot with exclusive access to SCU/I2C global regs. - unsafe { board.init() }.expect("board init failed"); - - // SAFETY: single MMIO-pointer perimeter — the test owns I2C2 for the process lifetime. - let mut master = unsafe { - let mmio = Ast1060I2cRegisters::new(ast1060_pac::I2c2::ptr(), ast1060_pac::I2cbuff2::ptr()); - Ast1060I2c::new(mmio, &i2c2_config(), |_| core::hint::spin_loop()) - } - .map_err(|_| "master I2C2 init failed")?; + // SAFETY: single call at boot with exclusive SoC access; routes Bus 2's pins and brings up I2C. + let pins = unsafe { Pins::take() }; + let mut master = pins + .i2c2 + .open(&i2c2_config()) + .map_err(|_| "master I2C2 init failed")?; // ------------------------------------------------------------------ // Test 1: master write → slave DataReceived diff --git a/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx/BUILD.bazel b/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx/BUILD.bazel index c65b1ca34..3991537ac 100644 --- a/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx/BUILD.bazel +++ b/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx/BUILD.bazel @@ -120,7 +120,6 @@ rust_binary( "//hal/blocking", "//target/ast10x0:config", "//target/ast10x0:entry", - "//target/ast10x0/backend/i2c:i2c_backend_ast10x0", "//target/ast10x0/board:ast10x0_board", "//target/ast10x0/peripherals", "@ast1060_pac", diff --git a/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx/master_target.rs b/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx/master_target.rs index 3c3724279..f407c9659 100644 --- a/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx/master_target.rs +++ b/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx/master_target.rs @@ -10,11 +10,8 @@ #![no_std] #![no_main] -use ast10x0_board::{Ast10x0Board, Ast10x0BoardDescriptor}; -use ast10x0_peripherals::i2c::{ - Ast1060I2c, Ast1060I2cRegisters, ClockConfig, I2cConfig, I2cSpeed, I2cXferMode, -}; -use ast10x0_peripherals::scu::pinctrl; +use ast10x0_board::Pins; +use ast10x0_peripherals::i2c::{ClockConfig, I2cConfig, I2cSpeed, I2cXferMode}; use codegen as _; use console_backend::console_backend_write_all; use entry as _; @@ -37,17 +34,11 @@ fn i2c2_config() -> I2cConfig { } fn run_master() -> Result<(), &'static str> { - let board = Ast10x0Board::new(Ast10x0BoardDescriptor { - pinctrl_groups: &[pinctrl::PINCTRL_I2C2], - i2c_buses: &[], - }); - // SAFETY: single call at boot with exclusive access to SCU/I2C global regs. - unsafe { board.init() }.map_err(|_| "board init failed")?; - - // SAFETY: I2C2 registers accessed only through `master` for this test. - let mmio = - unsafe { Ast1060I2cRegisters::new(ast1060_pac::I2c2::ptr(), ast1060_pac::I2cbuff2::ptr()) }; - let mut master = Ast1060I2c::new(mmio, &i2c2_config(), |_| core::hint::spin_loop()) + // SAFETY: single call at boot with exclusive SoC access; routes Bus 2's pins and brings up I2C. + let pins = unsafe { Pins::take() }; + let mut master = pins + .i2c2 + .open(&i2c2_config()) .map_err(|_| "I2C2 master init failed")?; master diff --git a/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx/target.rs b/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx/target.rs index 4d2c93496..39f9c278c 100644 --- a/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx/target.rs +++ b/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx/target.rs @@ -4,9 +4,8 @@ #![no_std] #![no_main] -use ast10x0_board::{Ast10x0Board, Ast10x0BoardDescriptor, I2cBusCfg}; +use ast10x0_board::Pins; use ast10x0_peripherals::i2c::{ClockConfig, I2cConfig, I2cError, I2cSpeed, I2cXferMode}; -use ast10x0_peripherals::scu::pinctrl; use codegen as _; use console_backend::console_backend_write_all; use entry as _; @@ -51,24 +50,17 @@ fn i2c_error_str(error: I2cError) -> &'static str { fn run_slave_rx_test() -> Result<(), &'static str> { pw_log::info!("=== AST10x0 I2C slave RX test (Bus 2, addr 0x42) ==="); - // Phase A — board init: SCU clock/reset + pin-mux + init_bus(2). - let board = Ast10x0Board::new(Ast10x0BoardDescriptor { - pinctrl_groups: &[pinctrl::PINCTRL_I2C2], - i2c_buses: &[I2cBusCfg { - bus: 2, - config: SLAVE_CFG, - }], - }); - // SAFETY: Test target runs once at boot with exclusive access to the board. - unsafe { board.init() }.map_err(|_| "board init failed")?; - pw_log::info!("Board init complete"); - - // Phase B — open the already-initialised bus and configure slave mode. - // SAFETY: board.init() called init_bus(2); we are the sole owner of Bus 2. - let mut driver = unsafe { i2c_backend::open_bus(2, &SLAVE_CFG) }.map_err(|e| { - pw_log::error!("open_bus failed: {}", i2c_error_str(e) as &str); - "open_bus failed" + // Phase A/B — mint the board's pin tokens (the sole `unsafe`), then a safe open of Bus 2: + // `pins.i2c2` is the bus already wired to its pins, and `open` consumes it (open-once). A + // second open of Bus 2 (or wiring scu418_0/1 to another capability) is a compile error. + // Config is supplied at open time; SCU access is behind the scenes. + // SAFETY: Test target runs once at boot with exclusive access to the hardware. + let pins = unsafe { Pins::take() }; + let mut driver = pins.i2c2.open(&SLAVE_CFG).map_err(|e| { + pw_log::error!("open_i2c(Bus2) failed: {}", i2c_error_str(e) as &str); + "open failed" })?; + pw_log::info!("Bus 2 claimed"); driver.configure_slave_address(SLAVE_ADDR).map_err(|e| { pw_log::error!( diff --git a/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx_ipc/master_target.rs b/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx_ipc/master_target.rs index 72b2989d3..42ca38d54 100644 --- a/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx_ipc/master_target.rs +++ b/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx_ipc/master_target.rs @@ -10,11 +10,8 @@ #![no_std] #![no_main] -use ast10x0_board::{Ast10x0Board, Ast10x0BoardDescriptor}; -use ast10x0_peripherals::i2c::{ - Ast1060I2c, Ast1060I2cRegisters, ClockConfig, I2cConfig, I2cSpeed, I2cXferMode, -}; -use ast10x0_peripherals::scu::pinctrl; +use ast10x0_board::Pins; +use ast10x0_peripherals::i2c::{ClockConfig, I2cConfig, I2cSpeed, I2cXferMode}; use codegen as _; use console_backend::console_backend_write_all; use entry as _; @@ -37,17 +34,11 @@ fn i2c2_config() -> I2cConfig { } fn run_master() -> Result<(), &'static str> { - let board = Ast10x0Board::new(Ast10x0BoardDescriptor { - pinctrl_groups: &[pinctrl::PINCTRL_I2C2], - i2c_buses: &[], - }); - // SAFETY: single call at boot with exclusive access to SCU/I2C global regs. - unsafe { board.init() }.map_err(|_| "board init failed")?; - - // SAFETY: I2C2 registers accessed only through `master` for this test. - let mmio = - unsafe { Ast1060I2cRegisters::new(ast1060_pac::I2c2::ptr(), ast1060_pac::I2cbuff2::ptr()) }; - let mut master = Ast1060I2c::new(mmio, &i2c2_config(), |_| core::hint::spin_loop()) + // SAFETY: single call at boot with exclusive SoC access; routes Bus 2's pins and brings up I2C. + let pins = unsafe { Pins::take() }; + let mut master = pins + .i2c2 + .open(&i2c2_config()) .map_err(|_| "I2C2 master init failed")?; master diff --git a/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx_ipc/server_main.rs b/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx_ipc/server_main.rs index 792eb3119..25daeab69 100644 --- a/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx_ipc/server_main.rs +++ b/target/ast10x0/tests/peripherals/i2c/i2c_slave_rx_ipc/server_main.rs @@ -11,6 +11,7 @@ #![no_std] use app_i2c_server::{handle, signals}; +use ast10x0_peripherals::create_pins; use ast10x0_peripherals::i2c::{ClockConfig, I2cConfig, I2cSpeed, I2cXferMode}; use i2c_server_runtime::{run, Bus}; use userspace::entry; @@ -24,38 +25,27 @@ const SLAVE_CFG: I2cConfig = I2cConfig { clock_config: ClockConfig::ast1060_default(), }; -// Non-cached SRAM buffers for DMA — must be visible to both the DMA engine and -// the CPU without cache aliasing. The linker places `.ram_nc` sections in the -// non-cached SRAM window of the AST1060. -#[unsafe(link_section = ".ram_nc")] -static mut MASTER_DMA_BUF: [u8; 4096] = [0u8; 4096]; -#[unsafe(link_section = ".ram_nc")] -static mut SLAVE_DMA_BUF: [u8; 256] = [0u8; 256]; - #[entry] fn entry() { - // Phase A: per-controller init (timing, master-enable, interrupts). - // SCU/global/pinctrl were already done by the kernel in target.rs. - // SAFETY: server process exclusively owns Bus 2; kernel init is complete. - if unsafe { i2c_backend::init_bus(2, &SLAVE_CFG) }.is_err() { - pw_log::error!("init_bus(2) failed"); + // The kernel routed Bus 2's pins at the SCU (target.rs) before starting us; userspace has no + // SCU grant, so we bind the already-routed pins rather than re-muxing them. + // SAFETY: sole pin creation site in this binary, at boot; the pins! table is this chip's true pin map. + let pins = unsafe { create_pins() }; + let (scl, sda) = (pins.scu418_0, pins.scu418_1); + + // Mint the non-cached DMA buffers, then bring the controller up (init + DMA wrap) in one step. + let (Some(master_dma_buf), Some(slave_dma_buf)) = ( + i2c_backend::non_cached_buf!(4096), + i2c_backend::non_cached_buf!(256), + ) else { + pw_log::error!("i2c DMA buffers already taken"); loop {} - } - - // Phase B: wrap the initialised controller in DMA mode. - // SAFETY: init_bus(2) done above; both buffers are in non-cached SRAM - // and uniquely owned by this bus for the driver's lifetime. - let master_dma_buf: &'static mut [u8] = - unsafe { &mut *core::ptr::addr_of_mut!(MASTER_DMA_BUF) }; - let slave_dma_buf: &'static mut [u8] = unsafe { &mut *core::ptr::addr_of_mut!(SLAVE_DMA_BUF) }; - let driver = - match unsafe { i2c_backend::open_bus_dma(2, &SLAVE_CFG, master_dma_buf, slave_dma_buf) } { - Ok(d) => d, - Err(_) => { - pw_log::error!("open_bus_dma(2) failed"); - loop {} - } - }; + }; + let Ok(driver) = i2c_backend::open_bus_dma(scl, sda, &SLAVE_CFG, master_dma_buf, slave_dma_buf) + else { + pw_log::error!("i2c bus open failed"); + loop {} + }; pw_log::info!("I2C server ready on Bus 2"); diff --git a/target/ast10x0/tests/peripherals/i3c/i3c_init/target.rs b/target/ast10x0/tests/peripherals/i3c/i3c_init/target.rs index 67319fc65..6145eacbf 100644 --- a/target/ast10x0/tests/peripherals/i3c/i3c_init/target.rs +++ b/target/ast10x0/tests/peripherals/i3c/i3c_init/target.rs @@ -50,7 +50,6 @@ fn run_i3c_init_smoke_test() -> Result<(), &'static str> { let board = Ast10x0Board::new(Ast10x0BoardDescriptor { pinctrl_groups: &[pinctrl::PINCTRL_I3C0], - i2c_buses: &[], }); // SAFETY: Test target runs once at boot with exclusive access to the board. unsafe { board.init() }.expect("board init failed"); diff --git a/target/ast10x0/tests/peripherals/i3c/i3c_irq/slave_target.rs b/target/ast10x0/tests/peripherals/i3c/i3c_irq/slave_target.rs index bb3fd128f..e508abb91 100644 --- a/target/ast10x0/tests/peripherals/i3c/i3c_irq/slave_target.rs +++ b/target/ast10x0/tests/peripherals/i3c/i3c_irq/slave_target.rs @@ -216,7 +216,6 @@ fn run_target() -> Result<(), &'static str> { let board = Ast10x0Board::new(Ast10x0BoardDescriptor { pinctrl_groups: &[pinctrl::PINCTRL_HVI3C2], - i2c_buses: &[], }); // SAFETY: single call at boot with exclusive access to the board. unsafe { board.init() }.expect("board init failed"); diff --git a/target/ast10x0/tests/peripherals/i3c/i3c_irq/target.rs b/target/ast10x0/tests/peripherals/i3c/i3c_irq/target.rs index 39250b12c..ddbb62198 100644 --- a/target/ast10x0/tests/peripherals/i3c/i3c_irq/target.rs +++ b/target/ast10x0/tests/peripherals/i3c/i3c_irq/target.rs @@ -191,7 +191,6 @@ fn run_controller() -> Result<(), &'static str> { let board = Ast10x0Board::new(Ast10x0BoardDescriptor { pinctrl_groups: &[pinctrl::PINCTRL_HVI3C2], - i2c_buses: &[], }); // SAFETY: single call at boot with exclusive access to the board. unsafe { board.init() }.expect("board init failed"); diff --git a/target/ast10x0/tests/pldm/firmware_update/BUILD.bazel b/target/ast10x0/tests/pldm/firmware_update/BUILD.bazel new file mode 100644 index 000000000..cdf6851a0 --- /dev/null +++ b/target/ast10x0/tests/pldm/firmware_update/BUILD.bazel @@ -0,0 +1,245 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@pigweed//pw_kernel/tooling:rust_app.bzl", "rust_app") +load("@pigweed//pw_kernel/tooling:system_image.bzl", "system_image") +load("@pigweed//pw_kernel/tooling:target_codegen.bzl", "target_codegen") +load("@pigweed//pw_kernel/tooling:target_linker_script.bzl", "target_linker_script") +load("@rules_rust//rust:defs.bzl", "rust_binary") +load("//target/ast10x0:defs.bzl", "TARGET_COMPATIBLE_WITH", "system_image_test") +load("//util/region:defs.bzl", "app_regions") + +filegroup( + name = "system_config", + srcs = ["system.json5"], + visibility = ["//visibility:public"], +) + +filegroup( + name = "peer_system_config", + srcs = ["peer_system.json5"], + visibility = ["//visibility:public"], +) + +target_codegen( + name = "codegen", + arch = "@pigweed//pw_kernel/arch/arm_cortex_m:arch_arm_cortex_m", + system_config = ":system_config", + target_compatible_with = TARGET_COMPATIBLE_WITH, +) + +target_linker_script( + name = "linker_script", + system_config = ":system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + template = "//target/ast10x0:linker_script_template", +) + +rust_binary( + name = "target", + srcs = ["target.rs"], + edition = "2024", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + deps = [ + ":codegen", + ":linker_script", + "//target/ast10x0:entry", + "//target/ast10x0/board:ast10x0_board", + "//target/ast10x0/peripherals", + "//target/ast10x0/tests/clock", + "@ast1060_pac", + "@pigweed//pw_kernel/arch/arm_cortex_m:arch_arm_cortex_m", + "@pigweed//pw_kernel/kernel", + "@pigweed//pw_kernel/subsys/console:console_backend", + "@pigweed//pw_kernel/target:target_common", + "@pigweed//pw_kernel/userspace", + ], +) + +rust_app( + name = "i2c_server", + srcs = ["//target/ast10x0/tests/mctp/server:i2c_server_main.rs"], + codegen_crate_name = "app_i2c_server", + edition = "2024", + system_config = ":system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + deps = [ + "//services/i2c/server-runtime:i2c_server_runtime", + "//target/ast10x0/backend/i2c:i2c_backend_ast10x0", + "//target/ast10x0/peripherals", + "//target/ast10x0/tests/clock", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + ], +) + +rust_app( + name = "mctp_server", + srcs = ["//target/ast10x0/tests/mctp/server:main.rs"], + codegen_crate_name = "app_mctp_server", + edition = "2024", + system_config = ":system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + deps = [ + "//services/i2c/api:i2c_api", + "//services/i2c/client:i2c_client", + "//services/i2c/client-ipc:i2c_client_ipc", + "//services/mctp/api:mctp_api", + "//services/mctp/server:mctp_server_lib", + "//services/mctp/transport-i2c:mctp_transport_i2c", + "//target/ast10x0/tests/clock", + "@pigweed//pw_kernel/syscall:syscall_user", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + "@pigweed//pw_status/rust:pw_status", + "@rust_crates//:mctp", + "@rust_crates//:mctp-lib", + ], +) + +app_regions( + name = "app_pldm_fd_regions", + app_name = "pldm_fd", + edition = "2024", + system_config = ":system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, +) + +rust_app( + name = "pldm_fd", + srcs = ["fd_main.rs"], + codegen_crate_name = "app_pldm_fd", + edition = "2024", + system_config = ":system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + deps = [ + ":app_pldm_fd_regions", + "//hal/blocking/flash", + "//services/mctp/client-ipc:mctp_client_ipc", + "//services/pldm:pldm_service", + "//target/ast10x0/backend/flash:flash_backend_ast10x0", + "//target/ast10x0/tests/clock", + "//target/ast10x0/tests/fd_ops", + "//util/error", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + "@pigweed//pw_status/rust:pw_status", + "@rust_crates//:pldm-common", + "@rust_crates//:pldm-interface", + ], +) + +rust_app( + name = "i2c_server_peer", + srcs = ["//target/ast10x0/tests/mctp/server:i2c_server_main_peer.rs"], + codegen_crate_name = "app_i2c_server_peer", + edition = "2024", + system_config = ":peer_system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + deps = [ + "//services/i2c/server-runtime:i2c_server_runtime", + "//target/ast10x0/backend/i2c:i2c_backend_ast10x0", + "//target/ast10x0/peripherals", + "//target/ast10x0/tests/clock", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + ], +) + +rust_app( + name = "mctp_server_peer", + srcs = ["//target/ast10x0/tests/mctp/server:main_peer.rs"], + codegen_crate_name = "app_mctp_server_peer", + edition = "2024", + system_config = ":peer_system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + deps = [ + "//services/i2c/api:i2c_api", + "//services/i2c/client:i2c_client", + "//services/i2c/client-ipc:i2c_client_ipc", + "//services/mctp/api:mctp_api", + "//services/mctp/server:mctp_server_lib", + "//services/mctp/transport-i2c:mctp_transport_i2c", + "//target/ast10x0/tests/clock", + "@pigweed//pw_kernel/syscall:syscall_user", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + "@pigweed//pw_status/rust:pw_status", + "@rust_crates//:mctp", + "@rust_crates//:mctp-lib", + ], +) + +rust_app( + name = "pldm_ua", + srcs = ["ua_main.rs"], + codegen_crate_name = "app_pldm_ua", + edition = "2024", + system_config = ":peer_system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + deps = [ + "//services/mctp/client-ipc:mctp_client_ipc", + "//services/pldm:pldm_service", + "//target/ast10x0/tests/clock", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + "@pigweed//pw_status/rust:pw_status", + "@rust_crates//:pldm-common", + ], +) + +system_image( + name = "pldm_fd_image", + apps = [ + ":i2c_server", + ":mctp_server", + ":pldm_fd", + ], + kernel = ":target", + platform = "//target/ast10x0", + system_config = ":system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + visibility = ["//visibility:public"], +) + +system_image( + name = "pldm_ua_image", + apps = [ + ":i2c_server_peer", + ":mctp_server_peer", + ":pldm_ua", + ], + kernel = ":target", + platform = "//target/ast10x0", + system_config = ":peer_system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + visibility = ["//visibility:public"], +) + +# `slave_image` is flashed first, so the firmware device is listening before the +# update agent boots and sends RequestUpdate. +system_image_test( + name = "pldm_firmware_update_test", + timeout = "eternal", + image = ":pldm_ua_image", + slave_image = ":pldm_fd_image", + tags = [ + "hardware", + "manual", + ], + target_compatible_with = select({ + "//target/ast10x0:qemu_enabled": ["@platforms//:incompatible"], + "//conditions:default": [], + }), +) diff --git a/target/ast10x0/tests/pldm/firmware_update/fd_main.rs b/target/ast10x0/tests/pldm/firmware_update/fd_main.rs new file mode 100644 index 000000000..6eb7c14e7 --- /dev/null +++ b/target/ast10x0/tests/pldm/firmware_update/fd_main.rs @@ -0,0 +1,421 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! PLDM Firmware Device app (card A, the RoT). +//! +//! Runs the real [`FirmwareDevice`] state machine against the update agent on +//! card B over MCTP/I2C2, streams the image it is handed into SPI NOR on FMC +//! chip select 1, and reads it back. The demo's claim is that the bytes the +//! update agent sent are the bytes now sitting in flash. + +#![no_main] +#![no_std] + +use core::cell::{Cell, RefCell}; + +use board_clock::now_millis; +use flash_backend::NoWaitBlocking; +use hal_flash::{BlockingFlash, Flash, FlashAddress}; +use openprot_mctp_client_ipc::IpcMctpClient; +use openprot_pldm_service::firmware_device::{FirmwareDevice, RunTerminusResult}; +use openprot_pldm_service::{MctpPldmTransport, PldmServiceError}; +use pldm_common::message::firmware_update::activate_pending_component::{ + PendingComponent, PendingComponentResult, +}; +use pldm_common::message::firmware_update::apply_complete::ApplyResult; +use pldm_common::message::firmware_update::get_fw_params::FirmwareParameters; +use pldm_common::message::firmware_update::get_status::ProgressPercent; +use pldm_common::message::firmware_update::request_cancel::{ + NonFunctioningComponentBitmap, NonFunctioningComponentIndication, +}; +use pldm_common::message::firmware_update::request_fw_data::MAX_TRANSFER_SIZE; +use pldm_common::message::firmware_update::transfer_complete::TransferResult; +use pldm_common::message::firmware_update::update_security_revision::{ + SecurityRevisionComponent, SecurityRevisionResult, +}; +use pldm_common::message::firmware_update::verify_complete::VerifyResult; +use pldm_common::protocol::base::PldmBaseCompletionCode; +use pldm_common::protocol::firmware_update::{ComponentResponseCode, Descriptor, PldmFdTime}; +use pldm_common::util::fw_component::FirmwareComponent; +use pldm_interface::firmware_device::fd_ops::{ComponentOperation, FdOps, FdOpsError}; +use pw_status::Error; +use userspace::{entry, syscall}; +use util_error::ErrorCode; + +use app_pldm_fd::handle; +use app_pldm_fd_regions::{take_mmaps, FmcRegs, Mmaps}; + +/// The FMC backend bound to this process's register mapping. +type Backend = flash_backend::Backend; + +/// This card's EID, matching the MCTP server app underneath it. +const FD_EID: u8 = 8; +/// The update agent's EID on card B. +const UA_EID: u8 = 9; + +/// Size of the demo image, in bytes. Must match the update agent's blob. +const IMAGE_SIZE: usize = 1024; + +/// This device's UUID, the one descriptor QueryDeviceIdentifiers reports. The +/// update agent holds the same value and refuses to update anything else. +const DEVICE_UUID: [u8; 16] = [ + 0x4f, 0x50, 0x52, 0x54, 0x00, 0x01, 0x40, 0x00, 0xa0, 0x00, 0xde, 0xad, 0xbe, 0xef, 0x00, 0x01, +]; + +/// The single updatable component this device advertises. The update agent +/// learns it from GetFirmwareParameters rather than assuming it. +const COMP_IDENTIFIER: u16 = 0x0001; + +/// Version strings the device reports as running today. The update agent must +/// offer something newer for the component to be accepted. +const ACTIVE_COMP_VERSION: &str = "v0.9"; +const ACTIVE_IMAGE_SET_VERSION: &str = "openprot-demo-v0.9"; + +/// Where the image lands on CS1. Scratch region, sector-aligned, and clobbered +/// without backup — persisting the image is the point of the test. +const IMAGE_BASE: u32 = 0x10_0000; + +/// Readback chunk used by `verify`; one SPI NOR page. +const READBACK_CHUNK: usize = 256; + +/// How long the FD waits for an update agent command before giving up and +/// reporting the result. This card is flashed first, so it must outlast card +/// B's UART upload (~50s for a 512 KiB image at 115200 baud) plus its boot. +const IDLE_TIMEOUT_MILLIS: u32 = 90_000; +/// How long each FD-initiated request waits for the update agent's reply. +const REQUESTER_TIMEOUT_MILLIS: u32 = 5_000; + +const FD_BUF_SIZE: usize = 1024; + +/// The byte the demo image carries at `offset`. +/// +/// Offset-dependent so a duplicated, reordered, or truncated chunk fails +/// verification instead of slipping through. The update agent generates the +/// same sequence. +fn expected_byte(offset: usize) -> u8 { + (offset % 251) as u8 +} + +/// Firmware-device operations for the demo: program the image into CS1 as it +/// arrives, then read it back. +/// +/// `FdOps` takes `&self` throughout, so the flash handle lives behind a +/// `RefCell`. +struct DemoFdOps { + flash: RefCell>, + bytes_received: Cell, + corrupt: Cell, + verified: Cell, + activated: Cell, +} + +impl DemoFdOps { + fn new(flash: BlockingFlash) -> Self { + DemoFdOps { + flash: RefCell::new(flash), + bytes_received: Cell::new(0), + corrupt: Cell::new(false), + verified: Cell::new(false), + activated: Cell::new(false), + } + } + + /// True once the whole image was read back out of flash intact. + fn image_is_good(&self) -> bool { + self.verified.get() + } +} + +impl FdOps for DemoFdOps { + fn get_device_identifiers( + &self, + device_identifiers: &mut [Descriptor], + ) -> Result { + board_fd_ops::device_identifiers(device_identifiers, &DEVICE_UUID) + } + + fn get_firmware_parms( + &self, + firmware_params: &mut FirmwareParameters, + ) -> Result<(), FdOpsError> { + board_fd_ops::firmware_parameters( + firmware_params, + COMP_IDENTIFIER, + ACTIVE_COMP_VERSION, + ACTIVE_IMAGE_SET_VERSION, + ) + } + + fn get_xfer_size(&self, ua_transfer_size: usize) -> Result { + Ok(ua_transfer_size.min(MAX_TRANSFER_SIZE)) + } + + fn handle_component( + &self, + component: &FirmwareComponent, + fw_params: &FirmwareParameters, + _op: ComponentOperation, + ) -> Result { + // Matches the offered component against what this device advertised: + // an unknown identifier, or a version no newer than the running one, + // is refused. + let code = component.evaluate_update_eligibility(fw_params); + if code != ComponentResponseCode::CompCanBeUpdated { + pw_log::error!("FD: component refused, code {}", code as u32); + } + Ok(code) + } + + fn query_download_offset_and_length( + &self, + _component: &FirmwareComponent, + ) -> Result<(usize, usize), FdOpsError> { + // The state machine keeps no cursor of its own: whatever this returns is + // the offset of the next RequestFirmwareData, verbatim. + let done = self.bytes_received.get(); + Ok((done, IMAGE_SIZE - done)) + } + + fn download_fw_data( + &self, + offset: usize, + data: &[u8], + _component: &FirmwareComponent, + ) -> Result { + let done = self.bytes_received.get(); + if offset != done { + // A retry re-delivers a window already programmed, and NOR cannot + // set bits back to 1, so reprogramming it would corrupt the image. + return Ok(TransferResult::TransferSuccess); + } + for (i, byte) in data.iter().enumerate() { + if *byte != expected_byte(offset + i) { + self.corrupt.set(true); + pw_log::error!("FD: byte {} is wrong", (offset + i) as u32); + return Ok(TransferResult::FdAbortedTransfer); + } + } + if let Err(e) = self + .flash + .borrow_mut() + .program(FlashAddress::new(IMAGE_BASE + offset as u32), data) + { + self.corrupt.set(true); + pw_log::error!( + "FD: program at {} failed: {:08x}", + offset as u32, + e.0.get() as u32 + ); + return Ok(TransferResult::FdAbortedTransfer); + } + self.bytes_received.set(done + data.len()); + Ok(TransferResult::TransferSuccess) + } + + fn is_download_complete(&self, _component: &FirmwareComponent) -> bool { + self.bytes_received.get() >= IMAGE_SIZE + } + + fn query_download_progress( + &self, + _component: &FirmwareComponent, + progress_percent: &mut ProgressPercent, + ) -> Result<(), FdOpsError> { + board_fd_ops::download_progress(self.bytes_received.get(), IMAGE_SIZE, progress_percent) + } + + fn verify( + &self, + _component: &FirmwareComponent, + _progress_percent: &mut ProgressPercent, + ) -> Result { + if self.corrupt.get() || self.bytes_received.get() < IMAGE_SIZE { + pw_log::error!( + "FD: image incomplete, {} bytes", + self.bytes_received.get() as u32 + ); + return Ok(VerifyResult::VerifyGenericError); + } + + let mut flash = self.flash.borrow_mut(); + let mut buf = [0u8; READBACK_CHUNK]; + for base in (0..IMAGE_SIZE).step_by(READBACK_CHUNK) { + if let Err(e) = flash.read(FlashAddress::new(IMAGE_BASE + base as u32), &mut buf) { + pw_log::error!( + "FD: read at {} failed: {:08x}", + base as u32, + e.0.get() as u32 + ); + return Ok(VerifyResult::VerifyGenericError); + } + for (i, byte) in buf.iter().enumerate() { + if *byte != expected_byte(base + i) { + pw_log::error!("FD: flash byte {} is wrong", (base + i) as u32); + return Ok(VerifyResult::VerifyGenericError); + } + } + } + + self.verified.set(true); + pw_log::info!("FD: image verified in flash, {} bytes", IMAGE_SIZE as u32); + Ok(VerifyResult::VerifySuccess) + } + + fn apply( + &self, + _component: &FirmwareComponent, + _progress_percent: &mut ProgressPercent, + ) -> Result { + Ok(ApplyResult::ApplySuccess) + } + + fn activate( + &self, + _self_contained_activation: u8, + estimated_time: &mut u16, + ) -> Result { + // The image is already in flash; nothing is deferred, so the update + // agent is told to expect no wait. + *estimated_time = 0; + self.activated.set(true); + pw_log::info!("FD: activated"); + Ok(PldmBaseCompletionCode::Success as u8) + } + + fn cancel_update_component(&self, _component: &FirmwareComponent) -> Result<(), FdOpsError> { + Ok(()) + } + /// This demo has no pending image to activate. + fn handle_pending_component( + &self, + _component: &PendingComponent, + _fw_params: &FirmwareParameters, + ) -> Result { + Ok(PendingComponentResult::NotPermitted) + } + + /// The image lands in staging, so nothing stops working when the + /// device leaves update mode. + fn get_non_functional_component_info( + &self, + ) -> Result< + ( + NonFunctioningComponentIndication, + NonFunctioningComponentBitmap, + ), + FdOpsError, + > { + Ok(( + NonFunctioningComponentIndication::ComponentsFunctioning, + NonFunctioningComponentBitmap::new(0), + )) + } + + /// This demo does not commit security revisions. + fn update_security_revision( + &self, + _component: &SecurityRevisionComponent, + _fw_params: &FirmwareParameters, + ) -> Result { + Ok(SecurityRevisionResult::NotPermitted) + } + + /// The device's clock, which every FD timer is measured against. + fn now(&self) -> PldmFdTime { + now_millis() + } +} + +/// Bring up the FMC and clear the sector the image lands in. +fn init_flash(mmaps: Mmaps) -> Result, ErrorCode> { + // The kernel target applied the FMC pinmux before any process started. + let driver = Backend::new(mmaps.fmc_regs, mmaps.fmc_cs0_window, mmaps.fmc_cs1_window)?; + let mut flash = BlockingFlash { + driver, + blocking: NoWaitBlocking, + }; + let (capacity, sector, _) = flash.geometry()?; + pw_log::info!( + "FD: CS1 is {} bytes, {} byte sectors", + capacity.get() as u32, + sector.get() as u32 + ); + flash.erase(FlashAddress::new(IMAGE_BASE), sector)?; + Ok(flash) +} + +#[entry] +fn entry() { + // SAFETY: mints this process's memory mappings once, at its entry point. + let mmaps = unsafe { take_mmaps() }; + let flash = match init_flash(mmaps) { + Ok(flash) => flash, + Err(e) => { + pw_log::error!("FD: flash init failed: {:08x}", e.0.get() as u32); + let _ = syscall::debug_shutdown(Err(Error::Internal)); + loop {} + } + }; + let fd_ops = DemoFdOps::new(flash); + + // Both transports talk to the same MCTP server over the same IPC channel. + // Nothing is ever in flight on both at once: run_terminus alternates its + // initiator and responder phases from this single thread. + let responder_transport = MctpPldmTransport::new(IpcMctpClient::new(handle::MCTP)); + let requester_transport = MctpPldmTransport::new(IpcMctpClient::new(handle::MCTP)); + + if responder_transport.stack().set_eid(FD_EID).is_err() { + pw_log::error!("FD: set_eid failed"); + let _ = syscall::debug_shutdown(Err(Error::Internal)); + loop {} + } + + let mut fd = FirmwareDevice::init( + &fd_ops, + &pldm_interface::config::PLDM_PROTOCOL_CAPABILITIES, + responder_transport, + requester_transport, + ); + + pw_log::info!("FD: waiting for the update agent at EID {}", UA_EID as u32); + + let mut buf = [0u8; FD_BUF_SIZE]; + // Returns as soon as ActivateFirmware puts the device back in Idle; an + // idle timeout arrives as an error instead. + match fd.run_terminus( + UA_EID, + &mut buf, + IDLE_TIMEOUT_MILLIS, + REQUESTER_TIMEOUT_MILLIS, + &mut (), + ) { + RunTerminusResult::Completed => {} + // A plain idle timeout arrives here too, so the code distinguishes + // "the update agent never spoke" from a real transport fault. + RunTerminusResult::StoppedByError(PldmServiceError::Mctp(e)) => { + pw_log::error!("FD: run_terminus stopped, MCTP code {}", e.code as u32); + } + RunTerminusResult::StoppedByError(_) => { + pw_log::error!("FD: run_terminus stopped on a PLDM error"); + } + } + + if fd_ops.image_is_good() && fd_ops.activated.get() { + pw_log::info!("FD: update flow complete"); + let _ = syscall::debug_shutdown(Ok(())); + } else { + pw_log::error!( + "FD: update flow did not complete, {} bytes received", + fd_ops.bytes_received.get() as u32 + ); + let _ = syscall::debug_shutdown(Err(Error::Internal)); + } + loop {} +} + +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + pw_log::error!("FD: panic"); + let _ = syscall::debug_shutdown(Err(Error::Internal)); + loop {} +} diff --git a/target/ast10x0/tests/pldm/firmware_update/peer_system.json5 b/target/ast10x0/tests/pldm/firmware_update/peer_system.json5 new file mode 100644 index 000000000..d67559805 --- /dev/null +++ b/target/ast10x0/tests/pldm/firmware_update/peer_system.json5 @@ -0,0 +1,116 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +// AST10x0 PLDM firmware-update test, mock-BMC side (card B, the Update Agent). +{ + arch: { + type: "armv7m", + vector_table_start_address: 0x00000000, + vector_table_size_bytes: 1792, + }, + kernel: { + flash_start_address: 0x00000700, + flash_size_bytes: 129280, + ram_start_address: 0x00060000, + ram_size_bytes: 131072, + }, + apps: [ + { + name: "i2c_server_peer", + flash_size_bytes: 65536, + processes: [ + { + name: "i2c_server_peer_process", + ram_size_bytes: 65536, + objects: [ + { + name: "wg", + type: "wait_group", + }, + { + name: "i2c", + type: "channel_handler", + }, + { + name: "i2c2_irq", + type: "interrupt", + irqs: [ + { + name: "i2c2", + number: 112, + }, + ], + }, + { + type: "thread", + name: "i2c_server_peer_thread", + kernel_stack_size_bytes: 4096, + }, + ], + memory_mappings: [ + { + name: "i2c_regs", + type: "device", + start_address: 0x7e7b0000, + size_bytes: 0x4000, + }, + ], + }, + ], + }, + { + name: "mctp_server_peer", + flash_size_bytes: 131072, + processes: [ + { + name: "mctp_server_peer_process", + ram_size_bytes: 65536, + objects: [ + { + name: "wg", + type: "wait_group", + }, + { + name: "mctp", + type: "channel_handler", + }, + { + name: "i2c", + type: "channel_initiator", + handler_process: "i2c_server_peer_process", + handler_object_name: "i2c", + }, + { + type: "thread", + name: "mctp_server_peer_thread", + kernel_stack_size_bytes: 4096, + }, + ], + }, + ], + }, + { + name: "pldm_ua", + flash_size_bytes: 65536, + processes: [ + { + name: "pldm_ua_process", + ram_size_bytes: 65536, + objects: [ + { + name: "mctp", + type: "channel_initiator", + handler_process: "mctp_server_peer_process", + handler_object_name: "mctp", + }, + { + type: "thread", + name: "pldm_ua_thread", + kernel_stack_size_bytes: 4096, + }, + ], + }, + ], + }, + ], +} diff --git a/target/ast10x0/tests/pldm/firmware_update/system.json5 b/target/ast10x0/tests/pldm/firmware_update/system.json5 new file mode 100644 index 000000000..a86b79eea --- /dev/null +++ b/target/ast10x0/tests/pldm/firmware_update/system.json5 @@ -0,0 +1,150 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +// AST10x0 PLDM firmware-update test, RoT side (card A, the Firmware Device). +// +// Multi-app configuration: +// - i2c_server: owns i2c hardware and runs i2c_server_runtime +// - mctp_server: uses i2c transport over IPC + serves MCTP control channel +// - pldm_fd: runs the PLDM Firmware Device against the update agent on card B +{ + arch: { + type: "armv7m", + vector_table_start_address: 0x00000000, + vector_table_size_bytes: 1792, + }, + kernel: { + flash_start_address: 0x00000700, + flash_size_bytes: 129280, + ram_start_address: 0x00060000, + ram_size_bytes: 131072, + }, + apps: [ + { + name: "i2c_server", + flash_size_bytes: 65536, + processes: [ + { + name: "i2c_server_process", + ram_size_bytes: 65536, + objects: [ + { + name: "wg", + type: "wait_group", + }, + { + name: "i2c", + type: "channel_handler", + }, + { + name: "i2c2_irq", + type: "interrupt", + irqs: [ + { + name: "i2c2", + number: 112, + }, + ], + }, + { + type: "thread", + name: "i2c_server_thread", + kernel_stack_size_bytes: 4096, + }, + ], + memory_mappings: [ + { + name: "i2c_regs", + type: "device", + start_address: 0x7e7b0000, + size_bytes: 0x4000, + }, + ], + }, + ], + }, + { + name: "mctp_server", + flash_size_bytes: 131072, + processes: [ + { + name: "mctp_server_process", + ram_size_bytes: 65536, + objects: [ + { + name: "wg", + type: "wait_group", + }, + { + name: "mctp", + type: "channel_handler", + }, + { + name: "i2c", + type: "channel_initiator", + handler_process: "i2c_server_process", + handler_object_name: "i2c", + }, + { + type: "thread", + name: "mctp_server_thread", + kernel_stack_size_bytes: 4096, + }, + ], + }, + ], + }, + { + name: "pldm_fd", + flash_size_bytes: 65536, + processes: [ + { + name: "pldm_fd_process", + ram_size_bytes: 65536, + objects: [ + { + name: "mctp", + type: "channel_initiator", + handler_process: "mctp_server_process", + handler_object_name: "mctp", + }, + { + type: "thread", + name: "pldm_fd_thread", + kernel_stack_size_bytes: 4096, + }, + ], + memory_mappings: [ + // FMC pinctrl is applied by the kernel target's + // pre-task init, so this app does not map the SCU. + { + // FMC controller registers. + name: "fmc_regs", + type: "device", + start_address: 0x7e620000, + size_bytes: 0x1000, + }, + { + // FMC CS0 boot flash, 1 MiB on the AST1060. Mapped + // because init resolves geometry and runs timing + // calibration against every configured chip select, + // not just the one this app uses. + name: "fmc_cs0_window", + type: "device", + start_address: 0x80000000, + size_bytes: 0x100000, + }, + { + // FMC CS1 memory-mapped flash read window (64 MiB); + // the image lands here. + name: "fmc_cs1_window", + type: "device", + start_address: 0x88000000, + size_bytes: 0x04000000, + }, + ], + }, + ], + }, + ], +} diff --git a/target/ast10x0/tests/pldm/firmware_update/target.rs b/target/ast10x0/tests/pldm/firmware_update/target.rs new file mode 100644 index 000000000..9008896cd --- /dev/null +++ b/target/ast10x0/tests/pldm/firmware_update/target.rs @@ -0,0 +1,50 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +#![no_std] +#![no_main] + +use ast10x0_board::{Ast10x0Board, Ast10x0BoardDescriptor}; +use ast10x0_peripherals::scu::pinctrl; +use console_backend::console_backend_write_all; +use entry as _; +use target_common::{declare_target, TargetInterface}; + +pub struct Target; + +static PINCTRL_GROUPS: [&[ast10x0_peripherals::scu::PinctrlPin]; 2] = + [pinctrl::PINCTRL_I2C2, pinctrl::PINCTRL_FMC_QUAD]; + +impl TargetInterface for Target { + const NAME: &'static str = "AST10x0 PLDM firmware update"; + + fn main() -> ! { + // SAFETY: kernel main() runs once with exclusive hardware ownership. + if unsafe { + Ast10x0Board::new(Ast10x0BoardDescriptor { + pinctrl_groups: &PINCTRL_GROUPS, + }) + .init() + } + .is_err() + { + loop {} + } + + codegen::start(); + loop {} + } + + fn shutdown(code: u32) -> ! { + let sentinel: &[u8] = if code == 0 { + b"TEST_RESULT:PASS\n" + } else { + b"TEST_RESULT:FAIL\n" + }; + let _ = console_backend_write_all(sentinel); + #[expect(clippy::empty_loop)] + loop {} + } +} + +declare_target!(Target); diff --git a/target/ast10x0/tests/pldm/firmware_update/ua_main.rs b/target/ast10x0/tests/pldm/firmware_update/ua_main.rs new file mode 100644 index 000000000..df06e009e --- /dev/null +++ b/target/ast10x0/tests/pldm/firmware_update/ua_main.rs @@ -0,0 +1,427 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! PLDM Update Agent app (card B, the mock BMC). +//! +//! Stimulus for the firmware device on card A, not a second root of trust. It +//! walks the whole DSP0267 sequence: it identifies the device with +//! `QueryDeviceIdentifiers` and `GetFirmwareParameters`, hands over an image +//! with `RequestUpdate`, `PassComponentTable` and `UpdateComponent`, answers +//! the requests the firmware device raises on its own while it pulls the image +//! down, and finishes with `ActivateFirmware`. +//! +//! There is no Update Agent in the PLDM service (it is a firmware device only), +//! so the sequence below is written out by hand. + +#![no_main] +#![no_std] + +use core::cell::Cell; + +use openprot_mctp_client_ipc::IpcMctpClient; +use openprot_pldm_service::error::PldmMemError; +use openprot_pldm_service::{MctpPldmTransport, PldmServiceError}; +use pldm_common::codec::{PldmCodec, PldmCodecWithLifetime}; +use pldm_common::message::firmware_update::activate_fw::{ + ActivateFirmwareRequest, SelfContainedActivationRequest, +}; +use pldm_common::message::firmware_update::apply_complete::ApplyCompleteResponse; +use pldm_common::message::firmware_update::get_fw_params::{ + GetFirmwareParametersRequest, GetFirmwareParametersResponse, +}; +use pldm_common::message::firmware_update::pass_component::PassComponentTableRequest; +use pldm_common::message::firmware_update::query_devid::{ + QueryDeviceIdentifiersRequest, QueryDeviceIdentifiersResponse, +}; +use pldm_common::message::firmware_update::request_fw_data::{ + RequestFirmwareDataRequest, RequestFirmwareDataResponse, MAX_TRANSFER_SIZE, +}; +use pldm_common::message::firmware_update::request_update::RequestUpdateRequest; +use pldm_common::message::firmware_update::transfer_complete::TransferCompleteResponse; +use pldm_common::message::firmware_update::update_component::UpdateComponentRequest; +use pldm_common::message::firmware_update::verify_complete::VerifyCompleteResponse; +use pldm_common::protocol::base::{ + PldmBaseCompletionCode, PldmMsgHeader, PldmMsgType, TransferRespFlag, +}; +use pldm_common::protocol::firmware_update::{ + ComponentClassification, DescriptorType, FwUpdateCmd, PldmFirmwareString, UpdateOptionFlags, + VersionStringType, PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN, +}; +use pw_status::Error; +use userspace::{entry, syscall}; + +use app_pldm_ua::handle; + +/// This card's EID, matching the MCTP server app underneath it. +const UA_EID: u8 = 9; +/// The firmware device's EID on card A. +const FD_EID: u8 = 8; + +/// Size of the demo image, in bytes. Must match the firmware device's. +const IMAGE_SIZE: u32 = 1024; + +/// The UUID this agent expects the firmware device to report. It only updates +/// a device it recognises. +const DEVICE_UUID: [u8; 16] = [ + 0x4f, 0x50, 0x52, 0x54, 0x00, 0x01, 0x40, 0x00, 0xa0, 0x00, 0xde, 0xad, 0xbe, 0xef, 0x00, 0x01, +]; + +/// Comparison stamp offered for the new image. Must beat the stamp the device +/// reports for its running firmware or the component is refused. +const COMP_COMPARISON_STAMP: u32 = 1; + +/// How long each UA-initiated request waits for the firmware device's reply. +const REQUEST_TIMEOUT_MILLIS: u32 = 5_000; +/// How long the UA waits for each firmware-device-initiated request. +const SERVE_TIMEOUT_MILLIS: u32 = 30_000; + +/// Upper bound on firmware-device-initiated requests served before giving up. +/// A clean run is ceil(IMAGE_SIZE / MAX_TRANSFER_SIZE) RequestFirmwareData plus +/// TransferComplete, VerifyComplete, and ApplyComplete. +const MAX_SERVED_REQUESTS: u32 = 64; + +const UA_BUF_SIZE: usize = 1024; + +/// The byte the demo image carries at `offset`. The firmware device generates +/// the same sequence and rejects anything that does not match. +fn expected_byte(offset: usize) -> u8 { + (offset % 251) as u8 +} + +/// Build a fixed-size PLDM firmware version string. +fn fw_string(s: &str) -> PldmFirmwareString { + let bytes = s.as_bytes(); + let mut str_data = [0u8; PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN]; + let len = bytes.len().min(PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN); + str_data[..len].copy_from_slice(&bytes[..len]); + PldmFirmwareString { + str_type: VersionStringType::Ascii as u8, + str_len: len as u8, + str_data, + } +} + +/// Answer one firmware-device-initiated request in place. +/// +/// `framed_buf[0]` is the MCTP type byte and the request occupies +/// `framed_buf[1..req_total_len]`; the response is written back over +/// `framed_buf[1..]`. Returns the total response length including the type +/// byte, and sets `saw_apply_complete` once the device reports it is done. +fn serve_fd_request( + framed_buf: &mut [u8], + req_total_len: usize, + saw_apply_complete: &Cell, +) -> Result { + let success = PldmBaseCompletionCode::Success as u8; + + // Decode to owned values first so the response can be written back over + // the same buffer. + let (instance_id, cmd, fw_window) = { + let payload = &framed_buf[1..req_total_len]; + let Ok(header) = PldmMsgHeader::<[u8; 3]>::decode(payload) else { + pw_log::error!("UA: could not decode FD request header"); + return Ok(0); + }; + let cmd = header.cmd_code(); + let fw_window = if cmd == FwUpdateCmd::RequestFirmwareData as u8 { + match RequestFirmwareDataRequest::decode(payload) { + Ok(req) => Some((req.offset as usize, req.length as usize)), + Err(_) => { + pw_log::error!("UA: could not decode RequestFirmwareData"); + return Ok(0); + } + } + } else { + None + }; + (header.instance_id(), cmd, fw_window) + }; + + let resp = &mut framed_buf[1..]; + let resp_len = match FwUpdateCmd::try_from(cmd) { + Ok(FwUpdateCmd::RequestFirmwareData) => { + let Some((offset, length)) = fw_window else { + return Ok(0); + }; + if length > MAX_TRANSFER_SIZE { + pw_log::error!("UA: FD asked for {} bytes, over the MTU", length as u32); + return Ok(0); + } + let mut chunk = [0u8; MAX_TRANSFER_SIZE]; + for (i, byte) in chunk[..length].iter_mut().enumerate() { + *byte = expected_byte(offset + i); + } + let msg = RequestFirmwareDataResponse::new(instance_id, success, &chunk[..length]); + PldmCodecWithLifetime::encode(&msg, resp) + } + Ok(FwUpdateCmd::TransferComplete) => { + TransferCompleteResponse::new(instance_id, success).encode(resp) + } + Ok(FwUpdateCmd::VerifyComplete) => { + VerifyCompleteResponse::new(instance_id, success).encode(resp) + } + Ok(FwUpdateCmd::ApplyComplete) => { + saw_apply_complete.set(true); + ApplyCompleteResponse::new(instance_id, success).encode(resp) + } + _ => { + pw_log::error!("UA: unexpected FD request, cmd={}", cmd as u32); + return Ok(0); + } + }; + + match resp_len { + Ok(len) => Ok(len + 1), + Err(_) => { + pw_log::error!("UA: could not encode response to cmd={}", cmd as u32); + Ok(0) + } + } +} + +/// Drives the update; `Ok(true)` means the firmware device reported apply +/// complete and then accepted activation, which is this card's pass condition. +fn run_update(transport: &MctpPldmTransport) -> Result { + // Registered before UpdateComponent is sent: the firmware device starts + // issuing RequestFirmwareData the moment it answers that command, and the + // MCTP stack drops inbound requests with no listener bound. + let mut listener = transport.responder_listener(SERVE_TIMEOUT_MILLIS)?; + + let comp_ver = fw_string("v1.0"); + let mut buf = [0u8; UA_BUF_SIZE]; + let mut instance_id = 0u8; + + // Returns the completion code and the length of the PLDM response, which + // starts at buf[1]. + let transact = |pldm_len: usize, buf: &mut [u8]| -> Result<(u8, usize), PldmServiceError> { + let resp_len = transport.send_request(FD_EID, pldm_len, buf, REQUEST_TIMEOUT_MILLIS)?; + // The completion code follows the 3-byte PLDM header. + Ok((if resp_len > 3 { buf[4] } else { 0xff }, resp_len)) + }; + + // ---- QueryDeviceIdentifiers: confirm which device answered ---- + let query_devid = QueryDeviceIdentifiersRequest::new(instance_id, PldmMsgType::Request); + let len = query_devid + .encode(&mut buf[1..]) + .map_err(|_| PldmServiceError::PldmMem(PldmMemError::BufferTooSmall))?; + let (completion_code, resp_len) = transact(len, &mut buf)?; + if completion_code != 0 { + pw_log::error!( + "UA: QueryDeviceIdentifiers rejected, completion code {}", + completion_code as u32 + ); + return Ok(false); + } + let Ok(devid) = QueryDeviceIdentifiersResponse::decode(&buf[1..1 + resp_len]) else { + pw_log::error!("UA: could not decode QueryDeviceIdentifiers response"); + return Ok(false); + }; + let descriptor = devid.initial_descriptor; + if descriptor.descriptor_type != DescriptorType::Uuid as u16 + || descriptor.descriptor_data[..DEVICE_UUID.len()] != DEVICE_UUID + { + pw_log::error!("UA: device identifier does not match, refusing to update"); + return Ok(false); + } + pw_log::info!("UA: device identified by UUID"); + + // ---- GetFirmwareParameters: learn which component to offer ---- + instance_id += 1; + let get_params = GetFirmwareParametersRequest::new(instance_id, PldmMsgType::Request); + let len = get_params + .encode(&mut buf[1..]) + .map_err(|_| PldmServiceError::PldmMem(PldmMemError::BufferTooSmall))?; + let (completion_code, resp_len) = transact(len, &mut buf)?; + if completion_code != 0 { + pw_log::error!( + "UA: GetFirmwareParameters rejected, completion code {}", + completion_code as u32 + ); + return Ok(false); + } + let Ok(params) = GetFirmwareParametersResponse::decode(&buf[1..1 + resp_len]) else { + pw_log::error!("UA: could not decode GetFirmwareParameters response"); + return Ok(false); + }; + let comp_count = params.parms.params_fixed.comp_count; + if comp_count != 1 { + pw_log::error!( + "UA: device reports {} components, expected 1", + comp_count as u32 + ); + return Ok(false); + } + let entry = ¶ms.parms.comp_param_table[0].comp_param_entry_fixed; + if entry.comp_classification != ComponentClassification::Firmware as u16 { + pw_log::error!( + "UA: component is not firmware, classification {}", + entry.comp_classification as u32 + ); + return Ok(false); + } + // The device is the source of truth for the identifier; this agent offers + // an update for whatever it reported. + let comp_identifier = entry.comp_identifier; + let comp_classification_index = entry.comp_classification_index; + pw_log::info!( + "UA: device offers component {} for update", + comp_identifier as u32 + ); + + // ---- RequestUpdate: move the firmware device out of Idle ---- + instance_id += 1; + let req_update = RequestUpdateRequest::new( + instance_id, + PldmMsgType::Request, + IMAGE_SIZE, // max_transfer_size + 1, // num_of_comp + 1, // max_outstanding_transfer_req + 0, // pkg_data_len + &comp_ver, + ); + let len = req_update + .encode(&mut buf[1..]) + .map_err(|_| PldmServiceError::PldmMem(PldmMemError::BufferTooSmall))?; + let (completion_code, _) = transact(len, &mut buf)?; + if completion_code != 0 { + pw_log::error!( + "UA: RequestUpdate rejected, completion code {}", + completion_code as u32 + ); + return Ok(false); + } + + // ---- PassComponentTable: describe the single component ---- + instance_id += 1; + let pass_comp = PassComponentTableRequest::new( + instance_id, + PldmMsgType::Request, + TransferRespFlag::StartAndEnd, + ComponentClassification::Firmware, + comp_identifier, + comp_classification_index, + COMP_COMPARISON_STAMP, + &comp_ver, + ); + let len = pass_comp + .encode(&mut buf[1..]) + .map_err(|_| PldmServiceError::PldmMem(PldmMemError::BufferTooSmall))?; + let (completion_code, _) = transact(len, &mut buf)?; + if completion_code != 0 { + pw_log::error!( + "UA: PassComponentTable rejected, completion code {}", + completion_code as u32 + ); + return Ok(false); + } + + // ---- UpdateComponent: the firmware device starts pulling the image ---- + instance_id += 1; + let update_comp = UpdateComponentRequest::new( + instance_id, + PldmMsgType::Request, + ComponentClassification::Firmware, + comp_identifier, + comp_classification_index, + COMP_COMPARISON_STAMP, + IMAGE_SIZE, + UpdateOptionFlags(0), + &comp_ver, + ); + let len = update_comp + .encode(&mut buf[1..]) + .map_err(|_| PldmServiceError::PldmMem(PldmMemError::BufferTooSmall))?; + let (completion_code, _) = transact(len, &mut buf)?; + if completion_code != 0 { + pw_log::error!( + "UA: UpdateComponent rejected, completion code {}", + completion_code as u32 + ); + return Ok(false); + } + + pw_log::info!("UA: handing over {} bytes", IMAGE_SIZE as u32); + + let saw_apply_complete = Cell::new(false); + for _ in 0..MAX_SERVED_REQUESTS { + transport.respond_once( + &mut listener, + &mut buf, + |framed_buf, req_total_len, _eid| { + serve_fd_request(framed_buf, req_total_len, &saw_apply_complete) + }, + )?; + if saw_apply_complete.get() { + pw_log::info!("UA: firmware device reported apply complete"); + break; + } + } + + if !saw_apply_complete.get() { + pw_log::error!("UA: gave up after {} requests", MAX_SERVED_REQUESTS as u32); + return Ok(false); + } + + // ---- ActivateFirmware: the device runs the new image and goes Idle ---- + instance_id += 1; + let activate = ActivateFirmwareRequest::new( + instance_id, + PldmMsgType::Request, + SelfContainedActivationRequest::ActivateSelfContainedComponents, + ); + let len = activate + .encode(&mut buf[1..]) + .map_err(|_| PldmServiceError::PldmMem(PldmMemError::BufferTooSmall))?; + let (completion_code, _) = transact(len, &mut buf)?; + if completion_code != 0 { + pw_log::error!( + "UA: ActivateFirmware rejected, completion code {}", + completion_code as u32 + ); + return Ok(false); + } + + pw_log::info!("UA: firmware activated, update complete"); + Ok(true) +} + +#[entry] +fn entry() { + let transport = MctpPldmTransport::new(IpcMctpClient::new(handle::MCTP)); + + if transport.stack().set_eid(UA_EID).is_err() { + pw_log::error!("UA: set_eid failed"); + let _ = syscall::debug_shutdown(Err(Error::Internal)); + loop {} + } + + pw_log::info!("UA: driving an update against EID {}", FD_EID as u32); + // The harness watches both cards and requires a verdict from each, so this + // card reports whether it saw the update through, not just card A. + match run_update(&transport) { + Ok(true) => { + let _ = syscall::debug_shutdown(Ok(())); + } + Ok(false) => { + let _ = syscall::debug_shutdown(Err(Error::Internal)); + } + Err(PldmServiceError::Mctp(e)) => { + pw_log::error!("UA: update flow failed, MCTP code {}", e.code as u32); + let _ = syscall::debug_shutdown(Err(Error::Internal)); + } + Err(_) => { + pw_log::error!("UA: update flow failed on a PLDM error"); + let _ = syscall::debug_shutdown(Err(Error::Internal)); + } + } + + #[expect(clippy::empty_loop)] + loop {} +} + +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + pw_log::error!("UA: panic"); + let _ = syscall::debug_shutdown(Err(Error::Internal)); + loop {} +} diff --git a/target/ast10x0/tests/smc/dma_irq/target.rs b/target/ast10x0/tests/smc/dma_irq/target.rs index 0f311f388..7a43d5ccf 100644 --- a/target/ast10x0/tests/smc/dma_irq/target.rs +++ b/target/ast10x0/tests/smc/dma_irq/target.rs @@ -22,11 +22,12 @@ use core::sync::atomic::{AtomicBool, AtomicU32, Ordering}; use core::task::Poll; use arch_arm_cortex_m::Arch; +use ast10x0_peripherals::aperture::{take_aperture, Aperture}; use ast10x0_peripherals::scu::pinctrl::PINCTRL_FMC_QUAD; use ast10x0_peripherals::scu::ScuRegisters; use ast10x0_peripherals::smc::{ - ChipSelect, FlashConfig, SmcConfig, SmcController, SmcError, SmcInterrupt, SmcTopology, - UninitSmc, + Cs, FlashConfig, FmcUninit, SmcConfig, SmcController, SmcError, SmcInstance, SmcInterrupt, + SmcTopology, }; use codegen as _; use console_backend::console_backend_write_all; @@ -41,13 +42,22 @@ use target_debug::{dump_smc_read, dump_smc_register}; pub struct Target {} -const FLASH_CFG: FlashConfig = FlashConfig { - capacity_mb: 16, - page_size: 256, - sector_size: 4096, - block_size: 65536, - spi_clock_mhz: 50, -}; +/// Compile-time FMC descriptor: single CS0 device at 50 MHz on the boot-SPI +/// interface, DMA-completion interrupts enabled, geometry discovered over SFDP +/// at init. +struct FmcInstance; + +impl SmcInstance for FmcInstance { + type Regs = Aperture; + const CONTROLLER: SmcController = SmcController::Fmc; + const CONFIG: SmcConfig = SmcConfig { + cs0: Some(FlashConfig { spi_clock_mhz: 50 }), + cs1: None, + dma_enabled: true, + enable_interrupts: true, + topology: SmcTopology::BootSpi { master_idx: 0 }, + }; +} const DMA_FLASH_OFFSET: u32 = 0x500; const DMA_DRAM_ADDR: usize = 0x0004_1000; @@ -90,14 +100,12 @@ pub fn fmc_dma_irq_handler(_kernel: K) { ); } -fn poll_dma_irq_completion( - controller: &mut ast10x0_peripherals::smc::ReadySmc, -) -> Poll> { +fn poll_dma_irq_completion(cs: &mut Cs<'_>) -> Poll> { if !FMC_DMA_IRQ_FIRED.swap(false, Ordering::AcqRel) { return Poll::Pending; } - match controller.handle_dma_irq() { + match cs.handle_dma_irq() { Ok(SmcInterrupt::DmaComplete) => Poll::Ready(Ok(())), Ok(_) => Poll::Ready(Err(SmcError::HardwareError)), Err(err) => Poll::Ready(Err(err)), @@ -108,19 +116,10 @@ fn run_dma_read_irq_test() -> Result<(), SmcError> { let scu = unsafe { ScuRegisters::new_global_unlocked() }; scu.apply_pinctrl_group(PINCTRL_FMC_QUAD); - let config = SmcConfig { - controller_id: SmcController::Fmc, - cs0: Some(FLASH_CFG), - cs1: None, - dma_enabled: true, - enable_interrupts: true, - topology: SmcTopology::BootSpi { master_idx: 0 }, - }; - - let uninit = unsafe { UninitSmc::new(config)? }; - let mut controller = uninit.init()?; - - controller.spi_nor_read_init(ChipSelect::Cs0)?; + let mut controller = unsafe { + FmcUninit::::new(take_aperture(), take_aperture(), take_aperture())? + } + .init()?; if !controller.is_ready() || controller.controller_id() != SmcController::Fmc { return Err(SmcError::HardwareError); @@ -136,7 +135,10 @@ fn run_dma_read_irq_test() -> Result<(), SmcError> { pw_log::info!("SMC DMA IRQ: starting DMA read"); dump_smc_register(0x7E62_0000, 8); dump_smc_register(0x7E62_0080, 8); - controller.dma_read(ChipSelect::Cs0, DMA_FLASH_OFFSET, DMA_DRAM_ADDR, DMA_LEN)?; + { + let mut cs0 = controller.cs0()?; + cs0.dma_read(DMA_FLASH_OFFSET, DMA_DRAM_ADDR, DMA_LEN)?; + } pw_log::info!("after calling dma_read()"); dump_smc_register(0x7E62_0000, 8); dump_smc_register(0x7E62_0080, 8); @@ -144,36 +146,47 @@ fn run_dma_read_irq_test() -> Result<(), SmcError> { return Err(SmcError::HardwareError); } - for _ in 0..DMA_IRQ_TIMEOUT { - match poll_dma_irq_completion(&mut controller) { - Poll::Ready(result) => { - result?; - if !controller.is_ready() { - return Err(SmcError::HardwareError); + let mut completed = false; + { + let mut cs0 = controller.cs0()?; + for _ in 0..DMA_IRQ_TIMEOUT { + match poll_dma_irq_completion(&mut cs0) { + Poll::Ready(result) => { + result?; + completed = true; + break; } - pw_log::info!("SMC DMA IRQ: DMA read completed via IRQ"); - let dma_buf = unsafe { - core::slice::from_raw_parts(DMA_DRAM_ADDR as *const u8, DMA_LEN as usize) - }; - dump_smc_register(0x7E62_0000, 8); - dump_smc_register(0x7E62_0080, 8); - dump_smc_read(dma_buf, DMA_LEN); - return Ok(()); + Poll::Pending => core::hint::spin_loop(), } - Poll::Pending => core::hint::spin_loop(), + } + if !completed { + pw_log::info!("dma Timeout"); + pw_log::info!( + "FMC IRQ count={}", + FMC_DMA_IRQ_COUNT.load(Ordering::Acquire) as u32 + ); + pw_log::info!( + "FMC DMA status at timeout=0x{:08x}", + cs0.dma_status() as u32 + ); } } - pw_log::info!("dma Timeout"); - pw_log::info!( - "FMC IRQ count={}", - FMC_DMA_IRQ_COUNT.load(Ordering::Acquire) as u32 - ); - pw_log::info!( - "FMC DMA status at timeout=0x{:08x}", - controller.dma_status() as u32 - ); - dump_nvic_irq_state(FMC_IRQ); - Err(SmcError::Timeout) + + if !completed { + dump_nvic_irq_state(FMC_IRQ); + return Err(SmcError::Timeout); + } + + if !controller.is_ready() { + return Err(SmcError::HardwareError); + } + pw_log::info!("SMC DMA IRQ: DMA read completed via IRQ"); + let dma_buf = + unsafe { core::slice::from_raw_parts(DMA_DRAM_ADDR as *const u8, DMA_LEN as usize) }; + dump_smc_register(0x7E62_0000, 8); + dump_smc_register(0x7E62_0080, 8); + dump_smc_read(dma_buf, DMA_LEN); + Ok(()) } codegen::declare_kernel_interrupt_handlers!(); diff --git a/target/ast10x0/tests/smc/read/BUILD.bazel b/target/ast10x0/tests/smc/read/BUILD.bazel index d437777e5..21739fefd 100644 --- a/target/ast10x0/tests/smc/read/BUILD.bazel +++ b/target/ast10x0/tests/smc/read/BUILD.bazel @@ -6,7 +6,7 @@ load("@pigweed//pw_kernel/tooling:target_codegen.bzl", "target_codegen") load("@pigweed//pw_kernel/tooling:target_linker_script.bzl", "target_linker_script") load("@pigweed//pw_kernel/tooling/panic_detector:rust_binary_no_panics_test.bzl", "rust_binary_no_panics_test") load("@rules_rust//rust:defs.bzl", "rust_binary") -load("//target/ast10x0:defs.bzl", "TARGET_COMPATIBLE_WITH") +load("//target/ast10x0:defs.bzl", "TARGET_COMPATIBLE_WITH", "flash_system_image_test") filegroup( name = "system_config", @@ -185,3 +185,21 @@ rust_binary_no_panics_test( binary = ":smc_read_test", tags = ["kernel"], ) + +# QEMU variant: default 1 MiB w25q80bl model controller-wide, with both chip +# selects backed by distinctly-filled images (CS0 = 0x11, CS1 = 0x22) so a +# read/DMA dump reveals which CS the firmware decoded. The current test pins +# cs0: None, collapsing CS1 to 0x8000_0000, so it reads out 0x22 (CS1). +# bazelisk run --config=virt_ast10x0 //target/ast10x0/tests/smc/read:smc_read_qemu_test +flash_system_image_test( + name = "smc_read_qemu_test", + cs0_fill = 0x11, + cs0_image = "cs0.img", + cs1_fill = 0x22, + cs1_image = "cs1.img", + flash_size = 1 * 1024 * 1024, + image = ":smc_read_test", + tags = ["qemu_only"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + visibility = ["//visibility:public"], +) diff --git a/target/ast10x0/tests/smc/read/target.rs b/target/ast10x0/tests/smc/read/target.rs index 5bf0507f2..3d4235a57 100644 --- a/target/ast10x0/tests/smc/read/target.rs +++ b/target/ast10x0/tests/smc/read/target.rs @@ -19,11 +19,13 @@ #![no_std] #![no_main] +use ast10x0_peripherals::aperture::{take_aperture, Aperture}; #[allow(unused_imports)] use ast10x0_peripherals::scu::pinctrl::PINCTRL_FMC_QUAD; use ast10x0_peripherals::scu::ScuRegisters; use ast10x0_peripherals::smc::{ - ChipSelect, FlashConfig, SmcConfig, SmcController, SmcError, SmcTopology, UninitSmc, + FlashConfig, FmcUninit, SmcConfig, SmcController, SmcError, SmcInstance, SmcTopology, + TransferMode, }; use console_backend::console_backend_write_all; use target_common::{declare_target, TargetInterface}; @@ -33,8 +35,30 @@ use {console_backend as _, entry as _}; mod target_debug; use target_debug::{dump_smc_read, dump_smc_register}; +/// Compile-time FMC descriptor: CS0 and CS1 driven on the EVB at 50 MHz, +/// geometry discovered over SFDP at init. +struct FmcInstance; + +impl SmcInstance for FmcInstance { + type Regs = Aperture; + const CONTROLLER: SmcController = SmcController::Fmc; + const CONFIG: SmcConfig = SmcConfig { + cs0: Some(FlashConfig { spi_clock_mhz: 50 }), + cs1: Some(FlashConfig { spi_clock_mhz: 50 }), + dma_enabled: true, + enable_interrupts: false, + topology: SmcTopology::BootSpi { master_idx: 0 }, + }; +} + pub struct Target {} +/// DMA destination buffer. The FMC DMA engine (an AHB bus master) writes here, +/// so it must live in non-cached SRAM the engine and CPU observe coherently. +/// `.ram_nc` (0xA0000) is above both code and the kernel RAM region. +#[unsafe(link_section = ".ram_nc")] +static mut SMC_DMA_BUF: [u8; 256] = [0u8; 256]; + #[allow(dead_code)] fn run_smc_read_test() -> Result<(), SmcError> { // --- 1. Init --- @@ -42,45 +66,37 @@ fn run_smc_read_test() -> Result<(), SmcError> { let scu = unsafe { ScuRegisters::new_global_unlocked() }; scu.apply_pinctrl_group(PINCTRL_FMC_QUAD); - let config = SmcConfig { - controller_id: SmcController::Fmc, - - cs0: Some(FlashConfig { - capacity_mb: 8, - page_size: 256, - sector_size: 4096, - block_size: 65536, - spi_clock_mhz: 50, - }), - cs1: Some(FlashConfig { - capacity_mb: 64, - page_size: 256, - sector_size: 4096, - block_size: 65536, - spi_clock_mhz: 50, - }), - dma_enabled: true, - enable_interrupts: false, - topology: SmcTopology::BootSpi { master_idx: 0 }, - }; pw_log::info!("=== AST10x0 smc read test ==="); - let controller = unsafe { UninitSmc::new(config)? }; - let mut controller = controller.init()?; - - let _ = match controller.spi_nor_read_init(ChipSelect::Cs0) { - Ok(v) => v, - Err(e) => { - pw_log::info!("Error:: spi_nor_read_init cs0"); - return Err(e); - } - }; - let _ = match controller.spi_nor_read_init(ChipSelect::Cs1) { - Ok(v) => v, - Err(e) => { - pw_log::info!("Error:: spi_nor_read_init cs1"); - return Err(e); - } - }; + let mut controller = unsafe { + FmcUninit::::new(take_aperture(), take_aperture(), take_aperture())? + } + .init()?; + + let mut id = [0u8; 3]; + controller + .cs1()? + .transceive_user(&[0x9F], &[], &mut id, TransferMode::Mode111)?; + pw_log::info!( + "RDID cs1: mfr=0x{:02x} type=0x{:02x} cap=0x{:02x}", + id[0] as u32, + id[1] as u32, + id[2] as u32 + ); + + let mut sfdp = [0u8; 256]; + controller + .cs1()? + .transceive_user(&[0x5A], &[0, 0, 0, 0], &mut sfdp, TransferMode::Mode111)?; + dump_smc_read(&sfdp, 64); + + let g = controller.cs1()?.geometry(); + pw_log::info!( + "geom cs1: cap=0x{:08x} page={} sector={} block={}", + g.capacity_bytes as u32, + g.page_size as u32, + g.sector_size as u32, + g.block_size as u32 + ); pw_log::info!("=== Dump 0x7E62_0000 ==="); dump_smc_register(0x7E62_0000, 16); @@ -92,17 +108,9 @@ fn run_smc_read_test() -> Result<(), SmcError> { // --- 2. MMIO read — success path --- // Confirm the call succeeds and returns the correct byte count. Flash // content is not inspected so this is safe on both QEMU and silicon. - // TODO: need to add test CS1 - pw_log::info!("=== read test cs0==="); - let mut buf = [0u8; 64]; - let n = controller.read(ChipSelect::Cs0, 0x400, &mut buf)?; - if n != 64 { - return Err(SmcError::HardwareError); - } - dump_smc_read(&buf, 64); - pw_log::info!("=== read test cs1==="); - let n = controller.read(ChipSelect::Cs1, 0x400, &mut buf)?; + let mut buf = [0u8; 64]; + let n = controller.cs1()?.read(0x400, &mut buf)?; if n != 64 { return Err(SmcError::HardwareError); } @@ -110,23 +118,33 @@ fn run_smc_read_test() -> Result<(), SmcError> { pw_log::info!("=== read dma test==="); // --- 4. DMA --- - let tempbuf = unsafe { core::slice::from_raw_parts(0x41500 as *mut u8, 256) }; - - let _ = match controller.dma_read(ChipSelect::Cs0, 0x400, 0x41500 as usize, 256) { - Err(SmcError::InvalidCapacity) => Ok(()), - Err(other) => Err(other), - Ok(()) => Err(SmcError::HardwareError), - }; + // SAFETY: SMC_DMA_BUF is a non-cached SRAM static uniquely owned here for + // the duration of the DMA; the engine and CPU observe it coherently. + let dma_buf: &'static mut [u8] = unsafe { &mut *core::ptr::addr_of_mut!(SMC_DMA_BUF) }; + + // Poison the destination: an all-0xff readback then proves the DMA wrote it. + dma_buf.fill(0xAA); + pw_log::info!("=== dma dest preseed (expect AA) ==="); + dump_smc_read(dma_buf, 256); + + { + let mut cs1 = controller.cs1()?; + let _ = match cs1.dma_read(0x400, dma_buf.as_ptr() as usize, 256) { + Err(SmcError::InvalidCapacity) => Ok(()), + Err(other) => Err(other), + Ok(()) => Err(SmcError::HardwareError), + }; - loop { - match controller.poll_dma_completion() { - core::task::Poll::Pending => { - // still running - } - core::task::Poll::Ready(result) => { - result?; - pw_log::info!("dma completion is ready"); - break; + loop { + match cs1.poll_dma_completion() { + core::task::Poll::Pending => { + // still running + } + core::task::Poll::Ready(result) => { + result?; + pw_log::info!("dma completion is ready"); + break; + } } } } @@ -134,7 +152,7 @@ fn run_smc_read_test() -> Result<(), SmcError> { pw_log::info!("=== dma done= =="); dump_smc_register(0x7E62_0000, 8); dump_smc_register(0x7E62_0080, 8); - dump_smc_read(tempbuf, 256); + dump_smc_read(dma_buf, 256); Ok(()) } diff --git a/target/ast10x0/tests/smc/read/target_spi1.rs b/target/ast10x0/tests/smc/read/target_spi1.rs index 04d23f7e2..785cb2ab1 100644 --- a/target/ast10x0/tests/smc/read/target_spi1.rs +++ b/target/ast10x0/tests/smc/read/target_spi1.rs @@ -6,12 +6,13 @@ #![no_std] #![no_main] +use ast10x0_peripherals::aperture::{take_aperture, Aperture}; use ast10x0_peripherals::scu::{ pinctrl::{PINCTRL_SPI1_QUAD, PINCTRL_SPIM1_DEFAULT}, ScuExtMuxSelect, ScuRegisters, SpiMonitorInstance, SpiMonitorPassthrough, SpiMonitorSource, }; use ast10x0_peripherals::smc::{ - ChipSelect, FlashConfig, SmcConfig, SmcController, SmcError, SmcTopology, SpiNorFlash, + FlashConfig, SmcConfig, SmcController, SmcError, SmcInstance, SmcTopology, SpiNorFlash, SpiNorFlashDevice, SpiTransaction, SpiUninit, }; use console_backend::console_backend_write_all; @@ -22,13 +23,21 @@ use {console_backend as _, entry as _}; mod target_debug; use target_debug::{dump_smc_read, dump_smc_register}; -const SPI_FLASH_CONFIG: FlashConfig = FlashConfig { - capacity_mb: 32, - page_size: 256, - sector_size: 4096, - block_size: 65536, - spi_clock_mhz: 50, -}; +/// Compile-time SPI1 descriptor: single CS0 device at 50 MHz on the host-SPI +/// interface, geometry discovered over SFDP at init. +struct Spi1Instance; + +impl SmcInstance for Spi1Instance { + type Regs = Aperture; + const CONTROLLER: SmcController = SmcController::Spi1; + const CONFIG: SmcConfig = SmcConfig { + cs0: Some(FlashConfig { spi_clock_mhz: 50 }), + cs1: None, + dma_enabled: true, + enable_interrupts: false, + topology: SmcTopology::HostSpi { master_idx: 0 }, + }; +} pub struct Target {} @@ -49,26 +58,18 @@ fn config_spi1_master_controller() -> Result<(), SmcError> { fn run_spi1_read_test() -> Result<(), SmcError> { config_spi1_master_controller()?; - let config = SmcConfig { - controller_id: SmcController::Spi1, - cs0: Some(SPI_FLASH_CONFIG), - cs1: None, - dma_enabled: true, - enable_interrupts: false, - topology: SmcTopology::HostSpi { master_idx: 0 }, - }; - pw_log::info!("=== AST10x0 SMC SPI1 read test ==="); - let spi = unsafe { SpiUninit::new(SmcController::Spi1, config)? }; - let mut spi = spi.init()?; - spi.spi_nor_read_init(ChipSelect::Cs0)?; + let mut spi = unsafe { + SpiUninit::::new(take_aperture(), take_aperture(), take_aperture())? + } + .init()?; if !spi.is_ready() { return Err(SmcError::HardwareError); } let jedec = { - let flash = SpiNorFlash::from_spi_cs(&mut spi, SPI_FLASH_CONFIG, ChipSelect::Cs0)?; + let flash = SpiNorFlash::new(spi.cs0()?)?; flash.jedec_id()? }; pw_log::info!( @@ -88,13 +89,7 @@ fn run_spi1_read_test() -> Result<(), SmcError> { pw_log::info!("=== SPI1 read ==="); let mut buf = [0u8; 64]; - let n = SpiTransaction::read_with_spim( - &mut spi, - SpiMonitorInstance::Spim0, - ChipSelect::Cs0, - 0x0, - &mut buf, - )?; + let n = SpiTransaction::read_with_spim(spi.cs0()?, SpiMonitorInstance::Spim0, 0x0, &mut buf)?; if n != buf.len() { return Err(SmcError::HardwareError); } @@ -103,9 +98,8 @@ fn run_spi1_read_test() -> Result<(), SmcError> { pw_log::info!("=== SPI1 DMA read @ 0x00000000 ==="); let dma_buf = unsafe { core::slice::from_raw_parts_mut(0x41500 as *mut u8, 256) }; let mut dma_txn = SpiTransaction::dma_read_with_spim( - &mut spi, + spi.cs0()?, SpiMonitorInstance::Spim0, - ChipSelect::Cs0, 0x0, 0x41500usize, dma_buf.len() as u32, diff --git a/target/ast10x0/tests/smc/read/target_spi2.rs b/target/ast10x0/tests/smc/read/target_spi2.rs index e3407062b..ecc3f5509 100644 --- a/target/ast10x0/tests/smc/read/target_spi2.rs +++ b/target/ast10x0/tests/smc/read/target_spi2.rs @@ -6,13 +6,14 @@ #![no_std] #![no_main] use ast10x0_board::{apply_spim_external_mux, enable_flash_power}; +use ast10x0_peripherals::aperture::{take_aperture, Aperture}; #[allow(unused_imports)] use ast10x0_peripherals::scu::{ pinctrl::{PINCTRL_SPI2_QUAD, PINCTRL_SPIM3_DEFAULT, PINCTRL_SPIM4_DEFAULT}, ScuExtMuxSelect, ScuRegisters, SpiMonitorInstance, SpiMonitorPassthrough, SpiMonitorSource, }; use ast10x0_peripherals::smc::{ - ChipSelect, FlashConfig, SmcConfig, SmcController, SmcError, SmcTopology, SpiTransaction, + FlashConfig, SmcConfig, SmcController, SmcError, SmcInstance, SmcTopology, SpiTransaction, SpiUninit, TransferMode, }; use console_backend::console_backend_write_all; @@ -23,13 +24,21 @@ use {console_backend as _, entry as _}; mod target_debug; use target_debug::{dump_smc_read, dump_smc_register}; -const SPI_FLASH_CONFIG: FlashConfig = FlashConfig { - capacity_mb: 32, - page_size: 256, - sector_size: 4096, - block_size: 65536, - spi_clock_mhz: 25, -}; +/// Compile-time SPI2 descriptor: single CS0 device at 25 MHz on the normal-SPI +/// interface (master_idx 2), geometry discovered over SFDP at init. +struct Spi2Instance; + +impl SmcInstance for Spi2Instance { + type Regs = Aperture; + const CONTROLLER: SmcController = SmcController::Spi2; + const CONFIG: SmcConfig = SmcConfig { + cs0: Some(FlashConfig { spi_clock_mhz: 25 }), + cs1: None, + dma_enabled: true, + enable_interrupts: false, + topology: SmcTopology::NormalSpi { master_idx: 2 }, + }; +} pub struct Target {} @@ -59,19 +68,11 @@ fn config_spi2_master_controller() -> Result<(), SmcError> { fn run_spi2_read_test() -> Result<(), SmcError> { config_spi2_master_controller()?; - let config = SmcConfig { - controller_id: SmcController::Spi2, - cs0: Some(SPI_FLASH_CONFIG), - cs1: None, - dma_enabled: true, - enable_interrupts: false, - topology: SmcTopology::NormalSpi { master_idx: 2 }, - }; - pw_log::info!("=== AST10x0 SMC SPI2 read test ==="); - let spi = unsafe { SpiUninit::new(SmcController::Spi2, config)? }; - let mut spi = spi.init()?; - spi.spi_nor_read_init(ChipSelect::Cs0)?; + let mut spi = unsafe { + SpiUninit::::new(take_aperture(), take_aperture(), take_aperture())? + } + .init()?; if !spi.is_ready() { return Err(SmcError::HardwareError); @@ -88,9 +89,8 @@ fn run_spi2_read_test() -> Result<(), SmcError> { dump_smc_register(0x7E78_0070, 2); let mut jedec = [0u8; 3]; SpiTransaction::transceive_user_with_spim( - &mut spi, + spi.cs0()?, SpiMonitorInstance::Spim2, - ChipSelect::Cs0, &[0x9f], &[], &mut jedec, @@ -110,13 +110,7 @@ fn run_spi2_read_test() -> Result<(), SmcError> { pw_log::info!("=== SPI2 read ==="); let mut buf = [0u8; 64]; - let n = SpiTransaction::read_with_spim( - &mut spi, - SpiMonitorInstance::Spim2, - ChipSelect::Cs0, - 0x0, - &mut buf, - )?; + let n = SpiTransaction::read_with_spim(spi.cs0()?, SpiMonitorInstance::Spim2, 0x0, &mut buf)?; if n != buf.len() { return Err(SmcError::HardwareError); } @@ -125,9 +119,8 @@ fn run_spi2_read_test() -> Result<(), SmcError> { pw_log::info!("=== SPI2 DMA read @ 0x00000000 ==="); let dma_buf = unsafe { core::slice::from_raw_parts_mut(0x41500 as *mut u8, 256) }; let mut dma_txn = SpiTransaction::dma_read_with_spim( - &mut spi, + spi.cs0()?, SpiMonitorInstance::Spim2, - ChipSelect::Cs0, 0x0, 0x41500usize, dma_buf.len() as u32, diff --git a/target/ast10x0/tests/smc/sfdp/BUILD.bazel b/target/ast10x0/tests/smc/sfdp/BUILD.bazel new file mode 100644 index 000000000..463744d3f --- /dev/null +++ b/target/ast10x0/tests/smc/sfdp/BUILD.bazel @@ -0,0 +1,78 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@pigweed//pw_kernel/tooling:system_image.bzl", "system_image", "system_image_test") +load("@pigweed//pw_kernel/tooling:target_codegen.bzl", "target_codegen") +load("@pigweed//pw_kernel/tooling:target_linker_script.bzl", "target_linker_script") +load("@pigweed//pw_kernel/tooling/panic_detector:rust_binary_no_panics_test.bzl", "rust_binary_no_panics_test") +load("@rules_rust//rust:defs.bzl", "rust_binary") +load("//target/ast10x0:defs.bzl", "TARGET_COMPATIBLE_WITH") + +filegroup( + name = "system_config", + srcs = ["system.json5"], +) + +target_codegen( + name = "codegen", + arch = "@pigweed//pw_kernel/arch/arm_cortex_m:arch_arm_cortex_m", + system_config = ":system_config", + target_compatible_with = TARGET_COMPATIBLE_WITH, +) + +target_linker_script( + name = "linker_script", + system_config = ":system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + template = "//target/ast10x0:linker_script_template", +) + +rust_binary( + name = "target", + srcs = [ + "target.rs", + ], + edition = "2024", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + deps = [ + ":codegen", + ":linker_script", + "//target/ast10x0:entry", + "//target/ast10x0/peripherals", + "@pigweed//pw_kernel/arch/arm_cortex_m:arch_arm_cortex_m", + "@pigweed//pw_kernel/kernel", + "@pigweed//pw_kernel/subsys/console:console_backend", + "@pigweed//pw_kernel/target:target_common", + "@pigweed//pw_log/rust:pw_log", + ], +) + +system_image( + name = "smc_sfdp_test", + kernel = ":target", + platform = "//target/ast10x0", + system_config = ":system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + userspace = False, + visibility = ["//visibility:public"], +) + +system_image_test( + name = "smc_sfdp_evb_test", + image = ":smc_sfdp_test", + tags = ["hardware"], + target_compatible_with = select({ + "//target/ast10x0:qemu_enabled": ["@platforms//:incompatible"], + "//conditions:default": [], + }), + visibility = ["//visibility:public"], +) + +rust_binary_no_panics_test( + name = "no_panics_test", + binary = ":smc_sfdp_test", + tags = ["kernel"], +) diff --git a/target/ast10x0/tests/smc/sfdp/system.json5 b/target/ast10x0/tests/smc/sfdp/system.json5 new file mode 100644 index 000000000..5eb8441cf --- /dev/null +++ b/target/ast10x0/tests/smc/sfdp/system.json5 @@ -0,0 +1,17 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +// AST10x0 kernel-only SMC FMC CS1 SFDP capacity-discovery test configuration. +{ + arch: { + type: "armv7m", + vector_table_start_address: 0x00000000, + vector_table_size_bytes: 1280, + }, + kernel: { + flash_start_address: 0x00000500, + flash_size_bytes: 262144, + ram_start_address: 0x00040500, + ram_size_bytes: 391936, // ends at RAM_NC boundary (0x000A0000) + }, +} diff --git a/target/ast10x0/tests/smc/sfdp/target.rs b/target/ast10x0/tests/smc/sfdp/target.rs new file mode 100644 index 000000000..75ed5341a --- /dev/null +++ b/target/ast10x0/tests/smc/sfdp/target.rs @@ -0,0 +1,121 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! AST10x0 SMC FMC CS1 SFDP config-discovery test target. +//! +//! Drives `FmcUninit::new(config).init()`: `init()` discovers both driven chip +//! selects from SFDP and finalizes a controller whose per-CS geometry is +//! *derived* from each chip — no capacity is fed in, only `spi_clock_mhz`. +//! Asserts the discovered CS1 capacity (EVB's W25Q512) is 64 MiB. Read-only: +//! issues only READ_SFDP / READ_ID; nothing is erased or programmed. + +#![no_std] +#![no_main] + +use ast10x0_peripherals::aperture::{take_aperture, Aperture}; +#[allow(unused_imports)] +use ast10x0_peripherals::scu::pinctrl::PINCTRL_FMC_QUAD; +use ast10x0_peripherals::scu::ScuRegisters; +use ast10x0_peripherals::smc::{ + FlashConfig, FmcUninit, SmcConfig, SmcController, SmcError, SmcInstance, SmcTopology, + SpiNorFlash, SpiNorFlashDevice, +}; +use console_backend::console_backend_write_all; +use target_common::{declare_target, TargetInterface}; +use {console_backend as _, entry as _}; + +/// The one geometry field SFDP does not encode; everything else is discovered. +const SPI_CLOCK_MHZ: u32 = 50; + +/// Expected capacity of the EVB's W25Q512 on CS1. +const CS1_EXPECTED_CAPACITY_MB: u32 = 64; + +/// Compile-time FMC descriptor: both CS driven on the EVB at 50 MHz. Capacity +/// for each is discovered by `init()`, not fed in here. +struct FmcInstance; + +impl SmcInstance for FmcInstance { + type Regs = Aperture; + const CONTROLLER: SmcController = SmcController::Fmc; + const CONFIG: SmcConfig = SmcConfig { + cs0: Some(FlashConfig { + spi_clock_mhz: SPI_CLOCK_MHZ, + }), + cs1: Some(FlashConfig { + spi_clock_mhz: SPI_CLOCK_MHZ, + }), + dma_enabled: false, + enable_interrupts: false, + topology: SmcTopology::BootSpi { master_idx: 0 }, + }; +} + +pub struct Target {} + +fn run_smc_fmc_cs1_sfdp_test() -> Result<(), SmcError> { + let scu = unsafe { ScuRegisters::new_global_unlocked() }; + scu.apply_pinctrl_group(PINCTRL_FMC_QUAD); + + pw_log::info!("=== AST10x0 SMC FMC CS1 SFDP config test ==="); + // Both CS are driven on the EVB; capacity for each is an OUTPUT of init(). + let mut fmc = unsafe { + FmcUninit::::new(take_aperture(), take_aperture(), take_aperture())? + } + .init()?; + + if !fmc.is_ready() { + return Err(SmcError::HardwareError); + } + + // CS1 geometry was discovered over SFDP during `init()`; read it back. + let g = { + let cs1 = fmc.cs1()?; + cs1.geometry() + }; + pw_log::info!( + "derived CS1 geom: cap=0x{:08x} page={} sector={} block={}", + g.capacity_bytes as u32, + g.page_size as u32, + g.sector_size as u32, + g.block_size as u32 + ); + + // JEDEC ID for the record (W25Q512 = EF 40 20). Read-only. + let jedec = { + let flash = SpiNorFlash::new(fmc.cs1()?)?; + flash.jedec_id()? + }; + pw_log::info!( + "CS1 JEDEC ID: {:02x} {:02x} {:02x}", + jedec[0] as u32, + jedec[1] as u32, + jedec[2] as u32 + ); + + let cap_mb = (g.capacity_bytes / (1024 * 1024)) as u32; + if cap_mb == CS1_EXPECTED_CAPACITY_MB { + pw_log::info!("SFDP-derived CS1 capacity MATCHES 64 MiB"); + Ok(()) + } else { + pw_log::info!("SFDP-derived CS1 capacity DIFFERS from 64 MiB"); + Err(SmcError::DeviceNotSupported) + } +} + +impl TargetInterface for Target { + const NAME: &'static str = "AST10x0 SMC FMC CS1 SFDP Test"; + + fn main() -> ! { + let sentinel = if run_smc_fmc_cs1_sfdp_test().is_ok() { + b"TEST_RESULT:PASS\n" + } else { + b"TEST_RESULT:FAIL\n" + }; + let _ = console_backend_write_all(sentinel); + + #[expect(clippy::empty_loop)] + loop {} + } +} + +declare_target!(Target); diff --git a/target/ast10x0/tests/smc/write/target.rs b/target/ast10x0/tests/smc/write/target.rs index cee181ff6..dbf6862e4 100644 --- a/target/ast10x0/tests/smc/write/target.rs +++ b/target/ast10x0/tests/smc/write/target.rs @@ -6,11 +6,12 @@ #![no_std] #![no_main] +use ast10x0_peripherals::aperture::{take_aperture, Aperture}; #[allow(unused_imports)] use ast10x0_peripherals::scu::pinctrl::PINCTRL_FMC_QUAD; use ast10x0_peripherals::scu::ScuRegisters; use ast10x0_peripherals::smc::{ - ChipSelect, FlashConfig, FmcUninit, SmcConfig, SmcController, SmcError, SmcTopology, + FlashConfig, FmcUninit, SmcConfig, SmcController, SmcError, SmcInstance, SmcTopology, SpiNorFlash, SpiNorFlashDevice, }; use console_backend::console_backend_write_all; @@ -21,21 +22,21 @@ use {console_backend as _, entry as _}; mod target_debug; use target_debug::{dump_smc_read, dump_smc_register}; -const CS0_CONFIG: FlashConfig = FlashConfig { - capacity_mb: 8, - page_size: 256, - sector_size: 4096, - block_size: 65536, - spi_clock_mhz: 50, -}; +/// Compile-time FMC descriptor: both CS driven on the EVB at 50 MHz, geometry +/// discovered over SFDP at init. +struct FmcInstance; -const CS1_CONFIG: FlashConfig = FlashConfig { - capacity_mb: 64, - page_size: 256, - sector_size: 4096, - block_size: 65536, - spi_clock_mhz: 50, -}; +impl SmcInstance for FmcInstance { + type Regs = Aperture; + const CONTROLLER: SmcController = SmcController::Fmc; + const CONFIG: SmcConfig = SmcConfig { + cs0: Some(FlashConfig { spi_clock_mhz: 50 }), + cs1: Some(FlashConfig { spi_clock_mhz: 50 }), + dma_enabled: true, + enable_interrupts: false, + topology: SmcTopology::BootSpi { master_idx: 0 }, + }; +} const TEST_OFFSET: u32 = 0x10_0000; const TEST_LEN: usize = 256; @@ -80,26 +81,18 @@ fn run_smc_fmc_cs1_write_test() -> Result<(), SmcError> { let scu = unsafe { ScuRegisters::new_global_unlocked() }; scu.apply_pinctrl_group(PINCTRL_FMC_QUAD); - let config = SmcConfig { - controller_id: SmcController::Fmc, - cs0: Some(CS0_CONFIG), - cs1: Some(CS1_CONFIG), - dma_enabled: true, - enable_interrupts: false, - topology: SmcTopology::BootSpi { master_idx: 0 }, - }; - pw_log::info!("=== AST10x0 SMC FMC CS1 write test ==="); - let fmc = unsafe { FmcUninit::new(config)? }; - let mut fmc = fmc.init()?; - fmc.spi_nor_read_init(ChipSelect::Cs1)?; + let mut fmc = unsafe { + FmcUninit::::new(take_aperture(), take_aperture(), take_aperture())? + } + .init()?; if !fmc.is_ready() { return Err(SmcError::HardwareError); } let jedec = { - let flash = SpiNorFlash::from_fmc_cs(&mut fmc, CS1_CONFIG, ChipSelect::Cs1)?; + let flash = SpiNorFlash::new(fmc.cs1()?)?; flash.jedec_id()? }; pw_log::info!( @@ -111,23 +104,21 @@ fn run_smc_fmc_cs1_write_test() -> Result<(), SmcError> { pw_log::info!("=== backup CS1 sector ==="); let original = unsafe { core::slice::from_raw_parts_mut(0x41000 as *mut u8, TEST_SECTOR_LEN) }; - fmc.dma_read( - ChipSelect::Cs1, - TEST_OFFSET, - 0x41000usize, - TEST_SECTOR_LEN as u32, - )?; - loop { - match fmc.poll_dma_completion() { - core::task::Poll::Pending => {} - core::task::Poll::Ready(result) => { - result?; - break; + { + let mut cs1 = fmc.cs1()?; + cs1.dma_read(TEST_OFFSET, 0x41000usize, TEST_SECTOR_LEN as u32)?; + loop { + match cs1.poll_dma_completion() { + core::task::Poll::Pending => {} + core::task::Poll::Ready(result) => { + result?; + break; + } } } } - let mut flash = SpiNorFlash::from_fmc_cs(&mut fmc, CS1_CONFIG, ChipSelect::Cs1)?; + let mut flash = SpiNorFlash::new(fmc.cs1()?)?; pw_log::info!("=== erase CS1 sector ==="); flash.erase_sector(TEST_OFFSET)?; diff --git a/target/ast10x0/tests/spdm/auth/i2c_server_main.rs b/target/ast10x0/tests/spdm/auth/i2c_server_main.rs index 1bdaabd41..a855485dc 100644 --- a/target/ast10x0/tests/spdm/auth/i2c_server_main.rs +++ b/target/ast10x0/tests/spdm/auth/i2c_server_main.rs @@ -5,6 +5,7 @@ #![no_std] use app_i2c_server::{handle, signals}; +use ast10x0_peripherals::create_pins; use ast10x0_peripherals::i2c::{ClockConfig, I2cConfig, I2cSpeed, I2cXferMode}; use i2c_server_runtime::{run, Bus}; use userspace::entry; @@ -18,25 +19,27 @@ const SLAVE_CFG: I2cConfig = I2cConfig { clock_config: ClockConfig::ast1060_default(), }; -#[unsafe(link_section = ".ram_nc")] -static mut MASTER_DMA_BUF: [u8; 4096] = [0u8; 4096]; -#[unsafe(link_section = ".ram_nc")] -static mut SLAVE_DMA_BUF: [u8; 256] = [0u8; 256]; - #[entry] fn entry() { - // SAFETY: board init ran init_bus(2) in the kernel; buffers are non-cached and owned here. - let master_dma_buf: &'static mut [u8] = - unsafe { &mut *core::ptr::addr_of_mut!(MASTER_DMA_BUF) }; - let slave_dma_buf: &'static mut [u8] = unsafe { &mut *core::ptr::addr_of_mut!(SLAVE_DMA_BUF) }; - let driver = - match unsafe { i2c_backend::open_bus_dma(2, &SLAVE_CFG, master_dma_buf, slave_dma_buf) } { - Ok(d) => d, - Err(_) => { - pw_log::error!("open_bus_dma(2) failed"); - loop {} - } - }; + // The kernel routed Bus 2's pins at the SCU before starting us; userspace has no SCU grant, so + // we bind the already-routed pins rather than re-muxing them. + // SAFETY: sole pin creation site in this binary, at boot; the pins! table is this chip's true pin map. + let pins = unsafe { create_pins() }; + let (scl, sda) = (pins.scu418_0, pins.scu418_1); + + let (Some(master_dma_buf), Some(slave_dma_buf)) = ( + i2c_backend::non_cached_buf!(4096), + i2c_backend::non_cached_buf!(256), + ) else { + pw_log::error!("i2c DMA buffers already taken"); + loop {} + }; + // Bind Bus 2's already-muxed pins and bring the controller up (init + DMA wrap) in one step. + let Ok(driver) = i2c_backend::open_bus_dma(scl, sda, &SLAVE_CFG, master_dma_buf, slave_dma_buf) + else { + pw_log::error!("i2c bus open failed"); + loop {} + }; pw_log::info!("I2C server ready on Bus 2"); diff --git a/target/ast10x0/tests/spdm/auth/i2c_server_main_peer.rs b/target/ast10x0/tests/spdm/auth/i2c_server_main_peer.rs index e26b51fe1..2a2de2948 100644 --- a/target/ast10x0/tests/spdm/auth/i2c_server_main_peer.rs +++ b/target/ast10x0/tests/spdm/auth/i2c_server_main_peer.rs @@ -5,6 +5,7 @@ #![no_std] use app_i2c_server_peer::{handle, signals}; +use ast10x0_peripherals::create_pins; use ast10x0_peripherals::i2c::{ClockConfig, I2cConfig, I2cSpeed, I2cXferMode}; use i2c_server_runtime::{run, Bus}; use userspace::entry; @@ -18,25 +19,27 @@ const SLAVE_CFG: I2cConfig = I2cConfig { clock_config: ClockConfig::ast1060_default(), }; -#[unsafe(link_section = ".ram_nc")] -static mut MASTER_DMA_BUF: [u8; 4096] = [0u8; 4096]; -#[unsafe(link_section = ".ram_nc")] -static mut SLAVE_DMA_BUF: [u8; 256] = [0u8; 256]; - #[entry] fn entry() { - // SAFETY: board init ran init_bus(2) in the kernel; buffers are non-cached and owned here. - let master_dma_buf: &'static mut [u8] = - unsafe { &mut *core::ptr::addr_of_mut!(MASTER_DMA_BUF) }; - let slave_dma_buf: &'static mut [u8] = unsafe { &mut *core::ptr::addr_of_mut!(SLAVE_DMA_BUF) }; - let driver = - match unsafe { i2c_backend::open_bus_dma(2, &SLAVE_CFG, master_dma_buf, slave_dma_buf) } { - Ok(d) => d, - Err(_) => { - pw_log::error!("open_bus_dma(2) failed"); - loop {} - } - }; + // The kernel routed Bus 2's pins at the SCU before starting us; userspace has no SCU grant, so + // we bind the already-routed pins rather than re-muxing them. + // SAFETY: sole pin creation site in this binary, at boot; the pins! table is this chip's true pin map. + let pins = unsafe { create_pins() }; + let (scl, sda) = (pins.scu418_0, pins.scu418_1); + + let (Some(master_dma_buf), Some(slave_dma_buf)) = ( + i2c_backend::non_cached_buf!(4096), + i2c_backend::non_cached_buf!(256), + ) else { + pw_log::error!("i2c DMA buffers already taken"); + loop {} + }; + // Bind Bus 2's already-muxed pins and bring the controller up (init + DMA wrap) in one step. + let Ok(driver) = i2c_backend::open_bus_dma(scl, sda, &SLAVE_CFG, master_dma_buf, slave_dma_buf) + else { + pw_log::error!("i2c bus open failed"); + loop {} + }; pw_log::info!("I2C server peer ready on Bus 2"); diff --git a/target/ast10x0/tests/spdm/auth/target.rs b/target/ast10x0/tests/spdm/auth/target.rs index 42dd70db1..14863de37 100644 --- a/target/ast10x0/tests/spdm/auth/target.rs +++ b/target/ast10x0/tests/spdm/auth/target.rs @@ -4,27 +4,13 @@ #![no_std] #![no_main] -use ast10x0_board::{Ast10x0Board, Ast10x0BoardDescriptor, I2cBusCfg}; -use ast10x0_peripherals::i2c::{ClockConfig, I2cConfig, I2cSpeed, I2cXferMode}; +use ast10x0_board::{Ast10x0Board, Ast10x0BoardDescriptor}; use ast10x0_peripherals::scu::pinctrl; use console_backend::console_backend_write_all; use entry as _; use target_common::{declare_target, TargetInterface}; -const I2C2_CFG: I2cConfig = I2cConfig { - speed: I2cSpeed::Standard, - xfer_mode: I2cXferMode::DmaMode, - multi_master: false, - smbus_timeout: false, - smbus_alert: false, - clock_config: ClockConfig::ast1060_default(), -}; - static PINCTRL_GROUPS: [&[ast10x0_peripherals::scu::PinctrlPin]; 1] = [pinctrl::PINCTRL_I2C2]; -static I2C_BUSES: [I2cBusCfg; 1] = [I2cBusCfg { - bus: 2, - config: I2C2_CFG, -}]; pub struct Target; @@ -36,7 +22,6 @@ impl TargetInterface for Target { if unsafe { Ast10x0Board::new(Ast10x0BoardDescriptor { pinctrl_groups: &PINCTRL_GROUPS, - i2c_buses: &I2C_BUSES, }) .init() } diff --git a/target/ast10x0/tests/spdm/vca/i2c_server_main.rs b/target/ast10x0/tests/spdm/vca/i2c_server_main.rs index 1bdaabd41..a855485dc 100644 --- a/target/ast10x0/tests/spdm/vca/i2c_server_main.rs +++ b/target/ast10x0/tests/spdm/vca/i2c_server_main.rs @@ -5,6 +5,7 @@ #![no_std] use app_i2c_server::{handle, signals}; +use ast10x0_peripherals::create_pins; use ast10x0_peripherals::i2c::{ClockConfig, I2cConfig, I2cSpeed, I2cXferMode}; use i2c_server_runtime::{run, Bus}; use userspace::entry; @@ -18,25 +19,27 @@ const SLAVE_CFG: I2cConfig = I2cConfig { clock_config: ClockConfig::ast1060_default(), }; -#[unsafe(link_section = ".ram_nc")] -static mut MASTER_DMA_BUF: [u8; 4096] = [0u8; 4096]; -#[unsafe(link_section = ".ram_nc")] -static mut SLAVE_DMA_BUF: [u8; 256] = [0u8; 256]; - #[entry] fn entry() { - // SAFETY: board init ran init_bus(2) in the kernel; buffers are non-cached and owned here. - let master_dma_buf: &'static mut [u8] = - unsafe { &mut *core::ptr::addr_of_mut!(MASTER_DMA_BUF) }; - let slave_dma_buf: &'static mut [u8] = unsafe { &mut *core::ptr::addr_of_mut!(SLAVE_DMA_BUF) }; - let driver = - match unsafe { i2c_backend::open_bus_dma(2, &SLAVE_CFG, master_dma_buf, slave_dma_buf) } { - Ok(d) => d, - Err(_) => { - pw_log::error!("open_bus_dma(2) failed"); - loop {} - } - }; + // The kernel routed Bus 2's pins at the SCU before starting us; userspace has no SCU grant, so + // we bind the already-routed pins rather than re-muxing them. + // SAFETY: sole pin creation site in this binary, at boot; the pins! table is this chip's true pin map. + let pins = unsafe { create_pins() }; + let (scl, sda) = (pins.scu418_0, pins.scu418_1); + + let (Some(master_dma_buf), Some(slave_dma_buf)) = ( + i2c_backend::non_cached_buf!(4096), + i2c_backend::non_cached_buf!(256), + ) else { + pw_log::error!("i2c DMA buffers already taken"); + loop {} + }; + // Bind Bus 2's already-muxed pins and bring the controller up (init + DMA wrap) in one step. + let Ok(driver) = i2c_backend::open_bus_dma(scl, sda, &SLAVE_CFG, master_dma_buf, slave_dma_buf) + else { + pw_log::error!("i2c bus open failed"); + loop {} + }; pw_log::info!("I2C server ready on Bus 2"); diff --git a/target/ast10x0/tests/spdm/vca/i2c_server_main_peer.rs b/target/ast10x0/tests/spdm/vca/i2c_server_main_peer.rs index e26b51fe1..2a2de2948 100644 --- a/target/ast10x0/tests/spdm/vca/i2c_server_main_peer.rs +++ b/target/ast10x0/tests/spdm/vca/i2c_server_main_peer.rs @@ -5,6 +5,7 @@ #![no_std] use app_i2c_server_peer::{handle, signals}; +use ast10x0_peripherals::create_pins; use ast10x0_peripherals::i2c::{ClockConfig, I2cConfig, I2cSpeed, I2cXferMode}; use i2c_server_runtime::{run, Bus}; use userspace::entry; @@ -18,25 +19,27 @@ const SLAVE_CFG: I2cConfig = I2cConfig { clock_config: ClockConfig::ast1060_default(), }; -#[unsafe(link_section = ".ram_nc")] -static mut MASTER_DMA_BUF: [u8; 4096] = [0u8; 4096]; -#[unsafe(link_section = ".ram_nc")] -static mut SLAVE_DMA_BUF: [u8; 256] = [0u8; 256]; - #[entry] fn entry() { - // SAFETY: board init ran init_bus(2) in the kernel; buffers are non-cached and owned here. - let master_dma_buf: &'static mut [u8] = - unsafe { &mut *core::ptr::addr_of_mut!(MASTER_DMA_BUF) }; - let slave_dma_buf: &'static mut [u8] = unsafe { &mut *core::ptr::addr_of_mut!(SLAVE_DMA_BUF) }; - let driver = - match unsafe { i2c_backend::open_bus_dma(2, &SLAVE_CFG, master_dma_buf, slave_dma_buf) } { - Ok(d) => d, - Err(_) => { - pw_log::error!("open_bus_dma(2) failed"); - loop {} - } - }; + // The kernel routed Bus 2's pins at the SCU before starting us; userspace has no SCU grant, so + // we bind the already-routed pins rather than re-muxing them. + // SAFETY: sole pin creation site in this binary, at boot; the pins! table is this chip's true pin map. + let pins = unsafe { create_pins() }; + let (scl, sda) = (pins.scu418_0, pins.scu418_1); + + let (Some(master_dma_buf), Some(slave_dma_buf)) = ( + i2c_backend::non_cached_buf!(4096), + i2c_backend::non_cached_buf!(256), + ) else { + pw_log::error!("i2c DMA buffers already taken"); + loop {} + }; + // Bind Bus 2's already-muxed pins and bring the controller up (init + DMA wrap) in one step. + let Ok(driver) = i2c_backend::open_bus_dma(scl, sda, &SLAVE_CFG, master_dma_buf, slave_dma_buf) + else { + pw_log::error!("i2c bus open failed"); + loop {} + }; pw_log::info!("I2C server peer ready on Bus 2"); diff --git a/target/ast10x0/tests/spdm/vca/target.rs b/target/ast10x0/tests/spdm/vca/target.rs index 665fd6556..79f711490 100644 --- a/target/ast10x0/tests/spdm/vca/target.rs +++ b/target/ast10x0/tests/spdm/vca/target.rs @@ -4,27 +4,13 @@ #![no_std] #![no_main] -use ast10x0_board::{Ast10x0Board, Ast10x0BoardDescriptor, I2cBusCfg}; -use ast10x0_peripherals::i2c::{ClockConfig, I2cConfig, I2cSpeed, I2cXferMode}; +use ast10x0_board::{Ast10x0Board, Ast10x0BoardDescriptor}; use ast10x0_peripherals::scu::pinctrl; use console_backend::console_backend_write_all; use entry as _; use target_common::{declare_target, TargetInterface}; -const I2C2_CFG: I2cConfig = I2cConfig { - speed: I2cSpeed::Standard, - xfer_mode: I2cXferMode::DmaMode, - multi_master: false, - smbus_timeout: false, - smbus_alert: false, - clock_config: ClockConfig::ast1060_default(), -}; - static PINCTRL_GROUPS: [&[ast10x0_peripherals::scu::PinctrlPin]; 1] = [pinctrl::PINCTRL_I2C2]; -static I2C_BUSES: [I2cBusCfg; 1] = [I2cBusCfg { - bus: 2, - config: I2C2_CFG, -}]; pub struct Target; @@ -36,7 +22,6 @@ impl TargetInterface for Target { if unsafe { Ast10x0Board::new(Ast10x0BoardDescriptor { pinctrl_groups: &PINCTRL_GROUPS, - i2c_buses: &I2C_BUSES, }) .init() } diff --git a/target/ast10x0/tests/spimonitor/setup_all_spim.rs b/target/ast10x0/tests/spimonitor/setup_all_spim.rs index d1ae10ea6..ce4a47552 100644 --- a/target/ast10x0/tests/spimonitor/setup_all_spim.rs +++ b/target/ast10x0/tests/spimonitor/setup_all_spim.rs @@ -15,12 +15,13 @@ use ast10x0_board::{ apply_spim_external_mux, bmc_spim_csin_levels, bmc_spim_path_debug, delay_us, enable_flash_power, release_spi_flash_resets, set_bmc_resets, spim_external_mux_state, }; +use ast10x0_peripherals::aperture::{take_aperture, Aperture}; use ast10x0_peripherals::scu::{ pinctrl::PINCTRL_SPI1_QUAD, ScuExtMuxSelect, ScuRegisters, SpiMonitorInstance, SpiMonitorSource, }; use ast10x0_peripherals::smc::{ - ChipSelect, FlashConfig, SmcConfig, SmcController, SmcError, SmcTopology, SpiReady, SpiUninit, - TransferMode, + ChipSelect, FlashConfig, FlashGeometry, Pinned, SmcConfig, SmcController, SmcError, + SmcInstance, SmcTopology, SpiReady, SpiUninit, TransferMode, }; use ast10x0_peripherals::spimonitor::registers::SpiMonitorRegisters; use ast10x0_peripherals::spimonitor::{ @@ -73,13 +74,31 @@ const BMC_CSIN_RECOVERY_TIMEOUT_US: u32 = 500_000; const BMC_RECOVERY_RETRY_DELAY_US: u32 = 1_000_000; const BMC_CSIN_MASK: u32 = (1 << 0) | (1 << 14); const ENABLE_RUNTIME_DEBUG_LOGS: bool = false; -const BMC_FLASH_CONFIG: FlashConfig = FlashConfig { - capacity_mb: 128, +const BMC_FLASH_CONFIG: FlashConfig = FlashConfig { spi_clock_mhz: 25 }; +const BMC_FLASH_GEOMETRY: FlashGeometry = FlashGeometry { + capacity_bytes: 0x0400_0000, page_size: 256, sector_size: 4096, block_size: 65536, - spi_clock_mhz: 25, }; + +/// Compile-time SPI1 descriptor for the two BMC flashes: both CS at 25 MHz, +/// geometry pinned so the pre-reset probe never issues an SFDP read. +struct Spi1Instance; + +impl SmcInstance for Spi1Instance { + type Regs = Aperture; + const CONTROLLER: SmcController = SmcController::Spi1; + const CONFIG: SmcConfig = SmcConfig { + cs0: Some(BMC_FLASH_CONFIG), + cs1: Some(BMC_FLASH_CONFIG), + dma_enabled: false, + enable_interrupts: false, + topology: SmcTopology::HostSpi { master_idx: 0 }, + }; + type Cs0Geometry = Pinned; + type Cs1Geometry = Pinned; +} const ALLOW_COMMANDS: [u8; 32] = [ 0x03, 0x13, 0x0b, 0x0c, 0x6b, 0x6c, 0x01, 0x05, 0x35, 0x06, 0x04, 0x20, 0x21, 0x9f, 0x5a, 0xb7, 0xe9, 0x32, 0x34, 0xd8, 0xdc, 0x02, 0x12, 0x3b, 0x3c, 0x70, 0xbb, 0xbc, 0x50, 0xeb, 0xec, 0xc2, @@ -364,7 +383,7 @@ fn monitor_spim_violations( fn reset_one_bmc_flash( scu: &ScuRegisters, - spi: &SpiReady, + spi: &mut SpiReady, monitor: SpiMonitorInstance, chip_select: ChipSelect, ) -> Result<[u8; 3], SmcError> { @@ -373,14 +392,18 @@ fn reset_one_bmc_flash( let proprietary_state = scu.spim_proprietary_pre_config(); let result = (|| { - spi.transceive_user(chip_select, &[0x66], &[], &mut [], TransferMode::Mode111)?; + let cs = match chip_select { + ChipSelect::Cs0 => spi.cs0()?, + ChipSelect::Cs1 => spi.cs1()?, + }; + cs.transceive_user(&[0x66], &[], &mut [], TransferMode::Mode111)?; delay_us(10_000); - spi.transceive_user(chip_select, &[0x99], &[], &mut [], TransferMode::Mode111)?; + cs.transceive_user(&[0x99], &[], &mut [], TransferMode::Mode111)?; delay_us(50_000); - spi.transceive_user(chip_select, &[0xe9], &[], &mut [], TransferMode::Mode111)?; + cs.transceive_user(&[0xe9], &[], &mut [], TransferMode::Mode111)?; let mut jedec = [0u8; 3]; - spi.transceive_user(chip_select, &[0x9f], &[], &mut jedec, TransferMode::Mode111)?; + cs.transceive_user(&[0x9f], &[], &mut jedec, TransferMode::Mode111)?; Ok(jedec) })(); @@ -393,21 +416,16 @@ fn reset_one_bmc_flash( fn reset_bmc_flashes(scu: &ScuRegisters, log_jedec: bool) -> Result<(), SmcError> { scu.apply_pinctrl_group(PINCTRL_SPI1_QUAD); - let config = SmcConfig { - controller_id: SmcController::Spi1, - cs0: Some(BMC_FLASH_CONFIG), - cs1: Some(BMC_FLASH_CONFIG), - dma_enabled: false, - enable_interrupts: false, - topology: SmcTopology::HostSpi { master_idx: 0 }, - }; - let spi = unsafe { SpiUninit::new(SmcController::Spi1, config)? }.init()?; + let mut spi = unsafe { + SpiUninit::::new(take_aperture(), take_aperture(), take_aperture())? + } + .init()?; for (index, monitor, chip_select) in [ (0u32, SpiMonitorInstance::Spim0, ChipSelect::Cs0), (1u32, SpiMonitorInstance::Spim1, ChipSelect::Cs1), ] { - let jedec = reset_one_bmc_flash(scu, &spi, monitor, chip_select)?; + let jedec = reset_one_bmc_flash(scu, &mut spi, monitor, chip_select)?; if log_jedec { pw_log::info!( "spi1@{} reset complete, JEDEC ID: {:02x} {:02x} {:02x}", diff --git a/target/ast10x0/tests/util_ipc/async_transaction/BUILD.bazel b/target/ast10x0/tests/util_ipc/async_transaction/BUILD.bazel new file mode 100644 index 000000000..9574b5acf --- /dev/null +++ b/target/ast10x0/tests/util_ipc/async_transaction/BUILD.bazel @@ -0,0 +1,125 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@pigweed//pw_kernel/tooling:rust_app.bzl", "rust_app") +load("@pigweed//pw_kernel/tooling:system_image.bzl", "system_image", "system_image_test") +load("@pigweed//pw_kernel/tooling:target_codegen.bzl", "target_codegen") +load("@pigweed//pw_kernel/tooling:target_linker_script.bzl", "target_linker_script") +load("@pigweed//pw_kernel/tooling/panic_detector:rust_binary_no_panics_test.bzl", "rust_binary_no_panics_test") +load("@rules_rust//rust:defs.bzl", "rust_binary") +load("//target/ast10x0:defs.bzl", "TARGET_COMPATIBLE_WITH") + +# ── System configuration ─────────────────────────────────────────────────────── + +filegroup( + name = "system_config", + srcs = ["system.json5"], +) + +# ── Kernel image ─────────────────────────────────────────────────────────────── + +target_codegen( + name = "codegen", + arch = "@pigweed//pw_kernel/arch/arm_cortex_m:arch_arm_cortex_m", + system_config = ":system_config", + target_compatible_with = TARGET_COMPATIBLE_WITH, +) + +target_linker_script( + name = "linker_script", + system_config = ":system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + template = "//target/ast10x0:linker_script_template", +) + +rust_binary( + name = "target", + srcs = ["target.rs"], + edition = "2024", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + deps = [ + ":codegen", + ":linker_script", + "//target/ast10x0:entry", + "@pigweed//pw_kernel/arch/arm_cortex_m:arch_arm_cortex_m", + "@pigweed//pw_kernel/kernel", + "@pigweed//pw_kernel/subsys/console:console_backend", + "@pigweed//pw_kernel/target:target_common", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + ], +) + +# ── Handler app ───────────────────────────────────────────────────────────────── +# Exercises util_ipc::IpcHandler; increments the byte it's sent. + +rust_app( + name = "handler", + srcs = ["handler_main.rs"], + codegen_crate_name = "app_handler", + edition = "2024", + system_config = ":system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + deps = [ + "//util/ipc", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_status/rust:pw_status", + ], +) + +# ── Initiator app ─────────────────────────────────────────────────────────────── +# Exercises util_ipc::IpcInitiator and util_ipc::AsyncTransaction; calls +# debug_shutdown(Ok|Err) to report the result. + +rust_app( + name = "initiator", + srcs = ["initiator_main.rs"], + codegen_crate_name = "app_initiator", + edition = "2024", + system_config = ":system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + deps = [ + "//util/ipc", + "//util/service", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_log/rust:pw_log", + "@pigweed//pw_status/rust:pw_status", + ], +) + +# ── System image ─────────────────────────────────────────────────────────────── + +system_image( + name = "async_transaction_image", + apps = [ + ":handler", + ":initiator", + ], + kernel = ":target", + platform = "//target/ast10x0", + system_config = ":system_config", + tags = ["kernel"], + target_compatible_with = TARGET_COMPATIBLE_WITH, + visibility = ["//visibility:public"], +) + +# ── Test target ──────────────────────────────────────────────────────────────── +# Run with: +# bazel test --config=virt_ast10x0 //target/ast10x0/tests/util_ipc/async_transaction:async_transaction_qemu_test + +system_image_test( + name = "async_transaction_qemu_test", + image = ":async_transaction_image", + tags = ["qemu_only"], + target_compatible_with = TARGET_COMPATIBLE_WITH, +) + +rust_binary_no_panics_test( + name = "no_panics_test", + binary = ":async_transaction_image", + tags = ["kernel"], +) diff --git a/target/ast10x0/tests/util_ipc/async_transaction/handler_main.rs b/target/ast10x0/tests/util_ipc/async_transaction/handler_main.rs new file mode 100644 index 000000000..a9d778316 --- /dev/null +++ b/target/ast10x0/tests/util_ipc/async_transaction/handler_main.rs @@ -0,0 +1,62 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Handler side of the util/ipc AsyncTransaction QEMU test. +//! +//! Exercises `util_ipc::IpcHandler`: waits for a request, reads it, and +//! responds with the request byte incremented by one. A request of +//! `GATED_REQUEST` is held until the initiator raises Signals::USER. + +#![no_main] +#![no_std] + +use app_handler::handle; +use pw_status::Error; +use userspace::entry; +use userspace::syscall::{self, Signals}; +use userspace::time::Instant; +use util_ipc::{IpcHandle, IpcHandler}; + +/// Request byte that parks the handler instead of responding: it raises +/// Signals::USER on the initiator to say it is parked, then waits for the +/// initiator to raise USER back before responding. The parked signal is +/// what makes the initiator's "pending" observation deterministic. +const GATED_REQUEST: u8 = 0x40; + +#[entry] +fn entry() { + let ipc = IpcHandle::new(handle::IPC); + + loop { + if syscall::object_wait(handle::IPC, Signals::READABLE, Instant::MAX).is_err() { + continue; + } + + let mut buf = [0u8; 1]; + match ipc.read(0, &mut buf) { + Ok(1) => { + if buf[0] == GATED_REQUEST { + // Tell the initiator we are parked, wait for its + // release, then lower the parked signal again. + if ipc.set_peer_user_signal(true).is_err() + || syscall::object_wait(handle::IPC, Signals::USER, Instant::MAX).is_err() + { + continue; + } + let _ = ipc.set_peer_user_signal(false); + } + buf[0] = buf[0].wrapping_add(1); + let _ = ipc.respond(&buf); + } + // Transaction was cancelled by the initiator while we were + // waking up; go back to waiting for the next one. + Ok(_) | Err(Error::Unavailable) => continue, + Err(_) => continue, + } + } +} + +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + loop {} +} diff --git a/target/ast10x0/tests/util_ipc/async_transaction/initiator_main.rs b/target/ast10x0/tests/util_ipc/async_transaction/initiator_main.rs new file mode 100644 index 000000000..3bf1096e8 --- /dev/null +++ b/target/ast10x0/tests/util_ipc/async_transaction/initiator_main.rs @@ -0,0 +1,458 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Initiator side of the util/ipc AsyncTransaction QEMU test. +//! +//! Runs the cases below against `handler`, `ROUNDS` times over, and calls +//! `debug_shutdown(Ok(()))` on full pass or `debug_shutdown(Err(_))` on the +//! first failure. The kernel target writes `TEST_RESULT:PASS/FAIL` to UART. +//! Repeating catches state left behind by an earlier pass, a signal never +//! lowered above all. +//! +//! | Case | Exercises | Expect | +//! |--------------------|-------------------------------------|-------------------| +//! | blocking transact | `IpcInitiator::transact` | byte incremented | +//! | async cancel | `AsyncTransaction::start`/`cancel` | channel freed | +//! | async roundtrip | `AsyncTransaction::start`/`try_recv`| byte incremented | +//! | drop cancels | `AsyncTransaction::drop` | channel freed | +//! | double start | `start` while pending | buffers returned | +//! | try_recv early | `try_recv` before the response | `Ok(None)` | +//! | send_len too big | `start` past the end of `send` | `OutOfRange` | +//! | transport roundtrip| `AsyncChannelTransport` start/poll | byte incremented | +//! | transport not ready| `poll` before the response | `Ok(None)` | +//! | transport too large| request past the send buffer | `TooLarge` | +//! | transport cancel | `cancel` then reuse | channel freed | + +#![no_main] +#![no_std] + +use app_initiator::handle; +use pw_status::{Error, Result}; +use userspace::entry; +use userspace::syscall::{self, Signals}; +use userspace::time::{Clock, Instant, SystemClock}; +use util_ipc::{AsyncChannelTransport, AsyncTransaction, IpcHandle, IpcInitiator}; +use util_service::{AsyncTransport, TransportError}; + +static mut SEND_BUF: [u8; 1] = [0x10]; +static mut RECV_BUF: [u8; 1] = [0u8; 1]; + +/// Second pair of buffers, for the case that starts a transaction while +/// another one still borrows the first pair. +static mut RECV_BUF2: [u8; 1] = [0u8; 1]; +static mut SEND_BUF2: [u8; 1] = [0x10]; + +/// Request byte the handler holds until Signals::USER is raised, matching +/// `GATED_REQUEST` in handler_main.rs. +static mut SEND_GATED: [u8; 1] = [0x40]; + +/// # Safety +/// Only called from this single-threaded app, and only while no +/// `AsyncTransaction` still holds a prior borrow of `RECV_BUF`. +unsafe fn recv_buf() -> &'static mut [u8] { + // Safety: see function doc. + unsafe { &mut *core::ptr::addr_of_mut!(RECV_BUF) } +} + +/// # Safety +/// Same contract as `recv_buf`, for the request buffer. `start` takes +/// `send` mutably, so this hands out the same exclusive borrow. +unsafe fn send_buf() -> &'static mut [u8] { + // Safety: see function doc. + unsafe { &mut *core::ptr::addr_of_mut!(SEND_BUF) } +} + +/// # Safety +/// Same contract as `send_buf`, for the second buffer. +unsafe fn send_buf2() -> &'static mut [u8] { + // Safety: see function doc. + unsafe { &mut *core::ptr::addr_of_mut!(SEND_BUF2) } +} + +/// # Safety +/// Same contract as `send_buf`, for the gated request. +unsafe fn send_gated() -> &'static mut [u8] { + // Safety: see function doc. + unsafe { &mut *core::ptr::addr_of_mut!(SEND_GATED) } +} + +/// # Safety +/// Same contract as `recv_buf`, for the second buffer. +unsafe fn recv_buf2() -> &'static mut [u8] { + // Safety: see function doc. + unsafe { &mut *core::ptr::addr_of_mut!(RECV_BUF2) } +} + +fn test_blocking_transact() -> Result<()> { + let ipc = IpcHandle::new(handle::IPC); + let send = [0x20u8]; + let mut recv = [0u8; 1]; + + let len = ipc.transact(&send, &mut recv, Instant::MAX)?; + if len != 1 || recv[0] != 0x21 { + pw_log::error!("blocking transact: unexpected response"); + return Err(Error::Internal); + } + Ok(()) +} + +fn test_async_cancel() -> Result<()> { + let mut txn = AsyncTransaction::new(IpcHandle::new(handle::IPC)); + // Safety: no other AsyncTransaction is live right now. + txn.start(unsafe { send_buf() }, 1, unsafe { recv_buf() }) + .map_err(|e| e.error)?; + + txn.cancel()?; + if txn.is_pending() { + pw_log::error!("async cancel: still pending after cancel()"); + return Err(Error::Internal); + } + + // Verify the channel is free again. + // Safety: the previous transaction was cancelled above. + txn.start(unsafe { send_buf() }, 1, unsafe { recv_buf() }) + .map_err(|e| e.error)?; + txn.cancel()?; + Ok(()) +} + +fn test_async_roundtrip() -> Result<()> { + let mut txn = AsyncTransaction::new(IpcHandle::new(handle::IPC)); + // Safety: no other AsyncTransaction is live right now. + txn.start(unsafe { send_buf() }, 1, unsafe { recv_buf() }) + .map_err(|e| e.error)?; + + syscall::object_wait(txn.as_raw(), Signals::READABLE, Instant::MAX)?; + + let Some(completion) = txn.try_recv().map_err(|e| e.error)? else { + pw_log::error!("async roundtrip: not ready after READABLE"); + return Err(Error::Internal); + }; + if completion.len != 1 || completion.recv[0] != 0x11 { + pw_log::error!("async roundtrip: unexpected response"); + return Err(Error::Internal); + } + Ok(()) +} + +/// Dropping a pending transaction has to cancel it, otherwise the channel +/// stays busy and the next start fails with `Unavailable`. +fn test_drop_cancels() -> Result<()> { + { + let mut txn = AsyncTransaction::new(IpcHandle::new(handle::IPC)); + // Safety: no other AsyncTransaction is live right now. + txn.start(unsafe { send_buf() }, 1, unsafe { recv_buf() }) + .map_err(|e| e.error)?; + // Dropped here with the transaction still pending. + } + + let mut txn = AsyncTransaction::new(IpcHandle::new(handle::IPC)); + // Safety: the drop above cancelled the transaction. The kernel clears + // its transaction slot on every path out of the cancel syscall, so it + // no longer points into RECV_BUF. + txn.start(unsafe { send_buf() }, 1, unsafe { recv_buf() }) + .map_err(|e| e.error)?; + txn.cancel()?; + Ok(()) +} + +/// A second start while one is pending fails locally and hands both +/// buffers back in the error. +fn test_double_start() -> Result<()> { + let mut txn = AsyncTransaction::new(IpcHandle::new(handle::IPC)); + // Safety: no other AsyncTransaction is live right now. + txn.start(unsafe { send_buf() }, 1, unsafe { recv_buf() }) + .map_err(|e| e.error)?; + + // The pending transaction still borrows SEND_BUF and RECV_BUF, so the + // second start gets its own pair. + // Safety: nothing else borrows SEND_BUF2 or RECV_BUF2. + let result = txn.start(unsafe { send_buf2() }, 1, unsafe { recv_buf2() }); + + let outcome = match result { + Ok(()) => { + pw_log::error!("double start: second start() succeeded"); + Err(Error::Internal) + } + Err(e) if e.error != Error::FailedPrecondition => { + pw_log::error!("double start: status code {}", e.error as u32); + Err(Error::Internal) + } + Err(e) => { + let send_returned = + core::ptr::eq(e.send.as_ptr(), core::ptr::addr_of!(SEND_BUF2).cast()); + let recv_returned = + core::ptr::eq(e.recv.as_ptr(), core::ptr::addr_of!(RECV_BUF2).cast()); + if send_returned && recv_returned { + Ok(()) + } else { + pw_log::error!("double start: buffers not returned"); + Err(Error::Internal) + } + } + }; + + txn.cancel()?; + outcome +} + +/// `try_recv` before the handler responds reports `Ok(None)` and keeps the +/// transaction pending. The handler parks on this request and raises USER +/// to say so, so the observation is not a race: by the time USER arrives +/// the handler has read the request and is not going to respond until +/// released. +fn test_try_recv_before_response() -> Result<()> { + let ipc = IpcHandle::new(handle::IPC); + + // The handler lowers the parked signal before it responds, so USER is + // clear on entry. If it is still set, it leaked from an earlier round + // and the wait below would return without the handler having parked. + // A deadline of now makes this a poll rather than a wait. + if syscall::object_wait(ipc.as_raw(), Signals::USER, SystemClock::now()).is_ok() { + pw_log::error!("try_recv early: stale parked signal"); + return Err(Error::Internal); + } + + let mut txn = AsyncTransaction::new(ipc); + // Safety: no other AsyncTransaction is live right now. + txn.start(unsafe { send_gated() }, 1, unsafe { recv_buf() }) + .map_err(|e| e.error)?; + + // Wait for the handler to say it is parked. + syscall::object_wait(txn.as_raw(), Signals::USER, Instant::MAX)?; + + match txn.try_recv() { + Ok(None) => {} + Ok(Some(_)) => { + pw_log::error!("try_recv early: completed before the handler responded"); + return Err(Error::Internal); + } + Err(e) => { + pw_log::error!("try_recv early: status code {}", e.error as u32); + return Err(Error::Internal); + } + } + if !txn.is_pending() { + pw_log::error!("try_recv early: transaction no longer pending"); + return Err(Error::Internal); + } + + // Release the handler, then complete as usual. + ipc.set_peer_user_signal(true)?; + syscall::object_wait(txn.as_raw(), Signals::READABLE, Instant::MAX)?; + let Some(completion) = txn.try_recv().map_err(|e| e.error)? else { + pw_log::error!("try_recv early: not ready after READABLE"); + return Err(Error::Internal); + }; + ipc.set_peer_user_signal(false)?; + + if completion.len != 1 || completion.recv[0] != 0x41 { + pw_log::error!("try_recv early: unexpected response"); + return Err(Error::Internal); + } + Ok(()) +} + +/// A `send_len` longer than the buffer is refused before the syscall, and +/// the buffers come back so the caller can retry with a correct length. +fn test_send_len_out_of_range() -> Result<()> { + let mut txn = AsyncTransaction::new(IpcHandle::new(handle::IPC)); + + // Safety: no other AsyncTransaction is live right now. + let result = txn.start(unsafe { send_buf() }, 2, unsafe { recv_buf() }); + + match result { + Ok(()) => { + pw_log::error!("send_len out of range: start() succeeded"); + Err(Error::Internal) + } + Err(e) if e.error != Error::OutOfRange => { + pw_log::error!("send_len out of range: status code {}", e.error as u32); + Err(Error::Internal) + } + Err(_) if txn.is_pending() => { + pw_log::error!("send_len out of range: left a transaction pending"); + Err(Error::Internal) + } + Err(_) => Ok(()), + } +} + +/// Buffers the transport lends the kernel. One byte each, matching the +/// handler's request and response. +static mut TXN_SEND: [u8; 1] = [0u8; 1]; +static mut TXN_RECV: [u8; 1] = [0u8; 1]; + +/// # Safety +/// Only called from this single-threaded app, and only while no +/// `AsyncChannelTransport` still holds a prior borrow. +unsafe fn transport() -> AsyncChannelTransport { + // Safety: see function doc. + unsafe { + AsyncChannelTransport::new( + IpcHandle::new(handle::IPC), + &mut *core::ptr::addr_of_mut!(TXN_SEND), + &mut *core::ptr::addr_of_mut!(TXN_RECV), + ) + } +} + +/// The seam end to end: a request goes out as plain bytes, the response +/// comes back into the caller's own buffer, and the transport is idle +/// afterwards so the next request can reuse it. +fn test_transport_roundtrip() -> Result<()> { + // Safety: no other transport is live right now. + let mut transport = unsafe { transport() }; + let mut resp = [0u8; 1]; + + transport.start(&[0x10]).map_err(|_| Error::Internal)?; + syscall::object_wait(transport.as_raw(), Signals::READABLE, Instant::MAX)?; + + let Some(len) = transport.poll(&mut resp).map_err(|_| Error::Internal)? else { + pw_log::error!("transport roundtrip: not ready after READABLE"); + return Err(Error::Internal); + }; + if len != 1 || resp[0] != 0x11 { + pw_log::error!("transport roundtrip: unexpected response"); + return Err(Error::Internal); + } + + // Idle again: a second round-trip reuses the same buffers. + transport.start(&[0x10]).map_err(|_| Error::Internal)?; + syscall::object_wait(transport.as_raw(), Signals::READABLE, Instant::MAX)?; + transport.poll(&mut resp).map_err(|_| Error::Internal)?; + Ok(()) +} + +/// The case a loopback cannot reach: poll returns Ok(None) while the +/// handler is parked, then Ok(Some) once it answers. +fn test_transport_not_ready_then_ready() -> Result<()> { + let ipc = IpcHandle::new(handle::IPC); + if syscall::object_wait(ipc.as_raw(), Signals::USER, SystemClock::now()).is_ok() { + pw_log::error!("transport not ready: stale parked signal"); + return Err(Error::Internal); + } + + // Safety: no other transport is live right now. + let mut transport = unsafe { transport() }; + let mut resp = [0u8; 1]; + + transport.start(&[0x40]).map_err(|_| Error::Internal)?; + syscall::object_wait(transport.as_raw(), Signals::USER, Instant::MAX)?; + + match transport.poll(&mut resp) { + Ok(None) => {} + Ok(Some(_)) => { + pw_log::error!("transport not ready: completed before the handler responded"); + return Err(Error::Internal); + } + Err(_) => { + pw_log::error!("transport not ready: poll failed"); + return Err(Error::Internal); + } + } + + ipc.set_peer_user_signal(true)?; + syscall::object_wait(transport.as_raw(), Signals::READABLE, Instant::MAX)?; + let ready = transport.poll(&mut resp).map_err(|_| Error::Internal)?; + ipc.set_peer_user_signal(false)?; + + if ready != Some(1) || resp[0] != 0x41 { + pw_log::error!("transport not ready: unexpected response"); + return Err(Error::Internal); + } + Ok(()) +} + +/// A request longer than the send buffer is refused before anything goes +/// out, and the transport stays idle. +fn test_transport_request_too_large() -> Result<()> { + // Safety: no other transport is live right now. + let mut transport = unsafe { transport() }; + + match transport.start(&[0x10, 0x20]) { + Err(TransportError::TooLarge) => {} + Err(_) => { + pw_log::error!("transport too large: wrong error"); + return Err(Error::Internal); + } + Ok(()) => { + pw_log::error!("transport too large: start() succeeded"); + return Err(Error::Internal); + } + } + + // Still idle: a correctly sized request goes through. + transport.start(&[0x10]).map_err(|_| Error::Internal)?; + transport.cancel().map_err(|_| Error::Internal)?; + Ok(()) +} + +/// Cancel returns the buffers to the transport, so the next start works +/// and a poll with nothing in flight is WrongState. +fn test_transport_cancel() -> Result<()> { + // Safety: no other transport is live right now. + let mut transport = unsafe { transport() }; + let mut resp = [0u8; 1]; + + transport.start(&[0x10]).map_err(|_| Error::Internal)?; + transport.cancel().map_err(|_| Error::Internal)?; + + match transport.poll(&mut resp) { + Err(TransportError::WrongState) => {} + _ => { + pw_log::error!("transport cancel: poll after cancel was not WrongState"); + return Err(Error::Internal); + } + } + + transport.start(&[0x10]).map_err(|_| Error::Internal)?; + transport.cancel().map_err(|_| Error::Internal)?; + Ok(()) +} + +/// How often the whole sequence runs. Every case leaves the channel idle +/// and both USER signals lowered, so a repeat that fails means state leaked +/// from the pass before it. +const ROUNDS: u32 = 50; + +fn run_all() -> Result<()> { + for round in 0..ROUNDS { + let ret = test_blocking_transact() + .and_then(|_| test_async_cancel()) + .and_then(|_| test_async_roundtrip()) + .and_then(|_| test_drop_cancels()) + .and_then(|_| test_double_start()) + .and_then(|_| test_try_recv_before_response()) + .and_then(|_| test_send_len_out_of_range()) + .and_then(|_| test_transport_roundtrip()) + .and_then(|_| test_transport_not_ready_then_ready()) + .and_then(|_| test_transport_request_too_large()) + .and_then(|_| test_transport_cancel()); + + if ret.is_err() { + pw_log::error!("failed in round {}", round as u32); + return ret; + } + } + Ok(()) +} + +#[entry] +fn entry() { + let ret = run_all(); + + match &ret { + Ok(()) => pw_log::info!("All test cases PASSED"), + Err(e) => pw_log::error!("FAILED: status code {}", *e as u32), + } + + let _ = syscall::debug_shutdown(ret); + loop {} +} + +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + let _ = userspace::syscall::debug_shutdown(Err(pw_status::Error::Internal)); + loop {} +} diff --git a/target/ast10x0/tests/util_ipc/async_transaction/system.json5 b/target/ast10x0/tests/util_ipc/async_transaction/system.json5 new file mode 100644 index 000000000..30e14d455 --- /dev/null +++ b/target/ast10x0/tests/util_ipc/async_transaction/system.json5 @@ -0,0 +1,78 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +// AST10x0 util/ipc AsyncTransaction QEMU test. +// +// Two-process layout: +// +// initiator — exercises util_ipc::IpcInitiator (blocking transact) and +// util_ipc::AsyncTransaction (async start/try_recv/cancel); +// calls debug_shutdown(Ok|Err) to report the result. +// handler — util_ipc::IpcHandler read/respond loop that increments the +// single byte it's sent. +// +// Memory map (AST10x0: 768 KB SRAM, no XIP): +// 0x00000000 - 0x00000500 vector table (1280 B) +// 0x00000500 - 0x00020500 kernel flash (~128 KB) +// 0x00020500 - 0x00060500 app flash (256 KB total; 128 KB per app) +// 0x00060000 - 0x00080000 kernel RAM (128 KB) +// 0x00080000 - 0x000C0000 app RAM (256 KB total; 64 KB + 32 KB per process) +{ + arch: { + type: "armv7m", + vector_table_start_address: 0x00000000, + vector_table_size_bytes: 1280, + }, + kernel: { + flash_start_address: 0x00000500, + flash_size_bytes: 129792, + ram_start_address: 0x00060000, + ram_size_bytes: 131072, + }, + apps: [ + { + name: "initiator", + flash_size_bytes: 131072, + processes: [ + { + name: "initiator_process", + ram_size_bytes: 65536, + objects: [ + { + name: "ipc", + type: "channel_initiator", + handler_process: "handler_process", + handler_object_name: "ipc", + }, + { + type: "thread", + name: "initiator_thread", + kernel_stack_size_bytes: 4096, + },], + + }, + ], + }, + { + name: "handler", + flash_size_bytes: 131072, + processes: [ + { + name: "handler_process", + ram_size_bytes: 32768, + objects: [ + { + name: "ipc", + type: "channel_handler", + }, + { + type: "thread", + name: "handler_thread", + kernel_stack_size_bytes: 4096, + },], + + }, + ], + }, + ], +} diff --git a/target/ast10x0/tests/util_ipc/async_transaction/target.rs b/target/ast10x0/tests/util_ipc/async_transaction/target.rs new file mode 100644 index 000000000..022a30193 --- /dev/null +++ b/target/ast10x0/tests/util_ipc/async_transaction/target.rs @@ -0,0 +1,40 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Kernel target for the util/ipc AsyncTransaction QEMU test. +//! +//! Pass/fail is communicated by `initiator` calling +//! `syscall::debug_shutdown(Ok(()) | Err(...))`, which lands here and writes +//! the UART sentinel picked up by qemu_runner.py. + +#![no_std] +#![no_main] + +use console_backend::console_backend_write_all; +use entry as _; +use target_common::{declare_target, TargetInterface}; + +pub struct Target {} + +impl TargetInterface for Target { + const NAME: &'static str = "AST10x0 util/ipc AsyncTransaction test"; + + fn main() -> ! { + codegen::start(); + #[expect(clippy::empty_loop)] + loop {} + } + + fn shutdown(code: u32) -> ! { + let sentinel: &[u8] = if code == 0 { + b"TEST_RESULT:PASS\n" + } else { + b"TEST_RESULT:FAIL\n" + }; + let _ = console_backend_write_all(sentinel); + #[expect(clippy::empty_loop)] + loop {} + } +} + +declare_target!(Target); diff --git a/target/veer/BUILD.bazel b/target/veer/BUILD.bazel index 7a5e8f80a..d453b2c03 100644 --- a/target/veer/BUILD.bazel +++ b/target/veer/BUILD.bazel @@ -105,6 +105,12 @@ rust_binary( rust_library( name = "console", srcs = ["console.rs"], + crate_features = select({ + ":emulator": ["emulator"], + ":fpga": ["fpga"], + ":silicon": ["silicon"], + "//conditions:default": [], + }), crate_name = "console_backend", edition = "2024", target_compatible_with = TARGET_COMPATIBLE_WITH, diff --git a/target/veer/config.rs b/target/veer/config.rs index 3a2ab0d8a..b002c8a80 100644 --- a/target/veer/config.rs +++ b/target/veer/config.rs @@ -27,8 +27,11 @@ pub struct KernelConfig; impl KernelConfigInterface for KernelConfig { #[cfg(feature = "silicon")] const SYSTEM_CLOCK_HZ: u64 = 100_000_000; + // Matches TIMER_FREQUENCY_HZ in + // third_party/caliptra/caliptra-mcu-sw/platforms/fpga/runtime/src/main.rs, + // the confirmed clock rate for this core on the VCK190 build. #[cfg(feature = "fpga")] - const SYSTEM_CLOCK_HZ: u64 = 10_000_000; //FIXME + const SYSTEM_CLOCK_HZ: u64 = 20_000_000; #[cfg(feature = "emulator")] const SYSTEM_CLOCK_HZ: u64 = 1_000_000; } diff --git a/target/veer/console.rs b/target/veer/console.rs index 135ecdd9d..a3c508bb4 100644 --- a/target/veer/console.rs +++ b/target/veer/console.rs @@ -5,9 +5,21 @@ use kernel::sync::spinlock::SpinLock; use pw_status::Result; +/// FPGA wrapper debug FIFO push register (`dbg_fifo_push`), absolute address +/// `0xA401_1014`. Writing a byte with bit 8 set pushes it into the FIFO the +/// ARM PS host drains for console output. Matches +/// `caliptra-mcu-sw/platforms/fpga/rom/src/io.rs::FPGA_UART_OUTPUT`, which +/// uses the identical mechanism on the same board. +#[cfg(feature = "fpga")] +const FPGA_DBG_FIFO_PUSH: *mut u32 = core::ptr::without_provenance_mut(0xA401_1014); + +#[cfg(feature = "fpga")] +const FPGA_CHAR_VALID: u32 = 0x100; + struct Uart; impl Uart { + #[cfg(not(feature = "fpga"))] fn write_all(&mut self, buf: &[u8]) -> Result<()> { let tx = core::ptr::with_exposed_provenance_mut::(0x1000_1041); for &byte in buf.iter() { @@ -17,6 +29,16 @@ impl Uart { } Ok(()) } + + #[cfg(feature = "fpga")] + fn write_all(&mut self, buf: &[u8]) -> Result<()> { + for &byte in buf.iter() { + unsafe { + FPGA_DBG_FIFO_PUSH.write_volatile(byte as u32 | FPGA_CHAR_VALID); + } + } + Ok(()) + } } static UART: SpinLock = SpinLock::new(Uart); diff --git a/target/veer/entry.rs b/target/veer/entry.rs index 82bd00f42..cc93fe4c9 100644 --- a/target/veer/entry.rs +++ b/target/veer/entry.rs @@ -25,7 +25,7 @@ fn main() -> ! { } pub fn exit(code: u32) -> ! { - #[cfg(not(feature = "emulator"))] + #[cfg(not(any(feature = "emulator", feature = "fpga")))] let _ = code; #[cfg(feature = "emulator")] @@ -34,6 +34,17 @@ pub fn exit(code: u32) -> ! { let exitcode = core::ptr::with_exposed_provenance_mut::(0x1000_2000); exitcode.write_volatile(code); } + + #[cfg(feature = "fpga")] + unsafe { + // SAFETY: dbg_fifo_push (0xA401_1014) is the FPGA wrapper's + // debug/exit register; writing 0xff/0x01 (valid bit 0x100 set) + // signals pass/fail to the host, matching + // caliptra-mcu-sw/platforms/fpga/rom/src/io.rs::exit_fpga. + let dbg_fifo_push = core::ptr::without_provenance_mut::(0xA401_1014); + let byte: u32 = if code == 0 { 0xff } else { 0x01 }; + dbg_fifo_push.write_volatile(byte | 0x100); + } loop {} } diff --git a/target/veer/tooling/BUILD.bazel b/target/veer/tooling/BUILD.bazel index 29b66e4b8..79b5f6f45 100644 --- a/target/veer/tooling/BUILD.bazel +++ b/target/veer/tooling/BUILD.bazel @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 load("@pigweed//pw_build:pw_py_importable_runfile.bzl", "pw_py_importable_runfile") -load("@rules_python//python:defs.bzl", "py_binary") +load("@rules_python//python:defs.bzl", "py_binary", "py_test") load(":caliptra_runner.bzl", "mcu_rom_wrapper") mcu_rom_wrapper( @@ -65,3 +65,10 @@ py_binary( "@rules_python//python/runfiles", ], ) + +py_test( + name = "caliptra_runner_test", + srcs = ["caliptra_runner_test.py"], + imports = ["."], + deps = [":caliptra_runner"], +) diff --git a/target/veer/tooling/caliptra_runner.py b/target/veer/tooling/caliptra_runner.py index ff16f3e12..6bddf1cdc 100755 --- a/target/veer/tooling/caliptra_runner.py +++ b/target/veer/tooling/caliptra_runner.py @@ -4,6 +4,7 @@ import argparse import logging +import os import subprocess import sys import tempfile @@ -17,6 +18,31 @@ _LOG = logging.getLogger(__name__) _LOG.setLevel(logging.INFO) +# Environment variable naming the SSH host (user@host or host alias) for the +# VCK190 FPGA board used by the "fpga" interface. +FPGA_HOST = "VCK190_FPGA_HOST" + +# Timeout (seconds) for the remote fpga run. The VeeR core's exit() +# implementation writes the PASS/FAIL sentinel and then spins forever (there's +# no way for it to fully halt itself back to the host), so this bounds how +# long we wait on a stuck or unreachable board rather than hanging forever. +_FPGA_RUN_TIMEOUT_SECONDS = 300 + + +def scan_output_for_result(lines): + """Scan detokenized output lines for a PASS/FAIL sentinel. + + Returns 0 on a line containing "PASS", 1 on a line containing "FAIL", + or None if no sentinel has appeared yet. + """ + for line in lines: + if "PASS" in line: + return 0 + if "FAIL" in line: + return 1 + return None + + try: import caliptra.emulator_cptra_rom # type: ignore @@ -116,6 +142,7 @@ def load_and_run( interface: str, manifest: str, vendor_pk_hash: str, + elf: Path | None = None, ) -> list[str]: """Prepare arguments to load an image into a board and spawn a console.""" if interface == "emulator": @@ -151,6 +178,75 @@ def load_and_run( if vendor_pk_hash and str(vendor_pk_hash) != "None": cmd.append(f"--vendor-pk-hash={vendor_pk_hash}") return cmd + elif interface == "fpga": + host = os.environ.get(FPGA_HOST) + if not host: + _LOG.fatal("%s is not set; cannot reach the VCK190 board", FPGA_HOST) + sys.exit(1) + + remote_bin = f"/tmp/{Path(image).name}" + try: + subprocess.run(["scp", str(image), f"{host}:{remote_bin}"], check=True) + except subprocess.CalledProcessError as e: + _LOG.fatal("Failed to copy %s to %s: %s", image, host, e) + sys.exit(1) + + # Loads the image into the MCU ROM backdoor SRAM, deasserts + # cptra_ss_rst_b, and streams the debug FIFO back over stdout. + # See hw/fpga/README.md's "JTAG debug" section and + # hw/fpga/kernel-modules/mcu_rom_backdoor.c for the mechanism. + cmd = [ + "ssh", + host, + "sudo", + "caliptra-mcu-sw/hw/fpga/launch_openocd.sh", + "load-and-run", + remote_bin, + ] + _LOG.info("Invoking fpga runner: %s", cmd) + try: + proc = subprocess.run( + cmd, + capture_output=True, + text=True, + check=False, + timeout=_FPGA_RUN_TIMEOUT_SECONDS, + ) + except subprocess.TimeoutExpired as e: + _LOG.fatal( + "fpga runner timed out after %s seconds; stdout so far: %s; " + "stderr so far: %s", + _FPGA_RUN_TIMEOUT_SECONDS, + e.stdout, + e.stderr, + ) + sys.exit(1) + + if proc.stderr: + _LOG.info("fpga runner stderr: %s", proc.stderr) + + if proc.returncode != 0: + _LOG.fatal( + "ssh/remote command failed with exit code %d: %s", + proc.returncode, + proc.stderr, + ) + sys.exit(1) + + # This target's kernel config pins its log backend to + # log_backend_basic (a plain-text logger; see target/veer/BUILD.bazel's + # platform rule), so the board's console output is never tokenized and + # there is nothing to detokenize here, unlike the emulator's tokenized + # console path (see _detokenizer() above). + print(proc.stdout) + result = scan_output_for_result(proc.stdout.splitlines()) + if result is None: + _LOG.fatal( + "Device produced no PASS/FAIL sentinel; fpga runner stderr: %s", + proc.stderr, + ) + sys.exit(1) + sys.exit(result) else: raise Exception("unknown mechanism", mechanism) @@ -200,6 +296,7 @@ def _main(args) -> int: args.interface, args.manifest, args.vendor_pk_hash, + elf=args.elf, ) # TODO(cfrantz): add support for the tokenized console. return_code = simple_console(cmd) diff --git a/target/veer/tooling/caliptra_runner_test.py b/target/veer/tooling/caliptra_runner_test.py new file mode 100644 index 000000000..212e05765 --- /dev/null +++ b/target/veer/tooling/caliptra_runner_test.py @@ -0,0 +1,25 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 +import unittest + +from caliptra_runner import scan_output_for_result + + +class ScanOutputForResultTest(unittest.TestCase): + def test_no_sentinel_yet(self): + self.assertIsNone(scan_output_for_result(["booting...", "init i3c"])) + + def test_pass_sentinel(self): + self.assertEqual(0, scan_output_for_result(["running tests", "PASS"])) + + def test_fail_sentinel(self): + self.assertEqual(1, scan_output_for_result(["running tests", "FAIL: 1"])) + + def test_first_sentinel_wins(self): + self.assertEqual( + 0, scan_output_for_result(["PASS", "unrelated trailing noise"]) + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/target/veer/unittest_runner/BUILD.bazel b/target/veer/unittest_runner/BUILD.bazel index ada0f88f9..c0e6c2224 100644 --- a/target/veer/unittest_runner/BUILD.bazel +++ b/target/veer/unittest_runner/BUILD.bazel @@ -33,6 +33,17 @@ caliptra_test( target = ":unittest_runner", ) +caliptra_test( + name = "fpga_test", + interface = "fpga", + tags = [ + "fpga", + "manual", + "requires-fpga", + ], + target = ":unittest_runner", +) + filegroup( name = "system_config", srcs = ["system.json5"], diff --git a/third_party/crates_io/Cargo.lock b/third_party/crates_io/Cargo.lock index 0e0e1e6c4..9f9ddc3a7 100644 --- a/third_party/crates_io/Cargo.lock +++ b/third_party/crates_io/Cargo.lock @@ -158,7 +158,7 @@ checksum = "d3ca019570363e800b05ad4fd890734f28ac7b72f563ad8a35079efb793616f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -236,7 +236,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -293,7 +293,7 @@ checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -603,7 +603,7 @@ checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -1064,7 +1064,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -1086,7 +1086,7 @@ checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "pldm-common" version = "0.1.0" -source = "git+https://github.com/OpenPRoT/pldm-lib.git#c709ae4adbc28b168f10e4a4531149abf5116b92" +source = "git+https://github.com/OpenPRoT/pldm-lib.git?rev=3d2fcf47ff14a71505d464a82bc2d7b110712d63#3d2fcf47ff14a71505d464a82bc2d7b110712d63" dependencies = [ "bitfield 0.14.0", "zerocopy", @@ -1095,7 +1095,7 @@ dependencies = [ [[package]] name = "pldm-interface" version = "0.1.0" -source = "git+https://github.com/OpenPRoT/pldm-lib.git#c709ae4adbc28b168f10e4a4531149abf5116b92" +source = "git+https://github.com/OpenPRoT/pldm-lib.git?rev=3d2fcf47ff14a71505d464a82bc2d7b110712d63#3d2fcf47ff14a71505d464a82bc2d7b110712d63" dependencies = [ "bitfield 0.14.0", "pldm-common", @@ -1152,7 +1152,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -1239,7 +1239,7 @@ checksum = "f265be5d634272320a7de94cea15c22a3bfdd4eb42eb43edc528415f066a1f25" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -1250,7 +1250,7 @@ checksum = "e8c4aa1ea1af6dcc83a61be12e8189f9b293c3ba5a487778a4cd89fb060fdbbc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -1277,7 +1277,7 @@ checksum = "30f19a85fe107b65031e0ba8ec60c34c2494069fe910d6c297f5e7cb5a6f76d0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -1357,7 +1357,7 @@ dependencies = [ "spdm-lib", "subtle", "syn 1.0.109", - "syn 2.0.118", + "syn 3.0.5", "thiserror", "tock-registers", "tokio", @@ -1397,9 +1397,9 @@ dependencies = [ [[package]] name = "ruzstd" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a252f5e20f038fe7b4ea53e073e65398d652c864cc162fc77c56c2f13717b888" +checksum = "69e4ce4a039f42bf25920b95667e4d789e98749ab11bbb8d2c2936f788421bb5" dependencies = [ "twox-hash", ] @@ -1465,7 +1465,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -1624,9 +1624,20 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.118" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422" +checksum = "12df2e0110f65b775f769bb17ef989067a1d931b2eb822bd4346631eeada89f9" dependencies = [ "proc-macro2", "quote", @@ -1660,7 +1671,7 @@ checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -1693,7 +1704,7 @@ checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -1820,7 +1831,7 @@ checksum = "1ae7f38b72ec2a254e2b87ef277cf2cd4fb97cbebf944faa6f33354da0867930" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -1840,5 +1851,5 @@ checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] diff --git a/third_party/crates_io/Cargo.toml b/third_party/crates_io/Cargo.toml index 6e48c4c44..94870123f 100644 --- a/third_party/crates_io/Cargo.toml +++ b/third_party/crates_io/Cargo.toml @@ -32,7 +32,7 @@ riscv-semihosting = "0.1.3" serde = { version = "1.0.219", default-features = false, features = ["derive"] } serde_derive = "1.0.228" smlang = { version = "0.8.0", default-features = false } -syn = { version = "2.0.104", features = ["full", "extra-traits"] } +syn = { version = "3.0.3", features = ["full", "extra-traits"] } syn1 = { package = "syn", version = "1.0.109", features = ["full", "extra-traits"] } tock-registers = "0.9.0" vcell = "0.1.2" @@ -55,8 +55,8 @@ heapless = { version = "0.9", default-features = false } mctp = { git = "https://github.com/CodeConstruct/mctp-rs.git", default-features = false } mctp-lib = { git = "https://github.com/OpenPRoT/mctp-lib.git", branch = "9e-buildup" } spdm-lib = { git = "https://github.com/OpenPRoT/spdm-lib.git", branch = "main" } -pldm-common = { git = "https://github.com/OpenPRoT/pldm-lib.git" } -pldm-interface = { git = "https://github.com/OpenPRoT/pldm-lib.git" } +pldm-common = { git = "https://github.com/OpenPRoT/pldm-lib.git", rev = "3d2fcf47ff14a71505d464a82bc2d7b110712d63" } +pldm-interface = { git = "https://github.com/OpenPRoT/pldm-lib.git", rev = "3d2fcf47ff14a71505d464a82bc2d7b110712d63" } # Pin to match Hubris ecosystem rand_core = { version = "0.9", default-features = false } sec1 = { version = "0.7.3" } diff --git a/third_party/pigweed/veer_pic_meivt.patch b/third_party/pigweed/veer_pic_meivt.patch deleted file mode 100644 index c53a973f4..000000000 --- a/third_party/pigweed/veer_pic_meivt.patch +++ /dev/null @@ -1,219 +0,0 @@ -From 73fca35b0436cee7dd156d1e0450adb82fa635c8 Mon Sep 17 00:00:00 2001 -From: Anthony Rocha -Date: Sat, 15 Aug 2026 14:44:54 -0700 -Subject: [PATCH 1/3] pw_kernel: Add type-check-only VeerPicConfig for - qemu_virt_riscv32 - -veer_pic.rs needs a VeerPicConfigInterface impl to compile, and no upstream -target has a VeeR PIC. The addresses are placeholders: qemu virt is a PLIC -machine, so this config never executes. Also fix the one clippy failure that -building veer_pic.rs uncovers. - -Change-Id: Ice1af6a829df590a0a2a0d107cbb39c00a33d486 ---- - pw_kernel/arch/riscv/veer_pic.rs | 2 +- - pw_kernel/target/qemu_virt_riscv32/config.rs | 11 ++++++++++- - 2 files changed, 11 insertions(+), 2 deletions(-) - -diff --git a/pw_kernel/arch/riscv/veer_pic.rs b/pw_kernel/arch/riscv/veer_pic.rs -index e5b6f6333..cce342e98 100644 ---- a/pw_kernel/arch/riscv/veer_pic.rs -+++ b/pw_kernel/arch/riscv/veer_pic.rs -@@ -215,7 +215,7 @@ pub fn interrupt(from_userspace: bool) { - // need to write to MEICPCT to capture the interrupt value into meihap. - MeiCPCT::write(MeiCPCTVal::default()); - let meihap = MeiHAP::read(); -- let irq = meihap.claimid() as u32; -+ let irq = u32::from(meihap.claimid()); - - if irq == 0 { - return; -diff --git a/pw_kernel/target/qemu_virt_riscv32/config.rs b/pw_kernel/target/qemu_virt_riscv32/config.rs -index 26f5f458e..af5685ab8 100644 ---- a/pw_kernel/target/qemu_virt_riscv32/config.rs -+++ b/pw_kernel/target/qemu_virt_riscv32/config.rs -@@ -17,7 +17,7 @@ use core::ops::Range; - - pub use kernel_config::{ - ClintTimerConfigInterface, ExceptionMode, KernelConfigInterface, PlicConfigInterface, -- RiscVKernelConfigInterface, -+ RiscVKernelConfigInterface, VeerPicConfigInterface, - }; - use memory_config::{MemoryRegion, MemoryRegionType}; - -@@ -54,6 +54,15 @@ impl PlicConfigInterface for PlicConfig { - const PLIC_BASE_ADDRESS: usize = 0x0c00_0000; - } - -+// qemu virt has no VeeR PIC. This exists so `veer_pic.rs` type-checks under -+// --//pw_kernel/arch/riscv:veer_pic=true; that build is not runnable here, as the -+// PIC MMIO window is unmapped and VeeR's PIC CSRs trap as illegal instructions. -+pub struct VeerPicConfig; -+ -+impl VeerPicConfigInterface for VeerPicConfig { -+ const PIC_BASE_ADDRESS: usize = 0x0f00_0000; -+} -+ - pub struct TimerConfig; - - const TIMER_BASE: usize = 0x200_0000; --- -2.34.1 - - -From 89b731a7ed30daa46dd0c0e7f9d311caca1569ca Mon Sep 17 00:00:00 2001 -From: Anthony Rocha -Date: Sat, 15 Aug 2026 14:55:39 -0700 -Subject: [PATCH 2/3] pw_kernel: Program the VeeR MEIVT redirect table - -VeeR loads the word at MEIVT + 4 * claimid and jumps to it; mtvec is not -consulted. Point every entry at the trap vector so external interrupts take -the standard trap path. The base is a required const so a target cannot -enable mext without a table. - -Change-Id: I620a7b97d41df2c3d50632fc4870c4a98797c0f8 ---- - pw_kernel/arch/riscv/veer_pic.rs | 32 +++++++++++++++++++- - pw_kernel/config/lib.rs | 12 ++++++++ - pw_kernel/target/qemu_virt_riscv32/config.rs | 2 ++ - 3 files changed, 45 insertions(+), 1 deletion(-) - -diff --git a/pw_kernel/arch/riscv/veer_pic.rs b/pw_kernel/arch/riscv/veer_pic.rs -index cce342e98..81514b3fc 100644 ---- a/pw_kernel/arch/riscv/veer_pic.rs -+++ b/pw_kernel/arch/riscv/veer_pic.rs -@@ -21,7 +21,8 @@ use log_if::debug_if; - use pw_log::info; - use regs::{rw_block_reg, rw_bool_field, rw_int_field}; - --use crate::regs::veer::{MeiCPCT, MeiCPCTVal, MeiHAP, MeiPT, MeiPTVal}; -+use crate::regs::MtVec; -+use crate::regs::veer::{MeiCPCT, MeiCPCTVal, MeiHAP, MeiPT, MeiPTVal, MeiVT, MeiVTVal}; - - const LOG_INTERRUPTS: bool = false; - -@@ -280,6 +281,35 @@ impl InterruptController for VeerPic { - ); - set_global_priority(GLOBAL_PRIORITY); - -+ // VeeR delivers an external interrupt by loading the word at -+ // `MEIVT + 4 * claimid` and jumping to it; mtvec is not consulted. -+ // Point every entry at the trap vector so redirected interrupts take -+ // the standard trap path, where `interrupt()` recovers the claim id -+ // from MEIHAP. Kept unconditional and directly above `set_mext()`: -+ // arming external interrupts against an unprogrammed table jumps to -+ // whatever the table memory happened to contain. -+ let base = VeerPicConfig::MEIVT_BASE_ADDRESS; -+ // MEIVT supplies MEIHAP[31:10], so the table must be 1KiB-aligned, and -+ // claimid is 8 bits, so the core can only reach 256 entries. It must -+ // also lie within DCCM or the core takes an NMI instead of the -+ // interrupt. -+ pw_assert::assert!(base & 0x3ff == 0); -+ pw_assert::assert!(VeerPicConfig::MAX_IRQS <= 256); -+ // Requires mtvec to already be programmed. It is: the reset vector sets -+ // it before `main`, ahead of the kernel's own `exceptions::early_init`. -+ let Ok(trap_vector) = u32::try_from(MtVec::read().base()) else { -+ pw_assert::panic!("mtvec base does not fit in a redirect table entry"); -+ }; -+ pw_assert::assert!(trap_vector != 0); -+ for irq in 0..VeerPicConfig::MAX_IRQS as usize { -+ // SAFETY: the target guarantees the region at `base` is reserved -+ // for the redirect table. -+ unsafe { -+ ptr::write_volatile((base + irq * size_of::()) as *mut u32, trap_vector); -+ } -+ } -+ MeiVT::write(MeiVTVal(base)); -+ - unsafe { - riscv::register::mie::set_mext(); - } -diff --git a/pw_kernel/config/lib.rs b/pw_kernel/config/lib.rs -index 60446ff12..38d0a0291 100644 ---- a/pw_kernel/config/lib.rs -+++ b/pw_kernel/config/lib.rs -@@ -100,6 +100,18 @@ pub trait VeerPicConfigInterface { - /// The maximum number of interrupts the - /// PIC supports per context. - const MAX_IRQS: u32 = 256; -+ -+ /// Base address of the external-interrupt redirect table, written to MEIVT. -+ /// -+ /// Required: the core loads the word at `MEIVT + 4 * claimid` and jumps to -+ /// it on every external interrupt, so a target that enables machine -+ /// external interrupts must supply a table. Building without the -+ /// `veer_pic` flag is how a target opts out of that interrupt source. -+ /// -+ /// Must be 1KiB-aligned; MEIVT supplies bits [31:10] of MEIHAP. Some -+ /// integrations constrain the address further (the Caliptra MCU requires -+ /// it to fall within DCCM). -+ const MEIVT_BASE_ADDRESS: usize; - } - - /// CLINT timer config. -diff --git a/pw_kernel/target/qemu_virt_riscv32/config.rs b/pw_kernel/target/qemu_virt_riscv32/config.rs -index af5685ab8..22fa57641 100644 ---- a/pw_kernel/target/qemu_virt_riscv32/config.rs -+++ b/pw_kernel/target/qemu_virt_riscv32/config.rs -@@ -61,6 +61,8 @@ pub struct VeerPicConfig; - - impl VeerPicConfigInterface for VeerPicConfig { - const PIC_BASE_ADDRESS: usize = 0x0f00_0000; -+ // Placeholder, like PIC_BASE_ADDRESS above: nothing here executes. -+ const MEIVT_BASE_ADDRESS: usize = 0x0f01_0000; - } - - pub struct TimerConfig; --- -2.34.1 - - -From 0b3580d7540172709725133e172c2a74fe7cbd41 Mon Sep 17 00:00:00 2001 -From: Anthony Rocha -Date: Sat, 15 Aug 2026 15:06:44 -0700 -Subject: [PATCH 3/3] pw_kernel: Test MEIHAP field decoding - -Change-Id: I552be247954aacf0a351b54b5458152a519ca1ad ---- - pw_kernel/arch/riscv/regs/veer.rs | 28 ++++++++++++++++++++++++++++ - 1 file changed, 28 insertions(+) - -diff --git a/pw_kernel/arch/riscv/regs/veer.rs b/pw_kernel/arch/riscv/regs/veer.rs -index 42f02ede3..d05cf8e46 100644 ---- a/pw_kernel/arch/riscv/regs/veer.rs -+++ b/pw_kernel/arch/riscv/regs/veer.rs -@@ -181,3 +181,31 @@ rw_csr_reg!( - 0xfc8, - "Machine External Interrupt Handler Address Pointer" - ); -+ -+#[cfg(test)] -+mod tests { -+ use unittest::test; -+ -+ use super::MeiHAPVal; -+ -+ /// Hardware composes MEIHAP as `{MEIVT[31:10], CLAIMID[7:0], 2'b0}`. The PIC -+ /// driver dispatches on `claimid`, so an off-by-one in the field range routes -+ /// every interrupt to the wrong handler without any other symptom. -+ #[test] -+ fn meihap_splits_base_and_claimid() -> unittest::Result<()> { -+ const TABLE_BASE: usize = 0xf004_0000; -+ let meihap = MeiHAPVal(TABLE_BASE | (37 << 2)); -+ -+ unittest::assert_eq!(meihap.claimid(), 37); -+ unittest::assert_eq!(meihap.base(), TABLE_BASE >> 10); -+ -+ // Bits [1:0] are always zero in hardware and are not part of claimid. -+ unittest::assert_eq!(MeiHAPVal(0b11).claimid(), 0); -+ -+ // claimid is 8 bits wide and must not bleed into the table base. -+ let max_claim = MeiHAPVal(0).with_claimid(0xff); -+ unittest::assert_eq!(max_claim.claimid(), 0xff); -+ unittest::assert_eq!(max_claim.base(), 0); -+ Ok(()) -+ } -+} --- -2.34.1 - diff --git a/tools/flash_image/BUILD.bazel b/tools/flash_image/BUILD.bazel new file mode 100644 index 000000000..d1c933ad7 --- /dev/null +++ b/tools/flash_image/BUILD.bazel @@ -0,0 +1,40 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_test") +load(":defs.bzl", "flash_image") + +# Host build tool: makes the flash image a QEMU test hands the device. +rust_binary( + name = "flash_image", + srcs = [ + "main.rs", + "tests.rs", + ], + edition = "2024", + visibility = ["//visibility:public"], + deps = ["//services/orchestrator/config:orchestrator_config"], +) + +rust_test( + name = "flash_image_test", + crate = ":flash_image", +) + +# Proves the rule wiring end to end: the builder runs under Bazel, both +# payloads land at their bases, and the result is usable as cs0_contents or +# cs1_contents on a flash_system_image_test. +flash_image( + name = "example_image", + flash_size = 64, + slots = { + "0:0x0:0x20": "testdata/slot_a.bin", + "1:0x20:0x20": "testdata/slot_b.bin", + }, +) + +sh_test( + name = "example_image_test", + srcs = ["example_image_test.sh"], + data = [":example_image"], +) diff --git a/tools/flash_image/defs.bzl b/tools/flash_image/defs.bzl new file mode 100644 index 000000000..be552711a --- /dev/null +++ b/tools/flash_image/defs.bzl @@ -0,0 +1,67 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 +"""Builds a flash image from a slot layout, for QEMU tests to hand the device.""" + +def _flash_image_impl(ctx): + image = ctx.actions.declare_file(ctx.label.name + ".img") + + args = ctx.actions.args() + args.add("--flash-size", ctx.attr.flash_size) + args.add("--output", image) + + payloads = [] + for spec, target in ctx.attr.slots.items(): + files = target.files.to_list() + if len(files) != 1: + fail("slot {}: {} is not a single file".format(spec, target.label)) + payloads.append(files[0]) + args.add("--slot", "{}={}".format(spec, files[0].path)) + + if ctx.attr.golden: + files = ctx.attr.golden.files.to_list() + if len(files) != 1: + fail("golden: {} is not a single file".format(ctx.attr.golden.label)) + payloads.append(files[0]) + args.add("--golden", "{}={}".format(ctx.attr.golden_region, files[0].path)) + + ctx.actions.run( + mnemonic = "FlashImage", + executable = ctx.executable._builder, + arguments = [args], + inputs = payloads, + outputs = [image], + ) + + return [DefaultInfo(files = depset([image]))] + +flash_image = rule( + implementation = _flash_image_impl, + doc = "A flash image with each payload written at its slot's base, the " + + "rest left erased. The layout goes through the same constructors " + + "the board tables use, so a layout the orchestrator would refuse " + + "fails the build here.", + attrs = { + "flash_size": attr.int( + doc = "Size in bytes of the image, matching the test's flash_size.", + mandatory = True, + ), + "golden": attr.label( + doc = "Payload for the golden image, if the layout has one.", + allow_single_file = True, + ), + "golden_region": attr.string( + doc = "Where the golden image lives, as base:len.", + default = "", + ), + "slots": attr.string_keyed_label_dict( + doc = "Maps id:base:len to the file that fills that slot. Base " + + "and len take decimal or 0x hex.", + allow_files = True, + ), + "_builder": attr.label( + default = "//tools/flash_image:flash_image", + executable = True, + cfg = "exec", + ), + }, +) diff --git a/tools/flash_image/example_image_test.sh b/tools/flash_image/example_image_test.sh new file mode 100755 index 000000000..32884e2d6 --- /dev/null +++ b/tools/flash_image/example_image_test.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 +# +# Checks the image the flash_image rule built: both payloads at their slot +# bases, erased everywhere else, and exactly flash_size bytes. This covers +# the Bazel wiring; the layout rules themselves are covered by +# //tools/flash_image:flash_image_test. + +set -euo pipefail + +image="${TEST_SRCDIR}/_main/tools/flash_image/example_image.img" + +# wc rather than stat: runfiles entries are symlinks, and GNU stat reports +# the link itself unless told otherwise. +actual_size=$(wc -c < "${image}") +if [ "${actual_size}" -ne 64 ]; then + echo "expected a 64-byte image, got ${actual_size}" >&2 + exit 1 +fi + +# od keeps this readable: slot A at 0x00, slot B at 0x20, 0xFF between. +expected=$( + cat <<'EOF' +0000000 S L O T - A - C O N T E N T 377 377 +0000020 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 +0000040 S L O T - B 377 377 377 377 377 377 377 377 377 377 +0000060 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 +0000100 +EOF +) + +if ! diff <(od -c "${image}") <(echo "${expected}"); then + echo "image contents do not match the declared layout" >&2 + exit 1 +fi diff --git a/tools/flash_image/main.rs b/tools/flash_image/main.rs new file mode 100644 index 000000000..6d0f17ff6 --- /dev/null +++ b/tools/flash_image/main.rs @@ -0,0 +1,199 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Writes a flash image for a QEMU test from a board's slot layout. +//! +//! The layout comes in as arguments but is built with the same +//! `Region`/`Slot`/`ImageLayout` constructors the board tables use, so a +//! layout this tool accepts is one the orchestrator would accept: slot ids +//! unique, no two regions overlapping, no zero-length region, nothing past +//! the end of the offset space. Re-deriving those rules here would let a +//! test image drift from what the firmware believes. +//! +//! Everything the layout does not name stays 0xFF, so the image looks like +//! erased flash with images written into it. +//! +//! ```text +//! flash-image --flash-size 0x4000000 \ +//! --slot 0:0x0:0x100000=slot_a.bin \ +//! --slot 1:0x100000:0x100000=slot_b.bin \ +//! --golden 0x200000:0x100000=golden.bin \ +//! --output cs1.img +//! ``` + +use std::collections::BTreeMap; +use std::fs; +use std::path::PathBuf; +use std::process::ExitCode; + +use orchestrator_config::{Golden, ImageLayout, Region, Slot, SlotId}; + +/// Erased flash. Everything no image covers keeps this value. +const ERASED: u8 = 0xFF; + +/// One `--slot` or `--golden` argument: where the image goes and what +/// fills it. +struct Placement { + region: Region, + payload: PathBuf, +} + +/// `base:len=path`, with base and len in decimal or 0x hex. +fn parse_region(spec: &str) -> Result { + let (region, path) = spec + .split_once('=') + .ok_or_else(|| format!("{spec}: expected base:len=path"))?; + let (base, len) = region + .split_once(':') + .ok_or_else(|| format!("{spec}: expected base:len=path"))?; + Ok(Placement { + region: Region::new(parse_u32(base)?, parse_u32(len)?), + payload: PathBuf::from(path), + }) +} + +/// `id:base:len=path`, the slot id in front of a region spec. +fn parse_slot(spec: &str) -> Result<(SlotId, Placement), String> { + let (id, rest) = spec + .split_once(':') + .ok_or_else(|| format!("{spec}: expected id:base:len=path"))?; + let id: u8 = id + .parse() + .map_err(|_| format!("{id}: slot id must be 0 to 255"))?; + Ok((SlotId(id), parse_region(rest)?)) +} + +fn parse_u32(text: &str) -> Result { + let parsed = match text.strip_prefix("0x") { + Some(hex) => u32::from_str_radix(hex, 16), + None => text.parse(), + }; + parsed.map_err(|_| format!("{text}: not a 32-bit number")) +} + +struct Args { + flash_size: u32, + slots: Vec<(SlotId, Placement)>, + golden: Option, + output: PathBuf, +} + +fn parse_args(argv: impl Iterator) -> Result { + let mut flash_size = None; + let mut slots = Vec::new(); + let mut golden = None; + let mut output = None; + + let mut argv = argv.peekable(); + while let Some(flag) = argv.next() { + let mut value = || { + argv.next() + .ok_or_else(|| format!("{flag}: missing its value")) + }; + match flag.as_str() { + "--flash-size" => flash_size = Some(parse_u32(&value()?)?), + "--slot" => slots.push(parse_slot(&value()?)?), + "--golden" => golden = Some(parse_region(&value()?)?), + "--output" => output = Some(PathBuf::from(value()?)), + other => return Err(format!("{other}: unknown argument")), + } + } + + Ok(Args { + flash_size: flash_size.ok_or("--flash-size is required")?, + slots, + golden, + output: output.ok_or("--output is required")?, + }) +} + +/// Builds the image. The layout is constructed first so a bad one is +/// rejected before any file is read. +fn build(args: &Args) -> Result, String> { + // ImageLayout borrows the slots for 'static, matching board tables + // that declare them as consts. A build tool runs once and exits, so + // leaking the one list it makes costs nothing. + let declared: Vec = args + .slots + .iter() + .map(|(id, placement)| Slot::new(*id, placement.region)) + .collect(); + let layout = ImageLayout::new( + Box::leak(declared.into_boxed_slice()), + args.golden.as_ref().map(|g| Golden::new(g.region)), + ); + + // Slot ids are unique by now, so a payload per id is unambiguous. + let payloads: BTreeMap = args + .slots + .iter() + .map(|(id, placement)| (id.0, &placement.payload)) + .collect(); + + let mut image = vec![ERASED; args.flash_size as usize]; + let mut place = |region: Region, payload: &PathBuf, what: &str| { + let bytes = fs::read(payload).map_err(|e| format!("{}: {e}", payload.display()))?; + if bytes.len() > region.len() as usize { + return Err(format!( + "{}: {} bytes does not fit the {}-byte {what}", + payload.display(), + bytes.len(), + region.len() + )); + } + let base = region.base() as usize; + let end = base + bytes.len(); + if region.end() as usize > image.len() { + return Err(format!( + "{what} ends at {:#x}, past the {:#x}-byte flash", + region.end(), + image.len() + )); + } + image[base..end].copy_from_slice(&bytes); + Ok(()) + }; + + for slot in layout.slots() { + let payload = payloads[&slot.id().0]; + place(slot.region(), payload, "slot")?; + } + if let (Some(golden), Some(placement)) = (layout.golden(), args.golden.as_ref()) { + place(golden.region(), &placement.payload, "golden image")?; + } + + Ok(image) +} + +fn main() -> ExitCode { + // skip(1) drops argv[0], which is the part semgrep's rule is about: + // the caller chooses it and it need not name anything real. Nothing + // here reads it. + // nosemgrep: rust.lang.security.args.args + let args = match parse_args(std::env::args().skip(1)) { + Ok(args) => args, + Err(e) => { + eprintln!("flash-image: {e}"); + return ExitCode::FAILURE; + } + }; + + let image = match build(&args) { + Ok(image) => image, + Err(e) => { + eprintln!("flash-image: {e}"); + return ExitCode::FAILURE; + } + }; + + match fs::write(&args.output, &image) { + Ok(()) => ExitCode::SUCCESS, + Err(e) => { + eprintln!("flash-image: {}: {e}", args.output.display()); + ExitCode::FAILURE + } + } +} + +#[cfg(test)] +mod tests; diff --git a/tools/flash_image/testdata/slot_a.bin b/tools/flash_image/testdata/slot_a.bin new file mode 100644 index 000000000..1840751b6 --- /dev/null +++ b/tools/flash_image/testdata/slot_a.bin @@ -0,0 +1 @@ +SLOT-A-CONTENT \ No newline at end of file diff --git a/tools/flash_image/testdata/slot_b.bin b/tools/flash_image/testdata/slot_b.bin new file mode 100644 index 000000000..1e02e3704 --- /dev/null +++ b/tools/flash_image/testdata/slot_b.bin @@ -0,0 +1 @@ +SLOT-B \ No newline at end of file diff --git a/tools/flash_image/tests.rs b/tools/flash_image/tests.rs new file mode 100644 index 000000000..29304a286 --- /dev/null +++ b/tools/flash_image/tests.rs @@ -0,0 +1,255 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +use super::*; + +/// Writes `data` to a uniquely named file under the test's temp dir and +/// returns its path. `name` only has to be unique within one test. +fn payload(name: &str, data: &[u8]) -> PathBuf { + let dir = std::env::var("TEST_TMPDIR").unwrap_or_else(|_| "/tmp".into()); + let path = PathBuf::from(dir).join(format!("flash-image-{name}.bin")); + fs::write(&path, data).unwrap(); + path +} + +fn args(flash_size: u32, slots: Vec<(SlotId, Placement)>) -> Args { + Args { + flash_size, + slots, + golden: None, + output: PathBuf::from("unused"), + } +} + +#[test] +fn parse_region_takes_decimal_and_hex() { + let p = parse_region("0x10:32=some/path").unwrap(); + assert_eq!(p.region.base(), 0x10); + assert_eq!(p.region.len(), 32); + assert_eq!(p.payload, PathBuf::from("some/path")); +} + +#[test] +fn parse_slot_reads_the_id_first() { + let (id, p) = parse_slot("3:0:16=x").unwrap(); + assert_eq!(id.0, 3); + assert_eq!(p.region.len(), 16); +} + +#[test] +fn a_spec_without_a_payload_is_refused() { + assert!(parse_region("0:16").is_err()); +} + +#[test] +fn a_spec_without_a_length_is_refused() { + assert!(parse_region("0=x").is_err()); +} + +#[test] +fn an_unknown_argument_is_refused() { + let argv = ["--rubbish".to_string(), "1".to_string()]; + assert!(parse_args(argv.into_iter()).is_err()); +} + +#[test] +fn a_flag_without_its_value_is_refused() { + let argv = ["--flash-size".to_string()]; + assert!(parse_args(argv.into_iter()).is_err()); +} + +#[test] +fn payloads_land_at_their_slot_base_and_the_rest_stays_erased() { + let a = payload("land-a", b"AAAA"); + let b = payload("land-b", b"BB"); + let image = build(&args( + 32, + vec![ + ( + SlotId(0), + Placement { + region: Region::new(0, 16), + payload: a, + }, + ), + ( + SlotId(1), + Placement { + region: Region::new(16, 16), + payload: b, + }, + ), + ], + )) + .unwrap(); + + assert_eq!(&image[0..4], b"AAAA"); + assert_eq!(&image[4..16], &[ERASED; 12]); + assert_eq!(&image[16..18], b"BB"); + assert_eq!(&image[18..32], &[ERASED; 14]); +} + +#[test] +fn declaration_order_does_not_have_to_match_address_order() { + let high = payload("order-high", b"H"); + let low = payload("order-low", b"L"); + let image = build(&args( + 32, + vec![ + ( + SlotId(7), + Placement { + region: Region::new(16, 16), + payload: high, + }, + ), + ( + SlotId(2), + Placement { + region: Region::new(0, 16), + payload: low, + }, + ), + ], + )) + .unwrap(); + + assert_eq!(image[0], b'L'); + assert_eq!(image[16], b'H'); +} + +#[test] +fn a_payload_larger_than_its_slot_is_refused() { + let big = payload("too-big", b"AAAAAAAA"); + let err = build(&args( + 32, + vec![( + SlotId(0), + Placement { + region: Region::new(0, 4), + payload: big, + }, + )], + )) + .unwrap_err(); + assert!(err.contains("does not fit"), "{err}"); +} + +#[test] +fn a_slot_past_the_end_of_the_flash_is_refused() { + let p = payload("past-end", b"A"); + let err = build(&args( + 16, + vec![( + SlotId(0), + Placement { + region: Region::new(8, 16), + payload: p, + }, + )], + )) + .unwrap_err(); + assert!(err.contains("past the"), "{err}"); +} + +#[test] +fn a_missing_payload_is_refused() { + let err = build(&args( + 16, + vec![( + SlotId(0), + Placement { + region: Region::new(0, 8), + payload: PathBuf::from("no/such/file"), + }, + )], + )) + .unwrap_err(); + assert!(err.contains("no/such/file"), "{err}"); +} + +#[test] +fn the_golden_image_is_written_too() { + let slot = payload("golden-slot", b"S"); + let golden = payload("golden-image", b"G"); + let image = build(&Args { + flash_size: 32, + slots: vec![( + SlotId(0), + Placement { + region: Region::new(0, 16), + payload: slot, + }, + )], + golden: Some(Placement { + region: Region::new(16, 16), + payload: golden, + }), + output: PathBuf::from("unused"), + }) + .unwrap(); + + assert_eq!(image[0], b'S'); + assert_eq!(image[16], b'G'); +} + +/// `ImageLayout::new` is what rejects these, not any check in this tool. +/// The point of the panic is that a test image cannot describe a layout +/// the orchestrator would refuse to boot. +#[test] +#[should_panic(expected = "slots must not overlap")] +fn overlapping_slots_are_rejected_by_the_layout() { + let a = payload("overlap-a", b"A"); + let b = payload("overlap-b", b"B"); + let _ = build(&args( + 64, + vec![ + ( + SlotId(0), + Placement { + region: Region::new(0, 32), + payload: a, + }, + ), + ( + SlotId(1), + Placement { + region: Region::new(16, 32), + payload: b, + }, + ), + ], + )); +} + +#[test] +#[should_panic(expected = "slot ids must be unique")] +fn duplicate_slot_ids_are_rejected_by_the_layout() { + let a = payload("dup-a", b"A"); + let b = payload("dup-b", b"B"); + let _ = build(&args( + 64, + vec![ + ( + SlotId(0), + Placement { + region: Region::new(0, 16), + payload: a, + }, + ), + ( + SlotId(0), + Placement { + region: Region::new(16, 16), + payload: b, + }, + ), + ], + )); +} + +#[test] +#[should_panic(expected = "region length must not be zero")] +fn a_zero_length_region_is_rejected_by_the_layout() { + let _ = parse_region("0:0=x"); +} diff --git a/util/error/flash.rs b/util/error/flash.rs index 976bfb4ab..b5c8360e3 100644 --- a/util/error/flash.rs +++ b/util/error/flash.rs @@ -61,3 +61,36 @@ pub const FLASH_GENERIC_SFDP_PARAMETERS_TOO_LONG: ErrorCode = /// The OpenTitan flash error module. pub const FLASH_OPENTITAN: ErrorModule = ErrorModule::new(0x464f); //ascii `FO`. + +/// The AST10x0 SMC/FMC flash error module. +pub const FLASH_AST10X0: ErrorModule = ErrorModule::new(0x4641); //ascii `FA`. + +/// Hardware-level failure reported by the SMC controller. +pub const FLASH_AST10X0_HARDWARE_ERROR: ErrorCode = FLASH_AST10X0.from_pw(0, Error::Internal); +/// Timed out waiting for a flash operation to complete. +pub const FLASH_AST10X0_TIMEOUT: ErrorCode = FLASH_AST10X0.from_pw(1, Error::DeadlineExceeded); +/// DMA transfer aborted. +pub const FLASH_AST10X0_DMA_ABORTED: ErrorCode = FLASH_AST10X0.from_pw(2, Error::Aborted); +/// DMA transfer length mismatch. +pub const FLASH_AST10X0_DMA_LENGTH_MISMATCH: ErrorCode = FLASH_AST10X0.from_pw(3, Error::DataLoss); +/// Invalid chip select. +pub const FLASH_AST10X0_INVALID_CHIP_SELECT: ErrorCode = + FLASH_AST10X0.from_pw(4, Error::InvalidArgument); +/// Invalid or unsupported capacity/range. +pub const FLASH_AST10X0_INVALID_CAPACITY: ErrorCode = FLASH_AST10X0.from_pw(5, Error::OutOfRange); +/// Attached flash device not supported. +pub const FLASH_AST10X0_DEVICE_NOT_SUPPORTED: ErrorCode = + FLASH_AST10X0.from_pw(6, Error::Unimplemented); +/// Flash is write-protected. +pub const FLASH_AST10X0_WRITE_PROTECTED: ErrorCode = + FLASH_AST10X0.from_pw(7, Error::PermissionDenied); +/// A write is already in progress. +pub const FLASH_AST10X0_WRITE_IN_PROGRESS: ErrorCode = FLASH_AST10X0.from_pw(8, Error::Unavailable); +/// Controller not in the Ready lifecycle state. +pub const FLASH_AST10X0_CONTROLLER_NOT_READY: ErrorCode = + FLASH_AST10X0.from_pw(9, Error::FailedPrecondition); +/// DMA requested but not enabled in the controller config. +pub const FLASH_AST10X0_DMA_NOT_ENABLED: ErrorCode = + FLASH_AST10X0.from_pw(10, Error::FailedPrecondition); +/// A read returned fewer bytes than requested. +pub const FLASH_AST10X0_SHORT_READ: ErrorCode = FLASH_AST10X0.from_pw(11, Error::DataLoss); diff --git a/util/error/lib.rs b/util/error/lib.rs index f5094086f..b2ee850e2 100644 --- a/util/error/lib.rs +++ b/util/error/lib.rs @@ -77,6 +77,15 @@ impl ErrorCode { pub fn kernel_error(e: pw_status::Error) -> Self { KERNEL_ERROR.error(e as u16) } + + /// Checks a wire status word: zero is success, any non-zero value is the + /// corresponding error code. + pub const fn check_status(status: u32) -> Result<(), ErrorCode> { + match NonZero::new(status) { + None => Ok(()), + Some(val) => Err(ErrorCode(val)), + } + } } impl From for u32 { diff --git a/util/io/BUILD.bazel b/util/io/BUILD.bazel index 9c6807668..731bd11c2 100644 --- a/util/io/BUILD.bazel +++ b/util/io/BUILD.bazel @@ -6,9 +6,14 @@ load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") rust_library( name = "io", srcs = [ + "byte_source.rs", + "byte_window.rs", "io.rs", + "random_read.rs", + "storage.rs", ], crate_name = "util_io", + crate_root = "io.rs", edition = "2024", visibility = ["//visibility:public"], deps = [ diff --git a/util/io/byte_source.rs b/util/io/byte_source.rs new file mode 100644 index 000000000..f94176be6 --- /dev/null +++ b/util/io/byte_source.rs @@ -0,0 +1,61 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Random-access reads over a fixed-length byte range. + +/// A byte range of known length, read at arbitrary offsets. +/// +/// Reads take `&self`, so a caller can read through the source while +/// something else is borrowed mutably: a transfer pulls from the source +/// and writes to a device held by `&mut`. The error type is fixed rather +/// than associated, which keeps the trait dyn-compatible for a +/// heterogeneous set of sources behind one `&dyn`. +/// [`RandomRead`](crate::RandomRead) is the `&mut self` counterpart for +/// callers that need neither. +/// +/// Where the bytes live (flash, a mapped blob, a test slice) stays +/// behind the source. +pub trait ByteSource { + /// Total length in bytes, constant for the lifetime of the source: + /// readers size their buffers from it and treat a transfer as + /// complete once this many bytes are through. + fn len(&self) -> u64; + + /// True if the range is empty. + fn is_empty(&self) -> bool { + self.len() == 0 + } + + /// Fills `buf` from `offset`. The read is exact: short fills are a + /// fault, and `offset + buf.len()` beyond [`len`](Self::len) is out + /// of range. There are no partial reads: the length is known up + /// front, so a short read can only mean the source cannot serve + /// what `len` promised, and a partial-read API would put a retry + /// loop into every reader. + fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<(), ByteReadError>; +} + +/// Why a read failed, the one distinction retry policy needs. +/// +/// No further detail crosses the seam (mirroring `BootWatch`): the source +/// logs the concrete cause while it is still in scope. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ByteReadError { + /// The requested range is outside the source, a caller bug, never + /// retriable. + OutOfRange, + /// The backing storage failed the read, possibly transient; reading + /// anew may succeed. + Storage, +} + +impl core::fmt::Display for ByteReadError { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.write_str(match self { + ByteReadError::OutOfRange => "read out of range", + ByteReadError::Storage => "storage fault", + }) + } +} + +impl core::error::Error for ByteReadError {} diff --git a/util/io/byte_window.rs b/util/io/byte_window.rs new file mode 100644 index 000000000..0399056ca --- /dev/null +++ b/util/io/byte_window.rs @@ -0,0 +1,136 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! A bounded view over part of a [`ByteSource`]. + +use crate::byte_source::{ByteReadError, ByteSource}; + +/// An offset-and-length view over another [`ByteSource`]. +/// +/// The window is itself a `ByteSource`, so a reader given one cannot +/// see past it: `len` is the window's length and reads are relative to +/// its offset, so a read at 0 lands on the window's first byte rather +/// than the underlying source's. An update stages through one because +/// the region holding a candidate is board geometry while the candidate +/// is only as long as the offer said. +/// +/// Reads outside the window are +/// [`OutOfRange`](ByteReadError::OutOfRange), the same answer the +/// underlying source gives for a read past its end. A window that does +/// not fit its source is refused at construction instead, because a +/// caller that cannot describe its own range has a bug the first read +/// would only hide. +pub struct ByteWindow<'a, S: ByteSource + ?Sized> { + source: &'a S, + offset: u64, + len: u64, +} + +impl<'a, S: ByteSource + ?Sized> ByteWindow<'a, S> { + /// Views `len` bytes of `source` starting at `offset`. + /// + /// Returns [`OutOfRange`](ByteReadError::OutOfRange) if the window + /// runs past the end of `source`. + pub fn try_new(source: &'a S, offset: u64, len: u64) -> Result { + let end = offset.checked_add(len).ok_or(ByteReadError::OutOfRange)?; + if end > source.len() { + return Err(ByteReadError::OutOfRange); + } + Ok(Self { + source, + offset, + len, + }) + } +} + +impl ByteSource for ByteWindow<'_, S> { + fn len(&self) -> u64 { + self.len + } + + fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<(), ByteReadError> { + let end = offset + .checked_add(buf.len() as u64) + .ok_or(ByteReadError::OutOfRange)?; + if end > self.len { + return Err(ByteReadError::OutOfRange); + } + let start = self + .offset + .checked_add(offset) + .ok_or(ByteReadError::OutOfRange)?; + self.source.read_at(start, buf) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + struct SliceSource(&'static [u8]); + + impl ByteSource for SliceSource { + fn len(&self) -> u64 { + self.0.len() as u64 + } + + fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<(), ByteReadError> { + let start = offset as usize; + let end = start + .checked_add(buf.len()) + .ok_or(ByteReadError::OutOfRange)?; + if end > self.0.len() { + return Err(ByteReadError::OutOfRange); + } + buf.copy_from_slice(&self.0[start..end]); + Ok(()) + } + } + + static REGION: SliceSource = SliceSource(&[0, 1, 2, 3, 4, 5, 6, 7]); + + #[test] + fn the_window_reports_its_own_length_not_the_sources() { + let w = ByteWindow::try_new(®ION, 2, 3).unwrap(); + assert_eq!(w.len(), 3); + assert!(!w.is_empty()); + } + + #[test] + fn a_read_at_zero_starts_at_the_window_offset() { + let w = ByteWindow::try_new(®ION, 2, 3).unwrap(); + let mut buf = [0u8; 3]; + w.read_at(0, &mut buf).unwrap(); + assert_eq!(buf, [2, 3, 4]); + } + + #[test] + fn a_read_past_the_window_end_is_out_of_range() { + let w = ByteWindow::try_new(®ION, 2, 3).unwrap(); + let mut buf = [0u8; 2]; + assert_eq!(w.read_at(2, &mut buf), Err(ByteReadError::OutOfRange)); + } + + #[test] + fn a_window_past_the_end_of_the_source_is_refused() { + assert_eq!( + ByteWindow::try_new(®ION, 6, 4).err(), + Some(ByteReadError::OutOfRange) + ); + } + + #[test] + fn a_window_offset_that_overflows_is_refused() { + assert_eq!( + ByteWindow::try_new(®ION, u64::MAX, 1).err(), + Some(ByteReadError::OutOfRange) + ); + } + + #[test] + fn an_empty_window_is_empty() { + let w = ByteWindow::try_new(®ION, 8, 0).unwrap(); + assert!(w.is_empty()); + } +} diff --git a/util/io/io.rs b/util/io/io.rs index 1b834b805..192b1319c 100644 --- a/util/io/io.rs +++ b/util/io/io.rs @@ -5,74 +5,12 @@ #![no_std] -use util_error::{ErrorCode, ErrorModule}; - -/// The generic IO error module. -pub const IO_GENERIC: ErrorModule = ErrorModule::new(0x494F); // ascii: IO -/// The read operation is out of bounds. -pub const IO_GENERIC_READ_OUT_OF_BOUNDS: ErrorCode = - IO_GENERIC.from_pw(1, pw_status::Error::OutOfRange); - -/// Trait for random access read operations. -pub trait RandomRead { - type Error; - /// Reads data from the source into the destination buffer. - /// - /// # Arguments - /// * `start_addr`: The offset from which to start reading. - /// * `dst`: The buffer to read data into. - fn read(&mut self, start_addr: usize, dst: &mut [u8]) -> Result<(), Self::Error>; - - /// Returns the total size of the readable data in bytes. - fn size(&mut self) -> Result; -} - -impl RandomRead for &[u8] { - type Error = ErrorCode; - fn read(&mut self, start_addr: usize, dst: &mut [u8]) -> Result<(), Self::Error> { - // Explicit wrapping add. Overflows are expected to - // be detected in the indexing operation - let end_addr = start_addr.wrapping_add(dst.len()); - let src = self - .get(start_addr..end_addr) - .ok_or(IO_GENERIC_READ_OUT_OF_BOUNDS)?; - dst.copy_from_slice(src); - Ok(()) - } - fn size(&mut self) -> Result { - Ok(self.len()) - } -} - -#[cfg(test)] -mod test { - use super::*; - - #[test] - fn should_read() { - let mut src: &[u8] = &[1, 2, 3, 4, 5, 6, 7, 8, 9]; - let mut dst: [u8; 3] = [0; 3]; - assert!(src.read(6, &mut dst).is_ok()); - assert_eq!(&dst, &[7, 8, 9]); - assert_eq!(RandomRead::size(&mut src).unwrap(), 9); - } - - #[test] - fn should_fail() { - let mut src: &[u8] = &[1, 2, 3, 4, 5, 6, 7, 8, 9]; - let mut dst: [u8; 3] = [0; 3]; - assert!(src.read(7, &mut dst).is_err()); - } - - #[test] - fn invalid_start_address_should_not_panic() { - let mut src: &[u8] = &[1, 2, 3, 4, 5, 6, 7, 8]; - let mut dst: [u8; 4] = [0; 4]; - // Set `start_addr` so that adding `dst.len()` causes it to - // wrap around and become smaller than `src.len()` - let start_addr: usize = usize::MAX - (dst.len() - 1); - // Should not panic - let result = src.read(start_addr, &mut dst); - assert!(result.is_err()); - } -} +mod byte_source; +mod byte_window; +mod random_read; +mod storage; + +pub use byte_source::{ByteReadError, ByteSource}; +pub use byte_window::ByteWindow; +pub use random_read::{RandomRead, IO_GENERIC, IO_GENERIC_READ_OUT_OF_BOUNDS}; +pub use storage::Storage; diff --git a/util/io/random_read.rs b/util/io/random_read.rs new file mode 100644 index 000000000..5bccf4a5d --- /dev/null +++ b/util/io/random_read.rs @@ -0,0 +1,74 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Random-access reads over a borrowed source. + +use util_error::{ErrorCode, ErrorModule}; + +/// The generic IO error module. +pub const IO_GENERIC: ErrorModule = ErrorModule::new(0x494F); // ascii: IO +/// The read operation is out of bounds. +pub const IO_GENERIC_READ_OUT_OF_BOUNDS: ErrorCode = + IO_GENERIC.from_pw(1, pw_status::Error::OutOfRange); + +/// Trait for random access read operations. +pub trait RandomRead { + type Error; + /// Reads data from the source into the destination buffer. + /// + /// # Arguments + /// * `start_addr`: The offset from which to start reading. + /// * `dst`: The buffer to read data into. + fn read(&mut self, start_addr: usize, dst: &mut [u8]) -> Result<(), Self::Error>; + + /// Returns the total size of the readable data in bytes. + fn size(&mut self) -> Result; +} + +impl RandomRead for &[u8] { + type Error = ErrorCode; + fn read(&mut self, start_addr: usize, dst: &mut [u8]) -> Result<(), Self::Error> { + // Explicit wrapping add. Overflows are expected to + // be detected in the indexing operation + let end_addr = start_addr.wrapping_add(dst.len()); + let src = self + .get(start_addr..end_addr) + .ok_or(IO_GENERIC_READ_OUT_OF_BOUNDS)?; + dst.copy_from_slice(src); + Ok(()) + } + fn size(&mut self) -> Result { + Ok(self.len()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn should_read() { + let mut src: &[u8] = &[1, 2, 3, 4, 5, 6, 7, 8, 9]; + let mut dst: [u8; 3] = [0; 3]; + assert!(src.read(6, &mut dst).is_ok()); + assert_eq!(&dst, &[7, 8, 9]); + assert_eq!(RandomRead::size(&mut src).unwrap(), 9); + } + #[test] + fn should_fail() { + let mut src: &[u8] = &[1, 2, 3, 4, 5, 6, 7, 8, 9]; + let mut dst: [u8; 3] = [0; 3]; + assert!(src.read(7, &mut dst).is_err()); + } + #[test] + fn invalid_start_address_should_not_panic() { + let mut src: &[u8] = &[1, 2, 3, 4, 5, 6, 7, 8]; + let mut dst: [u8; 4] = [0; 4]; + // Set `start_addr` so that adding `dst.len()` causes it to + // wrap around and become smaller than `src.len()` + let start_addr: usize = usize::MAX - (dst.len() - 1); + // Should not panic + let result = src.read(start_addr, &mut dst); + assert!(result.is_err()); + } +} diff --git a/util/io/storage.rs b/util/io/storage.rs new file mode 100644 index 000000000..aac53e6bd --- /dev/null +++ b/util/io/storage.rs @@ -0,0 +1,304 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Byte storage with sessions and split-phase writes. + +/// Byte storage with sessions and split-phase writes. +/// +/// Works for SPI NOR flash, on-chip SRAM, and RAM test buffers. +/// SPI NOR is the main target (erase-before-write, slow erases, bus +/// ownership). SRAM and RAM skip the erase and finish on the first poll. +/// +/// Open a session before I/O, close when done. On SPI flash, open +/// asserts chip-select and claims the bus so no other master can +/// interleave commands mid-operation. Close releases chip-select and +/// frees the bus for other users. Double-open and close-without-open +/// are errors. +/// +/// Writes: `start_write`, poll `is_busy`, `complete_write`. Data is +/// copied internally. One write at a time; reads, writes, and close +/// all error while one is in flight. No cancel (an in-progress erase +/// leaves the sector bad if aborted). +/// +/// Reads are synchronous. No byte may be written twice per session +/// (lets flash erase on first touch without read-modify-write). +pub trait Storage { + type Error; + + /// Open a session (claims the bus on SPI flash). + fn open(&mut self) -> Result<(), Self::Error>; + + /// Read `buf.len()` bytes starting at `offset`. + fn read_at(&mut self, offset: usize, buf: &mut [u8]) -> Result<(), Self::Error>; + + /// Begin writing `data` at `offset`. Data is copied internally. + fn start_write(&mut self, offset: usize, data: &[u8]) -> Result<(), Self::Error>; + + /// True while a write is still in progress. + fn is_busy(&mut self) -> bool; + + /// Finalize a completed write. Data is durable when this returns Ok. + fn complete_write(&mut self) -> Result<(), Self::Error>; + + /// Close the session. Errors if a write is in flight or no session is open. + fn close(&mut self) -> Result<(), Self::Error>; +} + +/// In-memory [`Storage`] mock. Set `polls_per_write` > 0 to verify +/// callers actually poll. +#[cfg(test)] +pub struct MockStorage { + buf: [u8; 256], + session_open: bool, + pending: Option, + polls_remaining: usize, + polls_per_write: usize, +} + +#[cfg(test)] +struct PendingWrite { + offset: usize, + len: usize, + staging: [u8; 256], +} + +#[cfg(test)] +#[derive(Debug, PartialEq, Eq)] +pub enum MockError { + NoSession, + AlreadyOpen, + Busy, + NotBusy, + OutOfBounds, +} + +#[cfg(test)] +impl MockStorage { + fn new(polls_per_write: usize) -> Self { + Self { + buf: [0xFF; 256], + session_open: false, + pending: None, + polls_remaining: 0, + polls_per_write, + } + } +} + +#[cfg(test)] +impl Storage for MockStorage { + type Error = MockError; + + fn open(&mut self) -> Result<(), MockError> { + if self.session_open { + return Err(MockError::AlreadyOpen); + } + self.session_open = true; + Ok(()) + } + + fn read_at(&mut self, offset: usize, buf: &mut [u8]) -> Result<(), MockError> { + if !self.session_open { + return Err(MockError::NoSession); + } + if self.pending.is_some() { + return Err(MockError::Busy); + } + let end = offset + .checked_add(buf.len()) + .ok_or(MockError::OutOfBounds)?; + if end > self.buf.len() { + return Err(MockError::OutOfBounds); + } + buf.copy_from_slice(&self.buf[offset..end]); + Ok(()) + } + + fn start_write(&mut self, offset: usize, data: &[u8]) -> Result<(), MockError> { + if !self.session_open { + return Err(MockError::NoSession); + } + if self.pending.is_some() { + return Err(MockError::Busy); + } + let end = offset + .checked_add(data.len()) + .ok_or(MockError::OutOfBounds)?; + if end > self.buf.len() { + return Err(MockError::OutOfBounds); + } + let mut staging = [0u8; 256]; + staging[..data.len()].copy_from_slice(data); + self.pending = Some(PendingWrite { + offset, + len: data.len(), + staging, + }); + self.polls_remaining = self.polls_per_write; + Ok(()) + } + + fn is_busy(&mut self) -> bool { + if self.pending.is_none() { + return false; + } + if self.polls_remaining > 0 { + self.polls_remaining -= 1; + return true; + } + false + } + + fn complete_write(&mut self) -> Result<(), MockError> { + if self.polls_remaining > 0 { + return Err(MockError::Busy); + } + let pw = self.pending.take().ok_or(MockError::NotBusy)?; + self.buf[pw.offset..pw.offset + pw.len].copy_from_slice(&pw.staging[..pw.len]); + Ok(()) + } + + fn close(&mut self) -> Result<(), MockError> { + if !self.session_open { + return Err(MockError::NoSession); + } + if self.pending.is_some() { + return Err(MockError::Busy); + } + self.session_open = false; + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn drain_write(s: &mut MockStorage) { + while s.is_busy() {} + s.complete_write().unwrap(); + } + + #[test] + fn storage_write_then_read_back() { + let mut s = MockStorage::new(3); + s.open().unwrap(); + s.start_write(4, &[0xAA, 0xBB]).unwrap(); + drain_write(&mut s); + let mut out = [0u8; 2]; + s.read_at(4, &mut out).unwrap(); + assert_eq!(out, [0xAA, 0xBB]); + s.close().unwrap(); + } + #[test] + fn storage_completes_after_n_polls() { + let mut s = MockStorage::new(3); + s.open().unwrap(); + s.start_write(0, &[1]).unwrap(); + assert!(s.is_busy()); + assert!(s.is_busy()); + assert!(s.is_busy()); + assert!(!s.is_busy()); + s.complete_write().unwrap(); + s.close().unwrap(); + } + #[test] + fn storage_read_outside_session_returns_error() { + let mut s = MockStorage::new(0); + let mut out = [0u8; 1]; + assert_eq!(s.read_at(0, &mut out), Err(MockError::NoSession)); + } + #[test] + fn storage_start_write_outside_session_returns_error() { + let mut s = MockStorage::new(0); + assert_eq!(s.start_write(0, &[1]), Err(MockError::NoSession)); + } + #[test] + fn storage_double_start_rejected() { + let mut s = MockStorage::new(2); + s.open().unwrap(); + s.start_write(0, &[1]).unwrap(); + assert_eq!(s.start_write(8, &[2]), Err(MockError::Busy)); + drain_write(&mut s); + s.close().unwrap(); + } + #[test] + fn storage_close_while_in_flight_rejected() { + let mut s = MockStorage::new(2); + s.open().unwrap(); + s.start_write(0, &[1]).unwrap(); + assert_eq!(s.close(), Err(MockError::Busy)); + drain_write(&mut s); + s.close().unwrap(); + } + #[test] + fn storage_complete_before_done_rejected() { + let mut s = MockStorage::new(2); + s.open().unwrap(); + s.start_write(0, &[1]).unwrap(); + assert_eq!(s.complete_write(), Err(MockError::Busy)); + drain_write(&mut s); + s.close().unwrap(); + } + #[test] + fn storage_read_while_in_flight_rejected() { + let mut s = MockStorage::new(2); + s.open().unwrap(); + s.start_write(0, &[1]).unwrap(); + let mut out = [0u8; 1]; + assert_eq!(s.read_at(0, &mut out), Err(MockError::Busy)); + drain_write(&mut s); + s.close().unwrap(); + } + #[test] + fn storage_complete_without_pending_rejected() { + let mut s = MockStorage::new(0); + s.open().unwrap(); + assert_eq!(s.complete_write(), Err(MockError::NotBusy)); + s.close().unwrap(); + } + #[test] + fn storage_write_out_of_bounds_rejected() { + let mut s = MockStorage::new(0); + s.open().unwrap(); + assert_eq!(s.start_write(250, &[0; 10]), Err(MockError::OutOfBounds)); + s.close().unwrap(); + } + #[test] + fn storage_double_open_rejected() { + let mut s = MockStorage::new(0); + s.open().unwrap(); + assert_eq!(s.open(), Err(MockError::AlreadyOpen)); + s.close().unwrap(); + } + #[test] + fn storage_close_without_session_rejected() { + let mut s = MockStorage::new(0); + assert_eq!(s.close(), Err(MockError::NoSession)); + } + #[test] + fn storage_reopen_after_close() { + let mut s = MockStorage::new(1); + s.open().unwrap(); + s.start_write(0, &[0xAA]).unwrap(); + drain_write(&mut s); + s.close().unwrap(); + s.open().unwrap(); + s.start_write(4, &[0xBB]).unwrap(); + drain_write(&mut s); + let mut out = [0u8; 1]; + s.read_at(0, &mut out).unwrap(); + assert_eq!(out, [0xAA]); + s.read_at(4, &mut out).unwrap(); + assert_eq!(out, [0xBB]); + s.close().unwrap(); + } + #[test] + fn storage_read_out_of_bounds_rejected() { + let mut s = MockStorage::new(0); + s.open().unwrap(); + let mut out = [0u8; 10]; + assert_eq!(s.read_at(250, &mut out), Err(MockError::OutOfBounds)); + s.close().unwrap(); + } +} diff --git a/util/ipc/BUILD.bazel b/util/ipc/BUILD.bazel new file mode 100644 index 000000000..55a32387c --- /dev/null +++ b/util/ipc/BUILD.bazel @@ -0,0 +1,27 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library") + +rust_library( + name = "ipc", + srcs = [ + "async_transaction.rs", + "channel_transport.rs", + "lib.rs", + "target.rs", + ], + crate_name = "util_ipc", + edition = "2024", + tags = ["kernel"], + target_compatible_with = select({ + "@platforms//os:none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + visibility = ["//visibility:public"], + deps = [ + "//util/service", + "@pigweed//pw_kernel/userspace", + "@pigweed//pw_status/rust:pw_status", + ], +) diff --git a/util/ipc/async_transaction.rs b/util/ipc/async_transaction.rs new file mode 100644 index 000000000..46b634ff5 --- /dev/null +++ b/util/ipc/async_transaction.rs @@ -0,0 +1,205 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Safe async IPC transaction wrapper, layered on `IpcInitiator`. +//! +//! `AsyncTransaction` wraps the unsafe `async_transact_start`/`_complete`/ +//! `_cancel` trio into a state machine (Idle / Pending) that enforces the +//! kernel's one-transaction-per-channel rule locally and keeps the +//! raw-pointer safety contract in one place. +//! +//! Buffers are `&'static` because the kernel holds raw pointers into them +//! for the duration of the transaction. If `AsyncTransaction` owned the buffers +//! inline and the struct moved after `start()`, those pointers would +//! dangle. Static borrows make soundness independent of moves and +//! `mem::forget`. +//! +//! Every exit from Pending returns both buffers to the caller so they can +//! be reused for the next transaction (the standard embedded-DMA ownership +//! pattern). + +use super::IpcInitiator; +use pw_status::{Error, Result}; + +/// Buffers lent to the kernel for the duration of one async transaction. +#[derive(Debug)] +pub struct Buffers { + pub send: &'static mut [u8], + pub recv: &'static mut [u8], +} + +/// One-at-a-time async IPC transaction on an `IpcInitiator`. +/// +/// Transitions: Idle -> `start()` -> Pending -> `try_recv()`/`cancel()` -> Idle. +pub struct AsyncTransaction { + handle: H, + inflight: Option, +} + +impl AsyncTransaction { + /// Wrap an initiator handle with no outstanding async transaction. + pub fn new(handle: H) -> Self { + Self { + handle, + inflight: None, + } + } + + /// The raw channel handle, e.g. to register with a WaitGroup or pass to + /// `object_wait`. + pub fn as_raw(&self) -> u32 { + self.handle.as_raw() + } + + /// Whether a transaction is in flight. + pub fn is_pending(&self) -> bool { + self.inflight.is_some() + } + + /// Start an async transaction. + /// + /// `send` holds the request payload the server will read. `recv` is + /// the buffer the kernel writes the server's response into. Both must + /// be `'static` because the kernel holds raw pointers into them until + /// `try_recv` or `cancel` completes the transaction. + /// + /// `send` is taken mutably even though the kernel only reads it: the + /// caller serializes the next request into the same buffer, and a + /// shared borrow handed back would leave it with nowhere to write. + /// Only `send[..send_len]` goes on the wire, so a caller that keeps one + /// buffer sized for its largest request does not transmit the slack + /// behind a short one. `send_len` past the end of `send` is + /// `OutOfRange`. + /// + /// On success the buffers are held until `try_recv` or `cancel` + /// returns them. On failure (already pending, or a kernel error) both + /// buffers come back in the `Err` so nothing is lost. + pub fn start( + &mut self, + send: &'static mut [u8], + send_len: usize, + recv: &'static mut [u8], + ) -> core::result::Result<(), StartError> { + if self.inflight.is_some() { + return Err(StartError { + error: Error::FailedPrecondition, + send, + recv, + }); + } + if send_len > send.len() { + return Err(StartError { + error: Error::OutOfRange, + send, + recv, + }); + } + + // Safety: send/recv are 'static, so the kernel's raw pointers + // stay valid regardless of what happens to `self`, and they are + // not read, written, or dropped again until try_recv/cancel. + // nosemgrep + let result = unsafe { self.handle.async_transact_start(&send[..send_len], recv) }; + + match result { + Ok(()) => { + self.inflight = Some(Buffers { send, recv }); + Ok(()) + } + Err(error) => Err(StartError { error, send, recv }), + } + } + + /// Try to complete a pending transaction. + /// + /// Returns `Ok(Some(Completion { len, send, recv }))` when the server + /// has responded. `recv[..len]` holds the response payload; both + /// buffers come back so they can be reused. + /// + /// Returns `Ok(None)` while the server has not responded yet. The + /// buffers stay held and another `try_recv` is expected after the + /// next READABLE signal. + /// + /// Any error ends the transaction and carries the buffers out, so + /// there is no path that strands them. `FailedPrecondition` means no + /// transaction was pending, and that one carries nothing. + pub fn try_recv(&mut self) -> core::result::Result, RecvError> { + if self.inflight.is_none() { + return Err(RecvError { + error: Error::FailedPrecondition, + buffers: None, + }); + } + + match self.handle.async_transact_complete() { + Ok(len) => { + let Buffers { send, recv } = self.inflight.take().unwrap(); + Ok(Some(Completion { len, send, recv })) + } + Err(Error::Unavailable) => Ok(None), + Err(error) => { + // The kernel refused for a reason that is not "not yet". + // Take the buffers back rather than leave the caller to + // remember a cancel(). + let buffers = self.cancel().ok(); + Err(RecvError { error, buffers }) + } + } + } + + /// Cancel a pending transaction and reclaim the buffers. + /// + /// If the server has already responded, the response is silently + /// discarded. + /// + /// Returns `Err(Error::FailedPrecondition)` if no transaction is + /// pending. The buffers come back even if the cancel syscall errors: the + /// kernel clears its transaction slot on every path, so it no longer + /// holds pointers into them. + pub fn cancel(&mut self) -> Result { + let Some(buffers) = self.inflight.take() else { + return Err(Error::FailedPrecondition); + }; + + // Only failure for a started transaction is Unavailable, meaning the + // transaction was already dropped. The buffers are free either way. + let _ = self.handle.async_cancel(); + Ok(buffers) + } +} + +impl Drop for AsyncTransaction { + fn drop(&mut self) { + if self.inflight.is_some() { + let _ = self.handle.async_cancel(); + } + } +} + +/// Successful completion of an async transaction. +#[derive(Debug)] +pub struct Completion { + /// Number of response bytes written into `recv`. + pub len: usize, + /// The send buffer, returned for reuse. + pub send: &'static mut [u8], + /// The receive buffer, returned for reuse. `recv[..len]` holds the + /// response payload. + pub recv: &'static mut [u8], +} + +/// Error from `try_recv()`. `buffers` is `None` only when no transaction +/// was pending, so there were none to hand back. +#[derive(Debug)] +pub struct RecvError { + pub error: Error, + pub buffers: Option, +} + +/// Error from `start()`, carrying the buffers back so they are not lost. +#[derive(Debug)] +pub struct StartError { + pub error: Error, + pub send: &'static mut [u8], + pub recv: &'static mut [u8], +} diff --git a/util/ipc/channel_transport.rs b/util/ipc/channel_transport.rs new file mode 100644 index 000000000..ff438dc51 --- /dev/null +++ b/util/ipc/channel_transport.rs @@ -0,0 +1,123 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! `util_service::AsyncTransport` over a kernel channel. +//! +//! `AsyncTransaction` lends the kernel `'static` buffers for the duration of +//! a transaction, which a caller holding an ordinary `&[u8]` request cannot +//! satisfy. This type owns that pair of buffers, copies each request in and +//! each response out, and hands callers the plain-slice seam every service +//! shares. +//! +//! Buffer sizes are the wiring's choice: a request longer than the send +//! buffer, or a response longer than the caller's, is `TooLarge` rather than +//! a truncated frame. + +use util_service::{AsyncTransport, TransportError}; + +use super::async_transaction::{AsyncTransaction, Buffers}; +use super::IpcInitiator; + +/// One channel's worth of async round-trip, with the buffers it lends the +/// kernel. +pub struct AsyncChannelTransport { + txn: AsyncTransaction, + /// Held while idle, lent to `txn` while a round-trip is in flight. + idle: Option, +} + +impl AsyncChannelTransport { + /// Wrap an initiator with the buffers it lends the kernel. `send` must + /// fit the largest request this channel carries, `recv` the largest + /// response. + pub fn new(handle: H, send: &'static mut [u8], recv: &'static mut [u8]) -> Self { + Self { + txn: AsyncTransaction::new(handle), + idle: Some(Buffers { send, recv }), + } + } + + /// The raw channel handle, to register with a WaitGroup so the event + /// loop wakes when the response lands. + pub fn as_raw(&self) -> u32 { + self.txn.as_raw() + } + + /// Whether a round-trip is in flight. + pub fn is_pending(&self) -> bool { + self.txn.is_pending() + } +} + +impl AsyncTransport for AsyncChannelTransport { + fn start(&mut self, req: &[u8]) -> Result<(), TransportError> { + let Some(buffers) = self.idle.take() else { + return Err(TransportError::WrongState); + }; + let Buffers { send, recv } = buffers; + + if req.len() > send.len() { + self.idle = Some(Buffers { send, recv }); + return Err(TransportError::TooLarge); + } + send[..req.len()].copy_from_slice(req); + + match self.txn.start(send, req.len(), recv) { + Ok(()) => Ok(()), + Err(e) => { + // The buffers came back, so the next start can reuse them. + self.idle = Some(Buffers { + send: e.send, + recv: e.recv, + }); + Err(TransportError::Failed) + } + } + } + + fn poll(&mut self, resp: &mut [u8]) -> Result, TransportError> { + if self.idle.is_some() { + return Err(TransportError::WrongState); + } + + match self.txn.try_recv() { + Ok(None) => Ok(None), + Ok(Some(completion)) => { + let len = completion.len; + let too_large = len > resp.len(); + if !too_large { + resp[..len].copy_from_slice(&completion.recv[..len]); + } + self.idle = Some(Buffers { + send: completion.send, + recv: completion.recv, + }); + if too_large { + // recv goes back to idle without being copied out, so + // the response is gone. The next call is start. + return Err(TransportError::TooLarge); + } + Ok(Some(len)) + } + Err(e) => { + // try_recv hands the buffers out on every failure, so the + // channel is idle again and the next call is start. + self.idle = e.buffers; + Err(TransportError::Failed) + } + } + } + + fn cancel(&mut self) -> Result<(), TransportError> { + if self.idle.is_some() { + return Err(TransportError::WrongState); + } + match self.txn.cancel() { + Ok(buffers) => { + self.idle = Some(buffers); + Ok(()) + } + Err(_) => Err(TransportError::Failed), + } + } +} diff --git a/util/ipc/lib.rs b/util/ipc/lib.rs new file mode 100644 index 000000000..644306477 --- /dev/null +++ b/util/ipc/lib.rs @@ -0,0 +1,104 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! IPC abstraction over Pigweed kernel channels. +//! +//! `IpcInitiator` and `IpcHandler` split the two channel roles the kernel +//! itself distinguishes (`ChannelInitiatorObject` vs `ChannelHandlerObject`), +//! so a type only has to implement the operations its role can actually +//! serve. `AsyncTransaction` is a safe layer on top of `IpcInitiator`'s +//! unsafe async trio, tracking the one-transaction-per-channel invariant +//! locally instead of leaving it to the caller. + +#![no_std] + +use pw_status::Result; + +/// Blocking and async operations available on the initiator side of a +/// channel (a `ChannelInitiatorObject` in the kernel). +pub trait IpcInitiator { + fn transact( + &self, + send_data: &BufSend, + recv_data: &mut BufRecv, + deadline: Instant, + ) -> Result + where + BufSend: AsSyscallBuffer + ?Sized, + BufRecv: AsSyscallBuffer + ?Sized; + + /// Starts a transaction and returns immediately; poll readiness via + /// `object_wait`/`wait_group_add` on this channel's handle + /// (`Signals::READABLE`), then call `async_transact_complete` or + /// `async_cancel`. Fails with `Error::Unavailable` if a transaction + /// (blocking or async) is already pending on this channel. + /// + /// # Safety + /// The kernel holds raw pointers into `send_data`/`recv_data` (and + /// writes the response into `recv_data`) until the transaction is + /// completed or cancelled — callers must not read or write either + /// buffer, or let them be dropped or moved, until then. `recv_data` + /// must be large enough to hold the response; a response that + /// overflows it is a kernel error, not truncated silently. + unsafe fn async_transact_start( + &self, + send_data: &BufSend, + recv_data: &mut BufRecv, + ) -> Result<()> + where + BufSend: AsSyscallBuffer + ?Sized, + BufRecv: AsSyscallBuffer + ?Sized; + + fn async_transact_complete(&self) -> Result; + + fn async_cancel(&self) -> Result<()>; + + /// The raw channel handle, e.g. to register with a WaitGroup or pass to + /// `object_wait`. + fn as_raw(&self) -> u32; +} + +/// Operations available on the handler side of a channel (a +/// `ChannelHandlerObject` in the kernel). +pub trait IpcHandler { + fn read(&self, offset: usize, buffer: &mut Buf) -> Result + where + Buf: AsSyscallBuffer + ?Sized; + + fn respond(&self, buffer: &Buf) -> Result<()> + where + Buf: AsSyscallBuffer + ?Sized; +} + +/// Transparent wrapper around a raw IPC handle. +/// +/// `set_peer_user_signal` (defined in the target-only impl) is an inherent +/// method here rather than on `IpcInitiator`/`IpcHandler`, since it's usable +/// from either channel role and duplicating it onto both traits would just +/// mean two copies of the same forwarding call to keep in sync. +/// +/// One transaction per channel is a kernel rule, not something this type +/// enforces: wrapping the same handle in two `AsyncTransaction`s just gets +/// you `Unavailable` on the second `start`, with the buffers handed back — +/// not anything unsound. +#[repr(transparent)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub struct IpcHandle { + pub handle: u32, +} + +impl IpcHandle { + /// Wraps a raw channel handle. Trusts the caller to pass one the kernel + /// actually gave out. + pub const fn new(handle: u32) -> Self { + Self { handle } + } +} + +mod async_transaction; +mod channel_transport; +mod target; + +pub use async_transaction::{AsyncTransaction, Buffers, Completion, RecvError, StartError}; +pub use channel_transport::AsyncChannelTransport; +pub use target::{AsSyscallBuffer, Instant}; diff --git a/util/ipc/target.rs b/util/ipc/target.rs new file mode 100644 index 000000000..976cb9864 --- /dev/null +++ b/util/ipc/target.rs @@ -0,0 +1,81 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +use super::{IpcHandle, IpcHandler, IpcInitiator}; + +pub use userspace::buffer::AsSyscallBuffer; +pub use userspace::time::Instant; + +impl IpcHandle { + /// Set (set=true) or clear (set=false) Signals::USER on the paired peer. + pub fn set_peer_user_signal(&self, set: bool) -> pw_status::Result<()> { + userspace::syscall::object_set_peer_user_signal(self.handle, set) + } +} + +impl IpcInitiator for IpcHandle { + fn transact( + &self, + send_data: &BufSend, + recv_data: &mut BufRecv, + deadline: Instant, + ) -> pw_status::Result + where + BufSend: AsSyscallBuffer + ?Sized, + BufRecv: AsSyscallBuffer + ?Sized, + { + userspace::syscall::channel_transact(self.handle, send_data, recv_data, deadline) + } + + unsafe fn async_transact_start( + &self, + send_data: &BufSend, + recv_data: &mut BufRecv, + ) -> pw_status::Result<()> + where + BufSend: AsSyscallBuffer + ?Sized, + BufRecv: AsSyscallBuffer + ?Sized, + { + let (send_ptr, send_len) = send_data.as_raw(); + let (recv_ptr, recv_len) = recv_data.as_raw_mut(); + // Safety: caller upholds the buffer-lifetime contract per this fn's doc. + // nosemgrep + unsafe { + userspace::syscall::channel_async_transact( + self.handle, + send_ptr, + send_len, + recv_ptr, + recv_len, + ) + } + } + + fn async_transact_complete(&self) -> pw_status::Result { + userspace::syscall::channel_async_transact_complete(self.handle) + } + + fn async_cancel(&self) -> pw_status::Result<()> { + userspace::syscall::channel_async_cancel(self.handle) + } + + fn as_raw(&self) -> u32 { + self.handle + } +} + +impl IpcHandler for IpcHandle { + fn read(&self, offset: usize, buffer: &mut Buf) -> pw_status::Result + where + Buf: AsSyscallBuffer + ?Sized, + { + userspace::syscall::channel_read(self.handle, offset, buffer) + } + + fn respond(&self, buffer: &Buf) -> pw_status::Result<()> + where + Buf: AsSyscallBuffer + ?Sized, + { + userspace::syscall::channel_respond(self.handle, buffer) + } +} diff --git a/util/region/BUILD.bazel b/util/region/BUILD.bazel new file mode 100644 index 000000000..4798899cd --- /dev/null +++ b/util/region/BUILD.bazel @@ -0,0 +1,15 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +exports_files(["regions.rs.jinja"]) + +rust_library( + name = "region", + srcs = ["lib.rs"], + crate_name = "util_region", + edition = "2024", +) diff --git a/util/region/defs.bzl b/util/region/defs.bzl new file mode 100644 index 000000000..77a29bdeb --- /dev/null +++ b/util/region/defs.bzl @@ -0,0 +1,101 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +"""Generates a process's Rust memory mappings from the system manifest. + +Runs pigweed's `system_generator_bin` with our own template, so the addresses +in `system.json5` reach Rust without being restated by hand. +""" + +load("@rules_rust//rust:defs.bzl", "rust_library") + +def _app_regions_src_impl(ctx): + output = ctx.actions.declare_file(ctx.attr.name + ".rs") + + args = [ + "--template", + "app=" + ctx.file.template.path, + "--config", + ctx.file.system_config.path, + "--output", + output.path, + "render-app-template", + ] + + if ctx.attr.app_name: + args.extend(["--app-name", ctx.attr.app_name]) + + if ctx.attr.process_name: + args.extend(["--process-name", ctx.attr.process_name]) + + ctx.actions.run( + inputs = ctx.files.system_config + [ctx.file.template], + outputs = [output], + executable = ctx.executable.system_generator, + mnemonic = "AppRegionsSrc", + progress_message = "Generating memory mappings for %s" % ctx.label, + arguments = args, + ) + + return [DefaultInfo(files = depset([output]))] + +_app_regions_src = rule( + implementation = _app_regions_src_impl, + attrs = { + "app_name": attr.string( + doc = "Name of the application in the configuration file.", + default = "", + ), + "process_name": attr.string( + doc = "Name of the process in the configuration file.", + default = "", + ), + "system_config": attr.label( + doc = "System config file which defines the system.", + allow_single_file = True, + ), + "system_generator": attr.label( + executable = True, + cfg = "exec", + default = "@pigweed//pw_kernel/tooling/system_generator:system_generator_bin", + ), + "template": attr.label( + doc = "Memory mapping table template.", + allow_single_file = True, + default = "//util/region:regions.rs.jinja", + ), + }, + doc = "Generate a process's Rust memory mappings.", +) + +def app_regions(name, app_name = "", process_name = None, system_config = None, **kwargs): + """Generates and compiles a process's Rust memory mappings. + + Args: + name: Name of the generated crate. + app_name: Name of the app in the system manifest. + process_name: Name of the process in the system manifest. + system_config: System config file which defines the system. + **kwargs: forwarded to rust_library; tags also reaches the generator rule. + """ + + # The generator takes these as a clap arg-group: exactly one, never both. + if bool(app_name) == bool(process_name): + fail("app_regions requires exactly one of app_name or process_name") + + tags = kwargs.get("tags", []) + + _app_regions_src( + name = name + ".src", + app_name = app_name, + process_name = process_name if process_name else "", + system_config = system_config, + tags = tags, + ) + + rust_library( + name = name, + srcs = [":{}.src".format(name)], + deps = ["//util/region"], + **kwargs + ) diff --git a/util/region/lib.rs b/util/region/lib.rs new file mode 100644 index 000000000..865c72d7c --- /dev/null +++ b/util/region/lib.rs @@ -0,0 +1,46 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Ownership tokens for the memory regions a process is granted in `system.json5`. +//! +//! The per-process mapping table is generated from the same manifest the kernel +//! uses to program the MPU, so an address is written down in exactly one place. + +#![no_std] + +use core::marker::PhantomData; + +/// Address range of one memory mapping, generated from the system manifest. +pub trait Mmap { + const START: usize; + const LEN: usize; +} + +/// Whether `T`'s range contains the `len` bytes starting at `start`. +/// +/// Written without `START + LEN` so a region that runs to the end of the +/// address space does not overflow the const evaluator. +pub const fn covers(start: usize, len: usize) -> bool { + start >= T::START && T::LEN >= len && start - T::START <= T::LEN - len +} + +/// Exclusive ownership of the region described by `T`. +/// +/// Move-only, so handing it to a driver transfers sole access and a second +/// claim is a compile error rather than an aliasing hazard. +pub struct Region(PhantomData); + +impl Region { + /// # Safety + /// Mints ownership of `T`'s address range from nothing. Only the generated + /// per-process mapping table may call this, and only once. + #[doc(hidden)] + pub const unsafe fn new() -> Self { + Self(PhantomData) + } + + /// Start of the granted range, as a mutable pointer. + pub const fn as_mut_ptr(&self) -> *mut u8 { + T::START as *mut u8 + } +} diff --git a/util/region/regions.rs.jinja b/util/region/regions.rs.jinja new file mode 100644 index 000000000..5dae2a28e --- /dev/null +++ b/util/region/regions.rs.jinja @@ -0,0 +1,31 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +// Generated from the system manifest. Do not edit. + +#![no_std] + +#[allow(unused_imports)] +use util_region::{Mmap, Region}; +{% for m in process.memory_mappings %}{% if m["type"] == "device" %}{% set mmap = m.name | replace("_", " ") | title | replace(" ", "") %} +pub struct {{mmap}}; + +impl Mmap for {{mmap}} { + const START: usize = {{m.start_address | hex}}; + const LEN: usize = {{m.size_bytes | hex}}; +} +{% endif %}{% endfor %} +/// The device memory mappings declared for `{{process.name}}`. +pub struct Mmaps { +{% for m in process.memory_mappings %}{% if m["type"] == "device" %} pub {{m.name}}: Region<{{m.name | replace("_", " ") | title | replace(" ", "")}}>, +{% endif %}{% endfor %}} + +/// # Safety +/// Mints every mapping in the table, so each region it names is claimed from +/// nothing. Call once, from the process entry point. +#[allow(unused)] +pub const unsafe fn take_mmaps() -> Mmaps { + Mmaps { +{% for m in process.memory_mappings %}{% if m["type"] == "device" %} {{m.name}}: unsafe { Region::new() }, +{% endif %}{% endfor %} } +} diff --git a/util/service/BUILD.bazel b/util/service/BUILD.bazel new file mode 100644 index 000000000..4444df1d9 --- /dev/null +++ b/util/service/BUILD.bazel @@ -0,0 +1,23 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") + +rust_library( + name = "service", + srcs = [ + "delayed.rs", + "dispatch.rs", + "lib.rs", + "loopback.rs", + "transport.rs", + ], + crate_name = "util_service", + edition = "2024", + visibility = ["//visibility:public"], +) + +rust_test( + name = "service_test", + crate = ":service", +) diff --git a/util/service/README.md b/util/service/README.md new file mode 100644 index 000000000..e369994fc --- /dev/null +++ b/util/service/README.md @@ -0,0 +1,33 @@ +# util_service + +Transport and dispatch traits for IPC services. `#![no_std]`, no kernel +dependencies. + +## Traits + +`Transport` blocks until the response arrives. `AsyncTransport` splits the +round-trip so the caller never blocks: `start`, poll `Ok(None)` until +`Ok(Some(len))`. `Dispatch` is the server end, one request frame in, one +response frame out. + +Wake-up registration (channel handle, WaitGroup) needs the concrete +transport, so it happens at wiring time, not through the trait. + +## Loopback + +`Loopback` wraps a `Dispatch` and answers in-process. Both transport +traits work because the response is ready the moment the request is. `N` +sizes the async response buffer. The blocking path writes into the +caller's buffer directly. A loopback has no send buffer, so it never refuses a request at `start`. +If the request is too large, the server sees it and answers with a +protocol error frame instead. + +Because `poll` never returns `Ok(None)`, a loopback cannot test not-ready +handling on its own. Wrap it in `Delayed` (below) for that. + +## Delayed + +`Delayed` wraps any `AsyncTransport` and returns `Ok(None)` for a set +number of polls before forwarding to the inner transport. This is how a +host test reaches a client's not-ready path when the underlying transport +(like `Loopback`) always answers immediately. diff --git a/util/service/delayed.rs b/util/service/delayed.rs new file mode 100644 index 000000000..58cabb209 --- /dev/null +++ b/util/service/delayed.rs @@ -0,0 +1,151 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! A transport wrapper that withholds the response for a fixed number of +//! polls. Loopback answers on the first poll, so a host test cannot reach +//! a client's not-ready path without this. + +use crate::{AsyncTransport, TransportError}; + +/// Wraps a transport and returns `Ok(None)` for the first `ready_after` +/// polls of each round-trip before forwarding to the inner transport. +pub struct Delayed { + inner: T, + ready_after: usize, + // None while idle, Some(n) after n withheld polls. Keeping idle + // distinct means a poll with nothing started reaches the inner + // transport and gets WrongState, not a spurious Ok(None). + polls: Option, +} + +impl Delayed { + /// `ready_after` is how many polls return `Ok(None)` before the inner + /// transport is polled. Zero passes through on the first poll. + pub const fn new(inner: T, ready_after: usize) -> Self { + Self { + inner, + ready_after, + polls: None, + } + } + + pub fn inner(&self) -> &T { + &self.inner + } +} + +impl AsyncTransport for Delayed { + fn start(&mut self, req: &[u8]) -> Result<(), TransportError> { + self.inner.start(req)?; + self.polls = Some(0); + Ok(()) + } + + fn poll(&mut self, resp: &mut [u8]) -> Result, TransportError> { + if let Some(n) = self.polls + && n < self.ready_after + { + self.polls = Some(n + 1); + return Ok(None); + } + let result = self.inner.poll(resp); + // Anything but "not yet" ends the round-trip, so the next call + // is start and the count begins again. + if !matches!(result, Ok(None)) { + self.polls = None; + } + result + } + + fn cancel(&mut self) -> Result<(), TransportError> { + self.polls = None; + self.inner.cancel() + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::{Dispatch, DispatchError, Loopback}; + + struct Increment { + seen: usize, + } + + impl Dispatch for Increment { + fn dispatch( + &mut self, + request: &[u8], + response: &mut [u8], + ) -> Result { + self.seen += 1; + if response.is_empty() { + return Err(DispatchError::ResponseTooLarge); + } + response[0] = request[0].wrapping_add(1); + Ok(1) + } + } + + fn delayed(ready_after: usize) -> Delayed> { + Delayed::new(Loopback::new(Increment { seen: 0 }), ready_after) + } + + #[test] + fn poll_returns_none_until_the_delay_elapses() { + let mut d = delayed(3); + let mut resp = [0u8; 4]; + + assert_eq!(d.start(&[0x10]), Ok(())); + assert_eq!(d.poll(&mut resp), Ok(None)); + assert_eq!(d.poll(&mut resp), Ok(None)); + assert_eq!(d.poll(&mut resp), Ok(None)); + } + + #[test] + fn poll_after_the_delay_yields_the_response() { + let mut d = delayed(2); + let mut resp = [0u8; 4]; + + assert_eq!(d.start(&[0x10]), Ok(())); + assert_eq!(d.poll(&mut resp), Ok(None)); + assert_eq!(d.poll(&mut resp), Ok(None)); + assert_eq!(d.poll(&mut resp), Ok(Some(1))); + assert_eq!(resp[0], 0x11); + } + + #[test] + fn poll_with_nothing_in_flight_is_wrong_state() { + let mut d = delayed(2); + let mut resp = [0u8; 4]; + + assert_eq!(d.poll(&mut resp), Err(TransportError::WrongState)); + } + + #[test] + fn cancel_resets_the_delay_for_the_next_round_trip() { + let mut d = delayed(2); + let mut resp = [0u8; 4]; + + assert_eq!(d.start(&[0x10]), Ok(())); + assert_eq!(d.poll(&mut resp), Ok(None)); + assert_eq!(d.cancel(), Ok(())); + + // Next round-trip starts the delay count from scratch. + assert_eq!(d.start(&[0x20]), Ok(())); + assert_eq!(d.poll(&mut resp), Ok(None)); + assert_eq!(d.poll(&mut resp), Ok(None)); + assert_eq!(d.poll(&mut resp), Ok(Some(1))); + assert_eq!(resp[0], 0x21); + } + + #[test] + fn a_zero_delay_answers_on_the_first_poll() { + let mut d = delayed(0); + let mut resp = [0u8; 4]; + + assert_eq!(d.start(&[0x10]), Ok(())); + assert_eq!(d.poll(&mut resp), Ok(Some(1))); + assert_eq!(resp[0], 0x11); + } +} diff --git a/util/service/dispatch.rs b/util/service/dispatch.rs new file mode 100644 index 000000000..2f4946d26 --- /dev/null +++ b/util/service/dispatch.rs @@ -0,0 +1,44 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Server end of an IPC round-trip. + +use crate::TransportError; + +/// Why a dispatch produced no response frame at all. +/// +/// Service errors go in the response frame (still `Ok`). This covers +/// the case where even an error frame does not fit. +#[non_exhaustive] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum DispatchError { + /// The response does not fit the buffer the caller gave, not even + /// as an error frame. + ResponseTooLarge, +} + +impl core::fmt::Display for DispatchError { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::ResponseTooLarge => f.write_str("response does not fit the buffer"), + } + } +} + +impl core::error::Error for DispatchError {} + +impl From for TransportError { + fn from(e: DispatchError) -> Self { + match e { + DispatchError::ResponseTooLarge => Self::TooLarge, + } + } +} + +/// Server end: one request frame in, one response frame out. +/// +/// Returns bytes written to `response`. No state between calls beyond +/// what the service itself owns. +pub trait Dispatch { + fn dispatch(&mut self, request: &[u8], response: &mut [u8]) -> Result; +} diff --git a/util/service/lib.rs b/util/service/lib.rs new file mode 100644 index 000000000..0dc8b13fb --- /dev/null +++ b/util/service/lib.rs @@ -0,0 +1,20 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Transport and dispatch traits for IPC services. +//! +//! Three traits: `Transport` (blocking), `AsyncTransport` (split-phase), +//! and `Dispatch` (server). A service defines its wire format in its own +//! crate and plugs into these. + +#![no_std] + +mod delayed; +mod dispatch; +mod loopback; +mod transport; + +pub use delayed::Delayed; +pub use dispatch::{Dispatch, DispatchError}; +pub use loopback::Loopback; +pub use transport::{AsyncTransport, Transport, TransportError}; diff --git a/util/service/loopback.rs b/util/service/loopback.rs new file mode 100644 index 000000000..cad28e97e --- /dev/null +++ b/util/service/loopback.rs @@ -0,0 +1,211 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! In-process loopback transport for host tests. +//! +//! Calls the server's `Dispatch` directly, no kernel. The response is +//! ready on the first `poll`, so this cannot test not-ready handling. + +use crate::{AsyncTransport, Dispatch, Transport, TransportError}; + +/// In-process transport over an owned server. +/// +/// `N` sizes the async response buffer held between `start` and `poll`. +/// The blocking path writes into the caller's buffer directly. +pub struct Loopback { + server: D, + pending: Option, + held: [u8; N], +} + +impl Loopback { + pub const fn new(server: D) -> Self { + Self { + server, + pending: None, + held: [0u8; N], + } + } + + pub fn server(&self) -> &D { + &self.server + } +} + +impl Transport for Loopback { + fn transact(&mut self, req: &[u8], resp: &mut [u8]) -> Result { + if self.pending.is_some() { + return Err(TransportError::WrongState); + } + Ok(self.server.dispatch(req, resp)?) + } +} + +impl AsyncTransport for Loopback { + fn start(&mut self, req: &[u8]) -> Result<(), TransportError> { + if self.pending.is_some() { + return Err(TransportError::WrongState); + } + let len = self.server.dispatch(req, &mut self.held)?; + self.pending = Some(len); + Ok(()) + } + + fn poll(&mut self, resp: &mut [u8]) -> Result, TransportError> { + let Some(len) = self.pending else { + return Err(TransportError::WrongState); + }; + if len > resp.len() { + // The held response is dropped, not kept for a retry: the + // round-trip is over and the next call is start. + self.pending = None; + return Err(TransportError::TooLarge); + } + self.pending = None; + resp[..len].copy_from_slice(&self.held[..len]); + Ok(Some(len)) + } + + fn cancel(&mut self) -> Result<(), TransportError> { + if self.pending.take().is_none() { + return Err(TransportError::WrongState); + } + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::DispatchError; + + /// Increments the first byte of the request. + struct Increment { + seen: usize, + } + + impl Dispatch for Increment { + fn dispatch( + &mut self, + request: &[u8], + response: &mut [u8], + ) -> Result { + self.seen += 1; + if response.is_empty() { + return Err(DispatchError::ResponseTooLarge); + } + response[0] = request[0].wrapping_add(1); + Ok(1) + } + } + + fn loopback() -> Loopback { + Loopback::new(Increment { seen: 0 }) + } + + #[test] + fn blocking_transact_answers_from_the_server() { + let mut lb = loopback(); + let mut resp = [0u8; 4]; + + assert_eq!(lb.transact(&[0x10], &mut resp), Ok(1)); + assert_eq!(resp[0], 0x11); + assert_eq!(lb.server().seen, 1); + } + + #[test] + fn blocking_transact_reports_a_response_buffer_that_does_not_fit() { + let mut lb = loopback(); + let mut resp = [0u8; 0]; + + assert_eq!( + lb.transact(&[0x10], &mut resp), + Err(TransportError::TooLarge) + ); + } + + #[test] + fn async_round_trip_is_ready_on_the_first_poll() { + let mut lb = loopback(); + let mut resp = [0u8; 4]; + + assert_eq!(lb.start(&[0x20]), Ok(())); + assert_eq!(lb.poll(&mut resp), Ok(Some(1))); + assert_eq!(resp[0], 0x21); + } + + #[test] + fn a_second_start_while_one_is_in_flight_is_refused() { + let mut lb = loopback(); + + assert_eq!(lb.start(&[0x20]), Ok(())); + assert_eq!(lb.start(&[0x20]), Err(TransportError::WrongState)); + assert_eq!(lb.server().seen, 1); + } + + #[test] + fn poll_with_nothing_in_flight_is_refused() { + let mut lb = loopback(); + let mut resp = [0u8; 4]; + + assert_eq!(lb.poll(&mut resp), Err(TransportError::WrongState)); + } + + #[test] + fn a_response_that_does_not_fit_ends_the_round_trip() { + let mut lb = loopback(); + let mut small = [0u8; 0]; + let mut resp = [0u8; 4]; + + assert_eq!(lb.start(&[0x20]), Ok(())); + assert_eq!(lb.poll(&mut small), Err(TransportError::TooLarge)); + + assert_eq!(lb.start(&[0x30]), Ok(())); + assert_eq!(lb.poll(&mut resp), Ok(Some(1))); + assert_eq!(resp[0], 0x31); + } + + #[test] + fn cancel_frees_the_transport_for_the_next_request() { + let mut lb = loopback(); + let mut resp = [0u8; 4]; + + assert_eq!(lb.start(&[0x20]), Ok(())); + assert_eq!(lb.cancel(), Ok(())); + assert_eq!(lb.poll(&mut resp), Err(TransportError::WrongState)); + + assert_eq!(lb.start(&[0x40]), Ok(())); + assert_eq!(lb.poll(&mut resp), Ok(Some(1))); + assert_eq!(resp[0], 0x41); + } + + #[test] + fn cancel_with_nothing_in_flight_is_refused() { + let mut lb = loopback(); + + assert_eq!(lb.cancel(), Err(TransportError::WrongState)); + } + + #[test] + fn transact_during_a_started_round_trip_is_refused() { + let mut lb = loopback(); + let mut resp = [0u8; 4]; + + assert_eq!(lb.start(&[0x20]), Ok(())); + assert_eq!( + lb.transact(&[0x30], &mut resp), + Err(TransportError::WrongState) + ); + assert_eq!(lb.poll(&mut resp), Ok(Some(1))); + assert_eq!(resp[0], 0x21); + } + + #[test] + fn a_dispatch_that_cannot_answer_is_reported_at_start() { + let mut lb = Loopback::::new(Increment { seen: 0 }); + + assert_eq!(lb.start(&[0x20]), Err(TransportError::TooLarge)); + // Failed start leaves nothing in flight. + assert_eq!(lb.cancel(), Err(TransportError::WrongState)); + } +} diff --git a/util/service/transport.rs b/util/service/transport.rs new file mode 100644 index 000000000..45335a6df --- /dev/null +++ b/util/service/transport.rs @@ -0,0 +1,66 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Client end of an IPC round-trip. + +/// Why a transport round-trip failed. +/// +/// Service-level errors travel inside the response payload, not here. +#[non_exhaustive] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum TransportError { + /// The channel, syscall, or loopback call failed. + Failed, + /// `start` while in flight, or `poll`/`cancel` with nothing in flight. + WrongState, + /// Request or response does not fit its buffer. + TooLarge, +} + +impl core::fmt::Display for TransportError { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::Failed => f.write_str("transport round-trip failed"), + Self::WrongState => f.write_str("transport is in the wrong state"), + Self::TooLarge => f.write_str("message does not fit the buffer"), + } + } +} + +impl core::error::Error for TransportError {} + +/// One round-trip, caller waits for the response. +pub trait Transport { + fn transact(&mut self, req: &[u8], resp: &mut [u8]) -> Result; +} + +/// One round-trip at a time, split so the caller never blocks. +/// +/// `start` copies the request and returns immediately. `poll` returns +/// `Ok(None)` while the response is outstanding, `Ok(Some(len))` when +/// `resp[..len]` holds the reply. `poll` never waits. +/// +/// One round-trip at a time: `start` while in flight or `poll`/`cancel` +/// with nothing in flight is `WrongState`. Any error from `poll` ends +/// the round-trip and discards the response: a later `poll` cannot +/// retrieve it, and the next call is `start`. +/// +/// A request that is too large for the transport is caught at different +/// points depending on the implementation. A channel transport checks at +/// `start` and returns `TooLarge` before anything goes out. A loopback +/// has no send buffer to overflow, so it hands the request straight to +/// the server, which answers with a protocol error frame at `poll`. +/// Callers need to handle both cases. A response too large for the +/// caller's buffer is always `TooLarge` from `poll`. +/// +/// Registering for wake-up signals needs the concrete transport (a +/// kernel channel has a handle, a loopback does not), so that happens +/// at wiring time, not through this trait. +pub trait AsyncTransport { + fn start(&mut self, req: &[u8]) -> Result<(), TransportError>; + + fn poll(&mut self, resp: &mut [u8]) -> Result, TransportError>; + + /// Abandon the in-flight round-trip. + fn cancel(&mut self) -> Result<(), TransportError>; +} diff --git a/util/sfdp/BUILD.bazel b/util/sfdp/BUILD.bazel new file mode 100644 index 000000000..9fb316773 --- /dev/null +++ b/util/sfdp/BUILD.bazel @@ -0,0 +1,22 @@ +# Licensed under the Apache-2.0 license +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") + +rust_library( + name = "sfdp", + srcs = [ + "lib.rs", + ], + crate_name = "util_sfdp", + edition = "2024", + visibility = ["//visibility:public"], + deps = [ + "//util/error", + ], +) + +rust_test( + name = "sfdp_test", + crate = ":sfdp", +) diff --git a/util/sfdp/lib.rs b/util/sfdp/lib.rs new file mode 100644 index 000000000..376c5f220 --- /dev/null +++ b/util/sfdp/lib.rs @@ -0,0 +1,530 @@ +// Licensed under the Apache-2.0 license +// SPDX-License-Identifier: Apache-2.0 + +//! Target-agnostic JEDEC JESD216 (SFDP) decoder. +//! +//! Pure byte logic: callers perform the SPI reads (opcode `0x5A`) and hand the +//! bytes here. Transcribed from opentitanlib's `spiflash/sfdp.rs`, cross-checked +//! against Zephyr's `jesd216_bfp_*` helpers, with `no_std` byte reads and +//! `util_error` codes in place of `std::io`/`thiserror`. + +#![no_std] +#![feature(adt_const_params)] + +use core::marker::ConstParamTy; + +use util_error::{ + ErrorCode, FLASH_GENERIC_SFDP_INVALID_MEMORY_DENSITY, FLASH_GENERIC_SFDP_INVALID_SIGNATURE, + FLASH_GENERIC_SFDP_NO_VALID_PARAMETER_HEADER_FOUND, FLASH_GENERIC_SFDP_PARAMETERS_TOO_SHORT, + FLASH_GENERIC_SFDP_UNSUPPORTED_HEADER_MAJOR_REV, + FLASH_GENERIC_SFDP_UNSUPPORTED_PARAMS_MAJOR_REV, +}; + +/// SFDP signature: ASCII "SFDP" read little-endian from the first dword. +pub const SFDP_SIGNATURE: u32 = 0x5044_4653; +/// Length in bytes of the SFDP header. +pub const SFDP_HEADER_LEN: usize = 8; +/// Length in bytes of one parameter header. +pub const PARAM_HEADER_LEN: usize = 8; +/// The only header/parameter major revision this decoder understands. +pub const SUPPORTED_MAJOR_REV: u8 = 1; +/// Parameter-header ID (LSB/MSB) of the mandatory JEDEC Basic Flash table. +pub const BFP_ID_LSB: u8 = 0x00; +pub const BFP_ID_MSB: u8 = 0xFF; +/// Maximum number of erase types a BFP table defines (DW8/DW9). +pub const NUM_ERASE_TYPES: usize = 4; + +/// Read a little-endian u32 from a 4-byte window at `off`, or `None` if the +/// window runs past the end of `bytes`. +fn le_u32(bytes: &[u8], off: usize) -> Option { + let end = off.checked_add(4)?; + let arr: [u8; 4] = bytes.get(off..end)?.try_into().ok()?; + Some(u32::from_le_bytes(arr)) +} + +/// Extract a `size`-bit field at `offset` from `word` (size < 32). +const fn field(word: u32, offset: u32, size: u32) -> u32 { + let mask = if size >= 32 { + u32::MAX + } else { + (1u32 << size) - 1 + }; + word.wrapping_shr(offset) & mask +} + +/// The 8-byte SFDP header: signature, revision, and parameter-header count. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct SfdpHeader { + pub signature: u32, + pub minor: u8, + pub major: u8, + /// Number of parameter headers minus one (as stored on the wire). + pub nph: u8, +} + +impl SfdpHeader { + /// Parse the SFDP header from the first [`SFDP_HEADER_LEN`] bytes. + pub fn parse(bytes: &[u8]) -> Result { + if bytes.len() < SFDP_HEADER_LEN { + return Err(FLASH_GENERIC_SFDP_PARAMETERS_TOO_SHORT); + } + let signature = le_u32(bytes, 0).ok_or(FLASH_GENERIC_SFDP_PARAMETERS_TOO_SHORT)?; + if signature != SFDP_SIGNATURE { + return Err(FLASH_GENERIC_SFDP_INVALID_SIGNATURE); + } + let major = bytes[5]; + if major != SUPPORTED_MAJOR_REV { + return Err(FLASH_GENERIC_SFDP_UNSUPPORTED_HEADER_MAJOR_REV); + } + Ok(Self { + signature, + minor: bytes[4], + major, + nph: bytes[6], + }) + } + + /// Number of parameter headers that follow the SFDP header. + pub fn num_param_headers(&self) -> usize { + self.nph as usize + 1 + } +} + +/// One 8-byte parameter header: identifies a table and points at its dwords. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct ParameterHeader { + pub id_lsb: u8, + pub minor: u8, + pub major: u8, + /// Table length in 32-bit dwords. + pub dwords: u8, + /// 24-bit byte offset of the table within SFDP space. + pub pointer: u32, + pub id_msb: u8, +} + +impl ParameterHeader { + /// Parse one parameter header from an 8-byte window. + pub fn parse(bytes: &[u8]) -> Result { + if bytes.len() < PARAM_HEADER_LEN { + return Err(FLASH_GENERIC_SFDP_PARAMETERS_TOO_SHORT); + } + let pointer = u32::from_le_bytes([bytes[4], bytes[5], bytes[6], 0]); + Ok(Self { + id_lsb: bytes[0], + minor: bytes[1], + major: bytes[2], + dwords: bytes[3], + pointer, + id_msb: bytes[7], + }) + } + + /// True for the mandatory JEDEC Basic Flash Parameter table. + pub fn is_basic_flash(&self) -> bool { + self.id_lsb == BFP_ID_LSB && self.id_msb == BFP_ID_MSB + } +} + +/// A single supported erase operation from BFP DW8/DW9. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct EraseType { + /// Erase opcode. + pub opcode: u8, + /// Erased size in bytes (`2^exp`). + pub size: u32, +} + +/// Decoded Basic Flash Parameter table. +/// +/// Holds a borrow of the raw table bytes; accessors decode fields on demand. +#[derive(Clone, Copy, Debug)] +pub struct BasicFlashParams<'a> { + data: &'a [u8], + dwords: usize, +} + +impl<'a> BasicFlashParams<'a> { + /// Parse the BFP table. `data` must hold at least the density dword (DW2). + pub fn parse(data: &'a [u8]) -> Result { + let dwords = data.len() / 4; + if dwords < 2 { + return Err(FLASH_GENERIC_SFDP_PARAMETERS_TOO_SHORT); + } + Ok(Self { data, dwords }) + } + + /// Read the 1-based dword `idx` if present. + fn dword(&self, idx: usize) -> Option { + if idx == 0 || idx > self.dwords { + return None; + } + le_u32(self.data, (idx - 1) * 4) + } + + /// Device density in bits, decoded from DW2 (JESD216 rule). + pub fn density_bits(&self) -> Result { + let dw2 = self + .dword(2) + .ok_or(FLASH_GENERIC_SFDP_PARAMETERS_TOO_SHORT)?; + if dw2 & (1 << 31) != 0 { + let exp = field(dw2, 0, 31); + 1u64.checked_shl(exp) + .ok_or(FLASH_GENERIC_SFDP_INVALID_MEMORY_DENSITY) + } else { + Ok(1u64 + dw2 as u64) + } + } + + /// Device capacity in bytes (density / 8). + pub fn capacity_bytes(&self) -> Result { + Ok(self.density_bits()? / 8) + } + + /// Programmable page size in bytes from DW11; defaults to 256 pre-JESD216A. + pub fn page_size(&self) -> u32 { + match self.dword(11) { + Some(dw11) => 1u32.checked_shl(field(dw11, 4, 4)).unwrap_or(256), + None => 256, + } + } + + /// Decode erase type `idx` (1..=4) from DW8/DW9; `None` if unused/absent. + pub fn erase_type(&self, idx: usize) -> Option { + if idx == 0 || idx > NUM_ERASE_TYPES { + return None; + } + // Types 1,2 live in DW8; types 3,4 in DW9. Even indices are the upper half. + let dw = self.dword(8 + (idx - 1) / 2)?; + let half = if idx % 2 == 0 { dw >> 16 } else { dw }; + let exp = (half & 0xFF) as u8; + if exp == 0 { + return None; + } + let size = 1u32.checked_shl(exp as u32)?; + Some(EraseType { + opcode: ((half >> 8) & 0xFF) as u8, + size, + }) + } + + /// Smallest supported erase (the erasable "sector"), if any. + pub fn smallest_erase(&self) -> Option { + (1..=NUM_ERASE_TYPES) + .filter_map(|i| self.erase_type(i)) + .min_by_key(|e| e.size) + } + + /// Largest supported erase (the erasable "block"), if any. + pub fn largest_erase(&self) -> Option { + (1..=NUM_ERASE_TYPES) + .filter_map(|i| self.erase_type(i)) + .max_by_key(|e| e.size) + } +} + +/// Geometry a controller needs to configure a flash device, all derived from +/// SFDP. Fields SFDP does not encode (e.g. desired clock) are the caller's. +#[derive(Clone, Copy, Debug, PartialEq, Eq, ConstParamTy)] +pub struct FlashGeometry { + pub capacity_bytes: u64, + pub page_size: u32, + pub sector_size: u32, + pub block_size: u32, +} + +/// Locate the JEDEC Basic Flash parameter header, given the already-read SFDP +/// `header` (>= 8 bytes) and the `param_headers` block (`num_param_headers` * 8 +/// bytes). The returned `pointer`/`dwords` tell the caller what BFP bytes to +/// read next; this is pure decode, no I/O. +pub fn find_bfp_header(header: &[u8], param_headers: &[u8]) -> Result { + let hdr = SfdpHeader::parse(header)?; + let count = hdr.num_param_headers(); + if param_headers.len() < count * PARAM_HEADER_LEN { + return Err(FLASH_GENERIC_SFDP_PARAMETERS_TOO_SHORT); + } + for i in 0..count { + let window = param_headers + .get(i * PARAM_HEADER_LEN..) + .ok_or(FLASH_GENERIC_SFDP_PARAMETERS_TOO_SHORT)?; + let ph = ParameterHeader::parse(window)?; + if ph.is_basic_flash() { + // Rev-check only the table this decoder reads. + if ph.major != SUPPORTED_MAJOR_REV { + return Err(FLASH_GENERIC_SFDP_UNSUPPORTED_PARAMS_MAJOR_REV); + } + return Ok(ph); + } + } + Err(FLASH_GENERIC_SFDP_NO_VALID_PARAMETER_HEADER_FOUND) +} + +/// Assemble [`FlashGeometry`] from a parsed BFP table. +pub fn geometry_from_bfp(bfp: &BasicFlashParams) -> Result { + let capacity_bytes = bfp.capacity_bytes()?; + let sector = bfp + .smallest_erase() + .ok_or(FLASH_GENERIC_SFDP_NO_VALID_PARAMETER_HEADER_FOUND)?; + let block = bfp + .largest_erase() + .ok_or(FLASH_GENERIC_SFDP_NO_VALID_PARAMETER_HEADER_FOUND)?; + Ok(FlashGeometry { + capacity_bytes, + page_size: bfp.page_size(), + sector_size: sector.size, + block_size: block.size, + }) +} + +/// Decode [`FlashGeometry`] from a raw SFDP image read from address 0. +/// +/// Walks the header, the parameter-header directory, and the Basic Flash +/// Parameter table by indexing into `image`, so the caller performs exactly one +/// SPI read (opcode `0x5A`) of a sufficiently large blob. Out-of-range pointers +/// and short tables return an error rather than panicking, so over-reading SFDP +/// space is safe. +pub fn decode_geometry(image: &[u8]) -> Result { + let header = image + .get(0..SFDP_HEADER_LEN) + .ok_or(FLASH_GENERIC_SFDP_PARAMETERS_TOO_SHORT)?; + let params = image + .get(SFDP_HEADER_LEN..) + .ok_or(FLASH_GENERIC_SFDP_PARAMETERS_TOO_SHORT)?; + let bfp = find_bfp_header(header, params)?; + let start = bfp.pointer as usize; + let end = start + .checked_add(bfp.dwords as usize * 4) + .ok_or(FLASH_GENERIC_SFDP_PARAMETERS_TOO_SHORT)?; + let table = image + .get(start..end) + .ok_or(FLASH_GENERIC_SFDP_PARAMETERS_TOO_SHORT)?; + geometry_from_bfp(&BasicFlashParams::parse(table)?) +} + +#[cfg(test)] +mod tests { + use super::*; + + // Each fixture below is a hand-built SFDP image whose every decoded field is + // justified against JEDEC JESD216 (the SFDP standard) + // Only the DWORDs this decoder reads are meaningful + // (DW2 density, DW8/DW9 erase types, DW11 page size); DWORDs it never touches + // are left zero. Encodings used below, per JESD216 Basic Flash Parameter table: + // * DW2 density: if bit 31 is clear, density_bits = value + 1 (linear form); + // if bit 31 is set, density_bits = 1 << (value & 0x7FFF_FFFF) (power-of-two). + // capacity_bytes = density_bits / 8. + // * DW11 page size: bits [7:4] are an exponent; page_size = 1 << exp. Absent + // (table shorter than 11 dwords) it defaults to 256 (pre-JESD216A rule). + // * DW8/DW9 erase types: each 16-bit half is `opcode << 8 | size_exponent`, + // erased size = 1 << exponent; exponent 0 marks an unused slot. Smallest + // erase -> sector_size, largest -> block_size. + + /// Write the 8-byte SFDP header: signature, revision, parameter-header count. + fn write_header(buf: &mut [u8], nph_minus_1: u8) { + buf[0..4].copy_from_slice(&SFDP_SIGNATURE.to_le_bytes()); + buf[4] = 0x06; // minor rev (not decoded beyond major) + buf[5] = SUPPORTED_MAJOR_REV; // major rev = 1 + buf[6] = nph_minus_1; // number of parameter headers minus one + buf[7] = 0xFF; // reserved + } + + /// Build one 8-byte parameter header pointing at `dwords` of table at `ptr`. + fn param_header(id_lsb: u8, id_msb: u8, dwords: u8, ptr: u32) -> [u8; 8] { + let p = ptr.to_le_bytes(); + [ + id_lsb, + 0x06, + SUPPORTED_MAJOR_REV, + dwords, + p[0], + p[1], + p[2], + id_msb, + ] + } + + /// Write little-endian `dwords` into `buf` starting at byte offset `at`. + fn put_dwords(buf: &mut [u8], at: usize, dwords: &[u32]) { + for (i, w) in dwords.iter().enumerate() { + buf[at + i * 4..at + i * 4 + 4].copy_from_slice(&w.to_le_bytes()); + } + } + + #[test] + fn linear_16mib_page256_three_erases() { + // 128 Mbit part, linear density: DW2 = 128 Mbit - 1 = 0x07FF_FFFF -> + // capacity 16 MiB. 256-byte page, 4K/32K/64K erases (common W25Q128 shape). + let mut img = [0u8; 60]; + write_header(&mut img, 0); // one parameter header + img[8..16].copy_from_slice(¶m_header(BFP_ID_LSB, BFP_ID_MSB, 11, 16)); + put_dwords( + &mut img, + 16, + &[ + 0, + 0x07FF_FFFF, // DW2 density: 128 Mbit - 1 (linear) + 0, + 0, + 0, + 0, + 0, + 0x520F_200C, // DW8 type1 4K/0x20, type2 32K/0x52 + 0x0000_D810, // DW9 type3 64K/0xD8, type4 unused + 0, + 0x0000_0080, // DW11 page exp 8 -> 256 + ], + ); + let g = decode_geometry(&img).unwrap(); + assert_eq!(g.capacity_bytes, 16 * 1024 * 1024); + assert_eq!(g.page_size, 256); + assert_eq!(g.sector_size, 4096); // smallest erase + assert_eq!(g.block_size, 65536); // largest erase + } + + #[test] + fn pow2_4gbit_page512_two_erases() { + // 4 Gbit part exercising the power-of-two density form: DW2 bit 31 set, + // exp = 32 -> 2^32 bits = 512 MiB. Varies the page size (512) and omits + // the 32K erase, so DW8's upper half is the "unused" slot (exponent 0) + // between two real types. + let mut img = [0u8; 60]; + write_header(&mut img, 0); + img[8..16].copy_from_slice(¶m_header(BFP_ID_LSB, BFP_ID_MSB, 11, 16)); + put_dwords( + &mut img, + 16, + &[ + 0, + 0x8000_0020, // DW2 density: bit31 set, exp 32 -> 4 Gbit + 0, + 0, + 0, + 0, + 0, + 0x0000_200C, // DW8 type1 4K/0x20, type2 unused + 0x0000_D810, // DW9 type3 64K/0xD8, type4 unused + 0, + 0x0000_0090, // DW11 page exp 9 -> 512 + ], + ); + let g = decode_geometry(&img).unwrap(); + assert_eq!(g.capacity_bytes, 512 * 1024 * 1024); + assert_eq!(g.page_size, 512); + assert_eq!(g.sector_size, 4096); + assert_eq!(g.block_size, 65536); + } + + #[test] + fn skips_vendor_header_and_defaults_page() { + // 32 Mbit part behind a non-BFP vendor header: the decoder must skip + // header 0, find the BFP in header 1, and follow its 0x20 pointer. The BFP + // is only 9 dwords (no DW11), so page size falls back to the default 256. + let mut img = [0u8; 72]; + write_header(&mut img, 1); // two parameter headers + img[8..16].copy_from_slice(¶m_header(0x81, 0x00, 4, 0)); // vendor, ignored + img[16..24].copy_from_slice(¶m_header(BFP_ID_LSB, BFP_ID_MSB, 9, 0x20)); + put_dwords( + &mut img, + 0x20, + &[ + 0, + 0x01FF_FFFF, // DW2 density: 32 Mbit - 1 -> 4 MiB + 0, + 0, + 0, + 0, + 0, + 0x520F_200C, // DW8 type1 4K/0x20, type2 32K/0x52 + 0x0000_D810, // DW9 type3 64K/0xD8 + ], + ); + let g = decode_geometry(&img).unwrap(); + assert_eq!(g.capacity_bytes, 4 * 1024 * 1024); + assert_eq!(g.page_size, 256); // no DW11 -> default + assert_eq!(g.sector_size, 4096); + assert_eq!(g.block_size, 65536); + } + + #[test] + fn vendor_header_unknown_rev_does_not_block_bfp() { + // Same layout as above, but the vendor header reports a major rev this + // decoder does not know. It is never decoded, so the BFP behind it must + // still be found. + let mut img = [0u8; 72]; + write_header(&mut img, 1); + img[8..16].copy_from_slice(¶m_header(0x81, 0x00, 4, 0)); + img[10] = 2; // vendor header major rev != SUPPORTED_MAJOR_REV + img[16..24].copy_from_slice(¶m_header(BFP_ID_LSB, BFP_ID_MSB, 9, 0x20)); + let dwords = [0, 0x01FF_FFFF, 0, 0, 0, 0, 0, 0x520F_200C, 0x0000_D810]; + put_dwords(&mut img, 0x20, &dwords); + let g = decode_geometry(&img).unwrap(); + assert_eq!(g.capacity_bytes, 4 * 1024 * 1024); + assert_eq!(g.sector_size, 4096); + } + + #[test] + fn bfp_header_unknown_rev_rejected() { + let mut img = [0u8; 60]; + write_header(&mut img, 0); + img[8..16].copy_from_slice(¶m_header(BFP_ID_LSB, BFP_ID_MSB, 9, 16)); + img[10] = 2; // BFP header major rev != SUPPORTED_MAJOR_REV + assert_eq!( + find_bfp_header(&img[0..8], &img[8..16]), + Err(FLASH_GENERIC_SFDP_UNSUPPORTED_PARAMS_MAJOR_REV) + ); + } + + #[test] + fn bad_signature_rejected() { + let mut img = [0u8; 60]; + write_header(&mut img, 0); + img[0] = 0; // corrupt "SFDP" + assert_eq!( + SfdpHeader::parse(&img[0..8]), + Err(FLASH_GENERIC_SFDP_INVALID_SIGNATURE) + ); + } + + #[test] + fn unsupported_major_rev_rejected() { + let mut img = [0u8; 60]; + write_header(&mut img, 0); + img[5] = 2; // major rev != SUPPORTED_MAJOR_REV + assert_eq!( + SfdpHeader::parse(&img[0..8]), + Err(FLASH_GENERIC_SFDP_UNSUPPORTED_HEADER_MAJOR_REV) + ); + } + + #[test] + fn header_too_short_rejected() { + assert_eq!( + SfdpHeader::parse(&[0u8; 4]), + Err(FLASH_GENERIC_SFDP_PARAMETERS_TOO_SHORT) + ); + } + + #[test] + fn no_bfp_header_rejected() { + let mut img = [0u8; 60]; + write_header(&mut img, 0); + img[8..16].copy_from_slice(¶m_header(0x81, 0x00, 4, 16)); // vendor only + assert_eq!( + find_bfp_header(&img[0..8], &img[8..16]), + Err(FLASH_GENERIC_SFDP_NO_VALID_PARAMETER_HEADER_FOUND) + ); + } + + #[test] + fn invalid_pow2_density_rejected() { + // DW2 bit 31 set with exponent >= 64 is not a representable density. + let mut img = [0u8; 60]; + write_header(&mut img, 0); + img[8..16].copy_from_slice(¶m_header(BFP_ID_LSB, BFP_ID_MSB, 2, 16)); + put_dwords(&mut img, 16, &[0, 0x8000_0040]); // exp 64 + assert_eq!( + decode_geometry(&img), + Err(FLASH_GENERIC_SFDP_INVALID_MEMORY_DENSITY) + ); + } +} diff --git a/workflows.json b/workflows.json index be73c1917..08c439f85 100644 --- a/workflows.json +++ b/workflows.json @@ -117,6 +117,26 @@ "//target/veer/..." ] }, + { + "name": "caliptra_fpga_build", + "build_config": { + "name": "caliptra_fpga_build_config", + "description": "Build (do not run) the Caliptra MCU fpga target image. Catches fpga cfg/build-wiring regressions without requiring lab hardware; actually running it needs a VCK190 board (see //target/veer/unittest_runner:fpga_test, tagged manual).", + "build_type": "bazel", + "args": [ + "--keep_going", + "--config=k_veer", + "--//target/veer:target_type=fpga" + ], + "driver_options": { + "@type": "pw.build.proto.BazelDriverOptions", + "no_test": true + } + }, + "targets": [ + "//target/veer/unittest_runner:fpga_test" + ] + }, { "name": "earlgrey_qemu_tests", "build_config": { @@ -204,7 +224,8 @@ "ci_tests", "ast10x0_qemu_tests", "earlgrey_qemu_tests", - "caliptra_emulator_tests" + "caliptra_emulator_tests", + "caliptra_fpga_build" ] }, {