bmcd
20 months agofix cargo-cross
Sven Rademakers [Thu, 12 Oct 2023 09:39:07 +0000 (10:39 +0100)]
fix cargo-cross

fix the missing Openssl dependency that caused a build failure if cargo
cross was used. Updated the README to reflect the changes

20 months agoGH-52 implemented os_update
Sven Rademakers [Wed, 11 Oct 2023 09:37:38 +0000 (10:37 +0100)]
GH-52 implemented os_update

Added logic to execute a os_update

20 months agostreaming_data_service: removed receiverReader
Sven Rademakers [Wed, 11 Oct 2023 09:31:51 +0000 (10:31 +0100)]
streaming_data_service: removed receiverReader

* Removed our custom receiverReader and replaced it with a tokio variant
* moved transfer_context to its own file
* amount of bytes written is now returned in the status object of
  `TransferContext`
* other small improvements

20 months agofirmware_runner: resolve technical debt pt.3
Sven Rademakers [Mon, 9 Oct 2023 14:46:44 +0000 (15:46 +0100)]
firmware_runner: resolve technical debt pt.3

Prevent tokio::io::copy from stalling by making the reader exhaustive

20 months agoUpdate README.md
Sven Rademakers [Tue, 10 Oct 2023 12:23:16 +0000 (13:23 +0100)]
Update README.md

remove the package parameter. which is obsoleted now.

20 months agopersistency: during shutdown only write if changed
Sven Rademakers [Tue, 10 Oct 2023 11:22:37 +0000 (12:22 +0100)]
persistency: during shutdown only write if changed

Only write the binary persistency file if it was actually dirty

20 months agofirmware_runner: resolve technical debt pt.2
Sven Rademakers [Mon, 9 Oct 2023 14:46:44 +0000 (15:46 +0100)]
firmware_runner: resolve technical debt pt.2

* In this commit the custom copy function is replaced with a
plain `tokio::io::copy`. This function is more efficient as in that it
can copy with arbitrary read/write sizes and doesnt enforce
`.write_exact`.
* An `CrCReader` is introduced that hooks into the `AsyncRead` reads to
  calculate a crc checksum.
* This copy flow can still be aborted with an "cancel" signal

20 months agofirmware_runner: resolve technical debt
Sven Rademakers [Sat, 7 Oct 2023 10:04:01 +0000 (11:04 +0100)]
firmware_runner: resolve technical debt

Condensed writing/reading mechanism inside `firmware_runner` to one
function, `copy_with_crc`. Next iteration a better implementation is
desired for reporting process.

20 months agorestructure bmcd workspace
Sven Rademakers [Fri, 6 Oct 2023 15:38:24 +0000 (16:38 +0100)]
restructure bmcd workspace

* flattened the workspace by squasing `tpi_rs` into `bmcd`. `tpi_rs` was
  the remainders of a library that was statically compiled into the
  legacy bmc C application.
* moved around some files. Tried to group modules and files by feature.

20 months agoremove c_interface module
Sven Rademakers [Fri, 6 Oct 2023 14:48:09 +0000 (15:48 +0100)]
remove c_interface module

This module was an temporary glue layer in order to develop new code in
the legacy bmc binary. Since we have a new bmc daemon, this code can be
buried.

20 months ago flash_service: Generalize logic
Sven Rademakers [Fri, 6 Oct 2023 10:42:36 +0000 (11:42 +0100)]
 flash_service: Generalize logic

 This commit extracts flash related logic out of the flash_service
 until we are left with a generic service that can receive large
 binary data.

20 months agofix regression in test-suite
Sven Rademakers [Thu, 5 Oct 2023 09:54:31 +0000 (10:54 +0100)]
fix regression in test-suite

20 months agopersistency: maturing component
Sven Rademakers [Mon, 2 Oct 2023 10:10:47 +0000 (11:10 +0100)]
persistency: maturing component

* Implemented a fallback mechanism when the database binary is
  corrupted. In this case the binary will be omitted and overwritten
  with an default store on successive write-backs of the store to disk
* Improved fatal error messages on erroneous `.get()` and `.set()`
  calls.
* Created a new config file item: `write_timeout`. Controls the write
  timeout of the persistency. More information inside
  `default_config.yaml`

20 months agoCI: add cargo-deny
Sven Rademakers [Mon, 2 Oct 2023 15:39:00 +0000 (16:39 +0100)]
CI: add cargo-deny

* Verify use of FOSS licenses.
* added copyright header to **/*.rs files

20 months agoMerge pull request #53 from turing-machines/feature/serial
Ruslan Akbashev [Wed, 4 Oct 2023 15:12:59 +0000 (19:12 +0400)]
Merge pull request #53 from turing-machines/feature/serial

tpi_rs: add serial handlers

20 months agoMerge branch 'master' into feature/serial
Ruslan Akbashev [Wed, 4 Oct 2023 15:04:43 +0000 (19:04 +0400)]
Merge branch 'master' into feature/serial

20 months ago Gh-10 rework pin controller
Sven Rademakers [Tue, 1 Aug 2023 10:05:01 +0000 (11:05 +0100)]
 Gh-10 rework pin controller

Rework to accommodate changes in the Linux subsystem by #49.

20 months agoserial: rework the ownership
Sven Rademakers [Fri, 29 Sep 2023 13:53:51 +0000 (14:53 +0100)]
serial: rework the ownership

The serial workers synchronize communication by:
* a channel for writes.
* shares the 'RingBuffer' implementation for reads.

21 months ago Implement token and basic authentication
Sven Rademakers [Tue, 19 Sep 2023 07:17:42 +0000 (08:17 +0100)]
 Implement token and basic authentication

NOTE: this Service is not resilient against brute-force attacks in such
it does not implement rate limiting on authentication nor authorization
requests.

* Uses Linux users to authorize requests.
* no authorization roles or scopes are implemented yet.
* token based authentication is implemented with the Redfish session
  login authentication in mind. That is, when we would implement Redfish
  it should be easy to append the current implementation
* token timeout gets reset on every use of the token.
* basic authentication: The authentication service expects a
  'Authorization' header containing the following format: 'Basic <base64
  encoded as <username:password>>'

21 months agorun `cargo fmt`
Ruslan Akbashev [Mon, 25 Sep 2023 14:38:49 +0000 (18:38 +0400)]
run `cargo fmt`

21 months agoserial: add `encoding` parameter
Ruslan Akbashev [Mon, 25 Sep 2023 14:38:49 +0000 (18:38 +0400)]
serial: add `encoding` parameter

21 months agoserial: move `RingBuffer` to its own module
Ruslan Akbashev [Mon, 25 Sep 2023 14:38:49 +0000 (18:38 +0400)]
serial: move `RingBuffer` to its own module

21 months agoflash_service: stability and improvements
Sven Rademakers [Wed, 20 Sep 2023 10:13:32 +0000 (11:13 +0100)]
flash_service: stability and improvements

* added a API call so a client can ask the current status of the
  `FlashService`
* fixes regarding cancelling of the node flash
* cleanup of code

21 months agoNode reset: implement simulated reset
Sven Rademakers [Thu, 21 Sep 2023 14:12:27 +0000 (15:12 +0100)]
Node reset: implement simulated reset

Node reset GPIO's are not connected on the board. Therefore remove
related logic and implement a simulated reset by toggling the power of
a given node.

21 months agolegacy API: support USB routes to BMC
Sven Rademakers [Wed, 20 Sep 2023 10:16:12 +0000 (11:16 +0100)]
legacy API: support USB routes to BMC

21 months agoadded "usb_boot" operation
Sven Rademakers [Fri, 15 Sep 2023 12:29:43 +0000 (13:29 +0100)]
added "usb_boot" operation

* split the usbboot pin functionality from the usb configuration and
  gave it its separate routine call.
* usb_boot pin is now exposed over the API via opt=set&type=usb_boot

21 months agotpi_rs: add serial handlers
Ruslan Akbashev [Wed, 13 Sep 2023 12:44:03 +0000 (16:44 +0400)]
tpi_rs: add serial handlers

Fixes #22

21 months agoexpose version info over port 80
Sven Rademakers [Fri, 15 Sep 2023 13:09:18 +0000 (14:09 +0100)]
expose version info over port 80

21 months agoadded node reset to API
Sven Rademakers [Fri, 15 Sep 2023 13:04:51 +0000 (14:04 +0100)]
added node reset to API

21 months agobmcd: expose API "info" endpoint
Sven Rademakers [Fri, 15 Sep 2023 08:48:18 +0000 (09:48 +0100)]
bmcd: expose API "info" endpoint

This is a poor man's way to introduce a versioning in the 'BMC API'.
Version info can be retrieved by calling "/bmc/api/info". This endpoint
is exposed both on the HTTP and HTTPS port.

Secondly this commit contains some small updates on the response
handling in the legacy module.

21 months agolegacy_response: use Cow
Sven Rademakers [Fri, 15 Sep 2023 07:58:29 +0000 (08:58 +0100)]
legacy_response: use Cow

Small code improvement to use std's Cow instead of our own 'Owned' enum
variant.

21 months agoenable tls
Sven Rademakers [Tue, 5 Sep 2023 19:52:26 +0000 (20:52 +0100)]
enable tls

TLS is added and enforced. the bmcd requires a `--certificate` and
`--private-key` argument in order to run.

A server is binded onto the old `80` port, that will redirect traffic to
443

21 months agoapp_persistency: improvements and review comments
Sven Rademakers [Thu, 14 Sep 2023 10:02:39 +0000 (11:02 +0100)]
app_persistency: improvements and review comments

21 months agoapp_persistency: update documentation
Sven Rademakers [Mon, 11 Sep 2023 10:59:11 +0000 (11:59 +0100)]
app_persistency: update documentation

21 months agoapp_persistency: new implementation
Sven Rademakers [Thu, 7 Sep 2023 13:37:51 +0000 (14:37 +0100)]
app_persistency: new implementation

This commit aims to improve the internal bmcd persistency:
* Its more lean, no sqlite implementation anymore
* Implemented a writeback mechanism that tries to reduce the amount of
  writes to the file system (can be disabled all together)
* read cache

The implementation is based on the following assumptions:
* This store will only be used for internal application state.
* We expect that it will contain a maximum of approximately 10 settings.
* Settings are not updated frequently. Users will setup their system
  once and no changes can occur in weeks .

The solution aims to reduce the amount of writes to the filesystem.
Secondly, no additional database driver is used. The key/value store
gets written as raw bytes. All to make sure the actual space on the
filesystem stays as small as possible.

Since the key/value store is not expected to go over 1 LEB, the whole
key/value store gets written on a update, even when only one value
changed.

furthermore the api of the persistency store got extended,
differentiating between try_* and get/set. Non-try functions will panic
on serialization errors, or when the given key is not registered.

A persistency component gets initialized using the `PersistencyBuilder`.
It enforces users to declare all the keys that are used by the
application. This is to make sure to limit the possibilities of using
wrong keys.

Note 1: There is no migration implemented from the old sqlite implementation.
This means that users will lose their settings when upgrading to this
version. At the moment of writing, there are only 2 low impact key/value
pairs, which does not justify writing migration code.

Note 2: There is no protection implemented for trans serializing
different types. Its up to the developer to make sure to use the correct
data types.

this commit fixes #107, https://github.com/turing-machines/BMC-Firmware/issues/107

21 months agodependabot: disable until further notice
Sven Rademakers [Tue, 12 Sep 2023 07:32:17 +0000 (08:32 +0100)]
dependabot: disable until further notice

Currently its creating more noise than it actually helps to update
dependencies. We will continue updating them manually

21 months ago Cargo.toml: update dependencies
Sven Rademakers [Mon, 11 Sep 2023 15:32:57 +0000 (16:32 +0100)]
 Cargo.toml: update dependencies

 * set MSRV to 1.70.0
 * updated .lock file
 * moved crate.io patch to top-level Cargo.toml

21 months agobmcd: listen on IPv6 & increase KeepAlive
Sven Rademakers [Wed, 6 Sep 2023 14:24:50 +0000 (15:24 +0100)]
bmcd: listen on IPv6 & increase KeepAlive

Prevent the TCP connection from closing during a flashing process. When
the receive buffer is full, byte chunk requests will be blocked until
new space becomes available. This caused connection resets, resulting in
an abort of the flashing process. This happens, for example, during the
configuration phase of the node which typically takes longer as 5 sec.
default keep-alive for HTTP1.1 was 5 sec. This CL align sets the
keep-alive timeout to the value of the underlaying OS.

21 months agorockusb_fwudate: Update bootmode detection
Sven Rademakers [Fri, 8 Sep 2023 06:45:31 +0000 (07:45 +0100)]
rockusb_fwudate: Update bootmode detection

After discussion with the maintainers, decided is to keep the Bootmode
detection logic local to this project. There is no generic solution
possible that works for all rockusb devices. Detection is based on
behavior of the loader that is installed on the rockchip device, no
spec exists that guarantees a certain behavior of this loader.
see https://github.com/collabora/rockchiprs/pull/22

Updated the rockusb dependency to the main branch, as one of the latest
patches are required.

21 months agoflash_application: progress printing improvements
Sven Rademakers [Wed, 6 Sep 2023 09:21:38 +0000 (10:21 +0100)]
flash_application: progress printing improvements

21 months agoApply suggestions from code review
Sven Rademakers [Mon, 4 Sep 2023 15:42:24 +0000 (16:42 +0100)]
Apply suggestions from code review

21 months agoincorporate review comments
Sven Rademakers [Mon, 4 Sep 2023 15:36:16 +0000 (16:36 +0100)]
incorporate review comments

21 months agoflash_service: implement receive timeout.
Sven Rademakers [Fri, 1 Sep 2023 09:52:45 +0000 (10:52 +0100)]
flash_service: implement receive timeout.

Given a aborted file transfer. If a client wants to do a new transfer
request, reset the flash service only when a given timeout is reached.
Its assumed that the aborted transfer will never complete anymore after
this timeout.

21 months agolegacy_response: dont encode status code in message
Sven Rademakers [Fri, 1 Sep 2023 08:23:20 +0000 (09:23 +0100)]
legacy_response: dont encode status code in message

21 months ago cancel flash_service
Sven Rademakers [Fri, 1 Sep 2023 07:51:44 +0000 (08:51 +0100)]
 cancel flash_service

 Add cancel token to abort a flash operation to one of the nodes. the
 process gets interrupted, and some cleanup is performed if necessary.

21 months agoflash_service: fixes
Sven Rademakers [Fri, 1 Sep 2023 07:06:15 +0000 (08:06 +0100)]
flash_service: fixes

* make use of the actix-web router for "flashing" requests. Prevents
  false positives while routing
* fixed overflow in progress printer

21 months agoFlashService: fixes
Sven Rademakers [Wed, 30 Aug 2023 12:55:46 +0000 (13:55 +0100)]
FlashService: fixes

21 months agolegacy_response: impl actix responder
Sven Rademakers [Wed, 30 Aug 2023 12:54:53 +0000 (13:54 +0100)]
legacy_response: impl actix responder

21 months agoio.rs: implemented a ReceiverReader
Sven Rademakers [Mon, 28 Aug 2023 13:29:07 +0000 (14:29 +0100)]
io.rs: implemented a ReceiverReader

This struct wraps a receiver object and exposes the `AsyncRead` trait
for it. This is the last piece that connects the `FlashService` with the
 actual firmware writer.

21 months agoflash_service: implement file streaming handler
Sven Rademakers [Sat, 26 Aug 2023 06:25:26 +0000 (07:25 +0100)]
flash_service: implement file streaming handler

Added a handler in the 'bmcd' that:
* receives a firmware image over the http API endpoint
* buffers these image chunks
* async write chunks to a given node

22 months agoupdate README.md
Sven Rademakers [Tue, 29 Aug 2023 09:32:09 +0000 (10:32 +0100)]
update README.md

Added building from repo section

22 months agoc_interface: fix omitted start of event_listener
Sven Rademakers [Mon, 28 Aug 2023 08:37:32 +0000 (09:37 +0100)]
c_interface: fix omitted start of event_listener

22 months agowrite_to_device: improvements on read & write img
Sven Rademakers [Sat, 26 Aug 2023 06:06:45 +0000 (07:06 +0100)]
write_to_device: improvements on read & write img

enforced 2 requirements:
* Only full buffers are read and written to a device
* The exact amount of image bytes are written. This implies that the
  buffer size of the last write will be trimmed.

Note: there is an implicit requiment hidden in this code. The buffersize
that is written needs to be a multiple of the sector size of the device
that is written to.

22 months ago Concentrate flashing related code
Sven Rademakers [Sat, 26 Aug 2023 04:59:07 +0000 (05:59 +0100)]
 Concentrate flashing related code

 This is an attempt to resolve some technical debt related to flashing
 images to nodes. Split off the `flash_node` to a new file called
 `flash_application`. Moved flashing related definitions and datatypes
 to firmware_update.

22 months agointo_legacy_response: move out to seperate file
Sven Rademakers [Wed, 23 Aug 2023 12:45:06 +0000 (13:45 +0100)]
into_legacy_response: move out to seperate file

22 months agoCreate README.md
Sven Rademakers [Wed, 23 Aug 2023 06:56:27 +0000 (07:56 +0100)]
Create README.md

22 months agobmcd: IntoLegacyResponse
Sven Rademakers [Tue, 22 Aug 2023 14:01:49 +0000 (15:01 +0100)]
bmcd: IntoLegacyResponse

Implemented boilerplate code to transform `anyhow::Result` and
`HttpResponses` into `LegacyResponses`. The goal of the `LegacyResponse`
type is to enforce a specific layout of the response body. Because
legacy responders must specify a `LegacyResponse` before it gets
transformed into a `HttpResponse`.

Changed API port from 8080 to 80. The former is a more industry comform
port. However to not break legacy tools we are stuck with port 80 port
for the `legacy API`

Refactored out the Arc wrapper around `BmcApplication`. moved the
event_listener to a seperate module. This should make the relation
between the `EventListener` and `BmcApplication` more visible.

22 months agocalculate_checksum: fix bug
Sven Rademakers [Mon, 21 Aug 2023 17:04:09 +0000 (18:04 +0100)]
calculate_checksum: fix bug

This issue occurs when the written image size is not equal to a product
of the internal read buffer size. Improved the code so that the exact
amount of bytes are read when calculating a checksum. This means the
that the last read will be trimmed to match the file size. Instead of
reading a full buffer.

22 months agobugfix: power led missing
Sven Rademakers [Fri, 18 Aug 2023 09:27:04 +0000 (10:27 +0100)]
bugfix: power led missing

fixes #115, https://github.com/turing-machines/BMC-Firmware/issues/115

22 months agobmcd: log exit
Sven Rademakers [Mon, 21 Aug 2023 11:40:13 +0000 (12:40 +0100)]
bmcd: log exit

22 months agofirmware_update: remove opt-out features
Sven Rademakers [Mon, 21 Aug 2023 11:17:59 +0000 (12:17 +0100)]
firmware_update: remove opt-out features

22 months agorockusb_fwudate: remove unneeded const generic
Sven Rademakers [Wed, 16 Aug 2023 09:01:28 +0000 (10:01 +0100)]
rockusb_fwudate: remove unneeded const generic

Small code change with minor effect

22 months agoStdTransportWrapper: rename variables
Sven Rademakers [Wed, 16 Aug 2023 08:07:18 +0000 (09:07 +0100)]
StdTransportWrapper: rename variables

* Rename the buffer variables related to AsyncRead to make the code better
readable.
* Convert the buffer.try_borrow_mut into a borrow_mut. As Self is a
  mutable variable, we cannot endup in a scenario where the buffer is
  already borrowed by another call.
* Added small code comments on the Transport trait objects

22 months agoStdFwUpdateTransport: fix clippy errors
Sven Rademakers [Tue, 15 Aug 2023 13:53:52 +0000 (14:53 +0100)]
StdFwUpdateTransport: fix clippy errors

22 months agoStdTransportWrapper: fix buffer copy
Sven Rademakers [Tue, 15 Aug 2023 11:26:05 +0000 (12:26 +0100)]
StdTransportWrapper: fix buffer copy

Secondly, the `calc_file_checksum` function is hiding the error Result
in case of an error respones. Made it early return instead on Error.

22 months agorockusb_fwudate: rk3588 spl_loader
Sven Rademakers [Mon, 14 Aug 2023 15:39:07 +0000 (16:39 +0100)]
rockusb_fwudate: rk3588 spl_loader

Load an spl that inits ram and setup the usb flashing environment when
The device is booted into MaskRom mode. Without this step, writing a
image to the device will fail.

This commit makes use of rockusb branch of svenrademakers. Hopefully
the patch associated with this CL will be submitted upstream soon.

22 months agousbboot: rename verify_one_device
Sven Rademakers [Thu, 17 Aug 2023 03:56:00 +0000 (04:56 +0100)]
usbboot: rename verify_one_device

renamed to extract_one_device as intent changed

22 months agofirmware_update: FlashingErrorExt
Sven Rademakers [Mon, 14 Aug 2023 15:32:32 +0000 (16:32 +0100)]
firmware_update: FlashingErrorExt

Created trait that maps a `Result<T, E>` into a
`Result<T, FlashingError>` using the logging pipe.

This commit aims to increase code clarity by concentrating generic
logic.

22 months agoCargo.toml: update versions of tokio, log & serde
Sven Rademakers [Mon, 14 Aug 2023 08:04:58 +0000 (09:04 +0100)]
Cargo.toml: update versions of tokio, log & serde

22 months agofirmware_update: resolve technical debt
Sven Rademakers [Mon, 7 Aug 2023 14:46:29 +0000 (15:46 +0100)]
firmware_update: resolve technical debt

The goal is to decouple and concentrate generic logic from the two
firmware update mechanisms currently present in the code-base. This
should make it more easy for new devs to append new transport and
therefore support more devices.

This commit also updates the rockusb dependency to the fork containing
fixes so that the RK1 devices work. fixes #45,
https://github.com/turing-machines/BMC-Firmware/issues/45

22 months agousbboot: build compatible devices list
Sven Rademakers [Mon, 7 Aug 2023 09:25:47 +0000 (10:25 +0100)]
usbboot: build compatible devices list

revert back to old situation where a list of devices is build. Last
commit was automatically picking the first out of the list. Now,
firmware update will fail if there are more as one device connected to
the BMC.

22 months agofeature gate fwu modules
Sven Rademakers [Fri, 4 Aug 2023 16:41:23 +0000 (17:41 +0100)]
feature gate fwu modules

added 2 features, "rpi" and "rock" that are enabled by default.
Both pull in additional dependencies and add to binary size. Via this
way there is a convinient way to opt out of these features

22 months agobmcd: remove last `unwrap()`
Ruslan Akbashev [Sun, 20 Aug 2023 20:47:14 +0000 (00:47 +0400)]
bmcd: remove last `unwrap()`

22 months agobmcd: set power state of nodes in one function call
Ruslan Akbashev [Fri, 18 Aug 2023 13:12:54 +0000 (17:12 +0400)]
bmcd: set power state of nodes in one function call

22 months agobmcd: remove `Mutex` and mutable references to `BmcApplication`
Ruslan Akbashev [Fri, 18 Aug 2023 11:52:14 +0000 (15:52 +0400)]
bmcd: remove `Mutex` and mutable references to `BmcApplication`

22 months agobmcd, lib: add `get_usb_mode()`
Ruslan Akbashev [Wed, 2 Aug 2023 17:24:06 +0000 (21:24 +0400)]
bmcd, lib: add `get_usb_mode()`

22 months agobmcd/legacy: add GET methods
Ruslan Akbashev [Wed, 2 Aug 2023 17:22:38 +0000 (21:22 +0400)]
bmcd/legacy: add GET methods

22 months agobmcd/legacy: add explanations to errors and `Query` type alias
Ruslan Akbashev [Wed, 2 Aug 2023 17:17:53 +0000 (21:17 +0400)]
bmcd/legacy: add explanations to errors and `Query` type alias

22 months agobmcd: begin adding legacy API, with stubs for now
Ruslan Akbashev [Wed, 2 Aug 2023 17:17:28 +0000 (21:17 +0400)]
bmcd: begin adding legacy API, with stubs for now

22 months agoadd HTTPS server that serves static files
Ruslan Akbashev [Wed, 2 Aug 2023 17:16:15 +0000 (21:16 +0400)]
add HTTPS server that serves static files

22 months agoadd common logging crates, enable timestamps for `simple_logger`
Ruslan Akbashev [Wed, 2 Aug 2023 17:03:00 +0000 (21:03 +0400)]
add common logging crates, enable timestamps for `simple_logger`

22 months agomove tpi_rs into its own directory, start bmcd
Ruslan Akbashev [Wed, 2 Aug 2023 16:49:41 +0000 (20:49 +0400)]
move tpi_rs into its own directory, start bmcd

22 months agoserde: bump to 1.0.180
Sven Rademakers [Wed, 2 Aug 2023 13:02:44 +0000 (14:02 +0100)]
serde: bump to 1.0.180

22 months agofirmware_update_usb: create match statement of vid_pids
Sven Rademakers [Mon, 31 Jul 2023 13:00:30 +0000 (14:00 +0100)]
firmware_update_usb: create match statement of vid_pids

22 months agofirmware_update_usb: only iterate usb devices once
Sven Rademakers [Fri, 28 Jul 2023 10:00:53 +0000 (11:00 +0100)]
firmware_update_usb: only iterate usb devices once

Small refactoring so usb devices are only iterated once.

22 months agotpi_rs: remove unused `async-trait` dependency
Ruslan Akbashev [Wed, 2 Aug 2023 08:17:58 +0000 (12:17 +0400)]
tpi_rs: remove unused `async-trait` dependency

23 months agobump version to 1.3.0 1.3.0
Sven Rademakers [Fri, 28 Jul 2023 10:30:52 +0000 (11:30 +0100)]
bump version to 1.3.0

23 months agolib: fix checksum verification failure during flashing
Ruslan Akbashev [Fri, 28 Jul 2023 03:47:30 +0000 (07:47 +0400)]
lib: fix checksum verification failure during flashing

Prior to d8c41c61c ("GH-45 extract raspberry specific to seperate
module"), flashing code would open a device file for writing, write,
open device for reading, read (with cache dropping in-between).

In that change, file handle is reused for writing and subsequent
reading, leading to invalid OoB reads. Fix this by seeking to a start
of file after writing.

23 months agolib: fix clippy warnings
Ruslan Akbashev [Fri, 28 Jul 2023 01:23:29 +0000 (05:23 +0400)]
lib: fix clippy warnings

23 months agobmc_application: small improvement on logging
Sven Rademakers [Thu, 27 Jul 2023 07:43:10 +0000 (08:43 +0100)]
bmc_application: small improvement on logging

During firmware upgrade, use the Debug trait to make sure the correct
node id is being printed in a logging statement.

23 months agobuild(deps): bump serde from 1.0.171 to 1.0.175
dependabot[bot] [Mon, 24 Jul 2023 07:02:16 +0000 (07:02 +0000)]
build(deps): bump serde from 1.0.171 to 1.0.175

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.171 to 1.0.175.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.171...v1.0.175)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
23 months agobuild(deps): bump async-trait from 0.1.71 to 0.1.72
dependabot[bot] [Mon, 24 Jul 2023 07:02:23 +0000 (07:02 +0000)]
build(deps): bump async-trait from 0.1.71 to 0.1.72

Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.71 to 0.1.72.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.71...0.1.72)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
23 months agopin_controller: fix wrong USB_PWEN values breaking USB host mode
Ruslan Akbashev [Thu, 27 Jul 2023 05:26:50 +0000 (09:26 +0400)]
pin_controller: fix wrong USB_PWEN values breaking USB host mode

Due to a specification + implementation mishap, values for a USB-A
power-controlling pin were inverted, leading to port being disabled when
the opposite was expected. In the future, this should be caught by a
special test runner.

Fixes #15

23 months agoCI: use clippy-check
Sven Rademakers [Mon, 24 Jul 2023 11:57:08 +0000 (12:57 +0100)]
CI: use clippy-check

The clippy-check github action publishes a report of the workflow
page of a given run in github.

23 months agobmc_application: bugfix: power state support legacy tpi
Stan Nevedomsky [Wed, 19 Jul 2023 09:53:18 +0000 (10:53 +0100)]
bmc_application: bugfix: power state support legacy tpi

If one node is on, consider the global 'on state' also to be on

23 months agorpi_fwupdate: bug-fix: AsyncRead was connected wrong
Sven Rademakers [Mon, 17 Jul 2023 09:45:14 +0000 (10:45 +0100)]
rpi_fwupdate: bug-fix: AsyncRead was connected wrong

23 months agobmc_application: fix bug in updating power state.
Sven Rademakers [Mon, 17 Jul 2023 09:39:11 +0000 (10:39 +0100)]
bmc_application: fix bug in updating power state.

Update the global on/off state only when all nodes are on/off.

23 months agobuild(deps): bump sqlx from 0.7.0 to 0.7.1
dependabot[bot] [Mon, 17 Jul 2023 06:41:49 +0000 (06:41 +0000)]
build(deps): bump sqlx from 0.7.0 to 0.7.1

Bumps [sqlx](https://github.com/launchbadge/sqlx) from 0.7.0 to 0.7.1.
- [Changelog](https://github.com/launchbadge/sqlx/blob/main/CHANGELOG.md)
- [Commits](https://github.com/launchbadge/sqlx/compare/v0.7.0...v0.7.1)

---
updated-dependencies:
- dependency-name: sqlx
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
23 months agobuild(deps): bump anyhow from 1.0.71 to 1.0.72
dependabot[bot] [Mon, 17 Jul 2023 06:41:37 +0000 (06:41 +0000)]
build(deps): bump anyhow from 1.0.71 to 1.0.72

Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.71 to 1.0.72.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.71...1.0.72)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
23 months agoImplemented RK1 fwupdate support.
Sven Rademakers [Wed, 12 Jul 2023 15:49:48 +0000 (16:49 +0100)]
Implemented RK1 fwupdate support.

This work fixes #45:
    https://github.com/turing-machines/BMC-Firmware/issues/45

Implemented discovery of an RK1 module as well as Implemented the
firmware update read/write trait. Note that its implemented in a
blocking way. #12 is opened to track any work to improve on this.

This implementation expects the RK1 to be put into maskedROM mode.
Writing to eMMC starts from sector 0.