From: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@xxxxxxxxxxx>
I2C, USB, and PCIe are examples of buses which have a mechanism to give
userspace direct access to a device on those buses. The MHI userspace
character interface (uci) is the MHI bus analogue.
The MHI bus devices are MHI channels which ferry blocks of data from
one
end to the other. With this simple purpose, we can define a simple
interface to userspace - a character device that supports
open/close/read/
write/poll operations. Since bus devices can only have a single
consumer
we encode a whitelist of MHI channels to be exported to userspace so as
to avoid conflicts.
We also make this mechanism open to any device that implements MHI.
Today this includes WLAN (Wi-Fi), WWAN (4G/5G cellular), and ML/AI
devices. More devices are expected in the future.
In addition to implementing the framework for uci, we include an
initial
usecase - the QAIC Sahara device.
Sahara is a file transfer protocol that is commonly used for two
purposes
when interacting with a device - transferring firmware to the device
and
transferring crashdumps from the device. The Sahara protocol puts the
receiver of the data in control of the transfer. A firmware transfer
operation would have the device requesting the specific firmware images
that the device wants, and the host satisfying those requests.
In most cases, including for AIC100, Sahara is used as part of a two
stage
loading process. The device will boot a very limited bootloader that
does
the base minimum initialization and jump to the next stage. A
simple, one-
shot protocol like BHI is used to send the next stage bootloader to the
device. This second stage bootloader contains more functionality and
implements the Sahara protocol. The second stage determines from
various
inputs what set of runtime firmware is required to boot the device
into an
operational status, and requests those pieces from the host. With
those
images transferred over, the device can funnly initialize.
Each AIC100 instance (currently, up to 16) in a system will create a
MHI device for QAIC_SAHARA. MHI_uci will consume each of these and
create
a unique chardev which will be found as
/dev/<mhi instance>_QAIC_SAHARA
For example - /dev/mhi0_QAIC_SAHARA
An open userspace application that can consume these devices for
firmware
transfers is located at https://github.com/andersson/qdl
Signed-off-by: Pranjal Ramajor Asha Kanojiya
<quic_pkanojiy@xxxxxxxxxxx>
[jhugo: Rename to uci, plumb to mhi, rewrite commit text]
Signed-off-by: Jeffrey Hugo <quic_jhugo@xxxxxxxxxxx>